<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;C0EHRXc6eip7ImA9WhRRFEk.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970</id><updated>2011-11-27T16:53:54.912-08:00</updated><category term="cobol string handling" /><category term="cobol" /><title>Mainframe Tutorials</title><subtitle type="html">This is free Mainframe tutorials. It contains basic concepts in COBOL, JCL, MVS, VSAM, DB2. I will keep updating and adding more contents as and when possible.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://mftuto.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>36</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/MainframeTutorials" /><feedburner:info uri="mainframetutorials" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DUMFRn0_cSp7ImA9WxBbEU8.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-1953330345698261719</id><published>2010-03-08T08:00:00.000-08:00</published><updated>2010-03-09T01:36:57.349-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-09T01:36:57.349-08:00</app:edited><title>JCL</title><content type="html">&lt;a href="http://mftuto.blogspot.com/2010/03/1-introduction.html"&gt;1. Introduction&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/03/2-jcl-syntax.html"&gt;2. JCL Syntax&lt;/a&gt;&lt;br /&gt;Syntax Rules &lt;br /&gt;Job Statement &lt;br /&gt;Accounting Information parameter : &lt;br /&gt;Programmer’s Name : &lt;br /&gt;MSGLEVEL parameter : &lt;br /&gt;TheMSGCLASS parameter : &lt;br /&gt;The Class Parameter : &lt;br /&gt;The PRTY parameter &lt;br /&gt;The TIME Parameter &lt;br /&gt;The REGION parameter &lt;br /&gt;The ADDRSPC parameter &lt;br /&gt;The NOTIFY parameter &lt;br /&gt;The RESTART parameter &lt;br /&gt;The TYPRUN parameter &lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/03/3-exec-statement.html"&gt;3. The EXEC statement&lt;/a&gt;&lt;br /&gt;The REGION Parameter &lt;br /&gt;The TIME parameter &lt;br /&gt;The ADDRSPC parameter &lt;br /&gt;The ACCT Parameter &lt;br /&gt;The PARM Parameter &lt;br /&gt;The COND Parameter &lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/03/4-dd-statement.html"&gt;4. The DD statement&lt;/a&gt;&lt;br /&gt;The DSN Parameter &lt;br /&gt;The DISP Parameter &lt;br /&gt;The UNIT Parameter &lt;br /&gt;The VOL Parameter &lt;br /&gt;The SPACE Parameter &lt;br /&gt;The LABEL Parameter &lt;br /&gt;The DCB Parameter &lt;br /&gt;Instream Data &lt;br /&gt;The SYSOUT Parameter &lt;br /&gt;Concatenation &lt;br /&gt;DUMMY Parameter &lt;br /&gt;The JOBLIB DD Statement &lt;br /&gt;The STEPLIB STATEMENT &lt;br /&gt;STORAGE DUMP &lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/03/5-procedure.html"&gt;5. Procedure&lt;/a&gt;&lt;br /&gt;SYMBOLIC PARAMETERS &amp; SYMBOLIC OVERRIDES &lt;br /&gt;THE PROC STATEMENT &lt;br /&gt;IN-STREAM PROCEDURES &lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/03/6-utility.html"&gt;6. Utility&lt;/a&gt;&lt;br /&gt;IEFBR14 UTILITY &lt;br /&gt;IEBGENER UTILITY &lt;br /&gt;SORT UTILITY&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-1953330345698261719?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Rdg4VMnEHUMZ1KXUp5LEz-UNzLM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Rdg4VMnEHUMZ1KXUp5LEz-UNzLM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Rdg4VMnEHUMZ1KXUp5LEz-UNzLM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Rdg4VMnEHUMZ1KXUp5LEz-UNzLM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/N5QtKBO--0o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/1953330345698261719/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=1953330345698261719" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/1953330345698261719?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/1953330345698261719?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/N5QtKBO--0o/jcl.html" title="JCL" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/03/jcl.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUUDQX8zeCp7ImA9WxBbEU8.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-8513897254775941359</id><published>2010-03-08T07:59:00.000-08:00</published><updated>2010-03-09T01:34:30.180-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-09T01:34:30.180-08:00</app:edited><title>1. Introduction</title><content type="html">Need of JCL &lt;br /&gt;&lt;br /&gt;1. Introduction&lt;br /&gt;&lt;br /&gt;JCL is a language in which the users of a computer systems describes to that system the requirements of their jobs.&lt;br /&gt;&lt;br /&gt;• Provides a primary interface between user and the JES.&lt;br /&gt;• Used to perform batch mode processing under MVS.&lt;br /&gt;&lt;br /&gt;Within a job, JCL provides the specification necessary for MVS to process the job.&lt;br /&gt;&lt;br /&gt;Specifications of a job are :&lt;br /&gt;&lt;br /&gt;• User identity&lt;br /&gt;• Data file identity&lt;br /&gt;• Resource requirement&lt;br /&gt;• Error handling&lt;br /&gt;&lt;br /&gt;Need of JCL&lt;br /&gt;&lt;br /&gt;• Request execution of program under MVS environment&lt;br /&gt;• Sets the requirement for a job&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/03/jcl.html"&gt;Back to JCL Index&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com"&gt;Back to home page&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-8513897254775941359?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JjFSrIvYGYQ20DwxResXOGtHiE4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JjFSrIvYGYQ20DwxResXOGtHiE4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/JjFSrIvYGYQ20DwxResXOGtHiE4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JjFSrIvYGYQ20DwxResXOGtHiE4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/RwPcdC-88Y0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/8513897254775941359/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=8513897254775941359" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/8513897254775941359?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/8513897254775941359?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/RwPcdC-88Y0/1-introduction.html" title="1. Introduction" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/03/1-introduction.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEAESX05fyp7ImA9WxBbEkw.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-7719672180737357780</id><published>2010-03-08T07:57:00.000-08:00</published><updated>2010-03-10T01:18:28.327-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-10T01:18:28.327-08:00</app:edited><title>2. JCL Syntax</title><content type="html">Syntax Rules&lt;br /&gt;&lt;br /&gt;General JCL command format&lt;br /&gt;&lt;br /&gt;//name     operation parameter1,parameter2     Comments&lt;br /&gt;&lt;br /&gt;where;&lt;br /&gt;name         : is not to exceed 8 characters&lt;br /&gt;operation  : generally begins in column 12&lt;br /&gt;parameter : generally begins in column 17&lt;br /&gt;comments : are separated from the parameters by a blank&lt;br /&gt;&lt;br /&gt;Parameters are broadly classified into 2 categories viz. Positional and Keyword.&lt;br /&gt;&lt;br /&gt;A positional parameter is identified by its position relative to other parameters in the operand field.&lt;br /&gt;&lt;br /&gt;Rule 1 : All positional parameters are coded first in the operand field and in their proper sequence.&lt;br /&gt;&lt;br /&gt;e.g. : p1,p2,p3&lt;br /&gt;         p1,p3,p2       illegal because they are not in sequence.&lt;br /&gt;&lt;br /&gt;A keyword parameter is identified by a keyword followed by an equal sign (=) and variable information.&lt;br /&gt;&lt;br /&gt;Rule 2 : A keyword parameter follows positional parameter and can be coded in any  order.&lt;br /&gt;&lt;br /&gt;e.g. : p1,p2,p3,k1=,k2=,k3=&lt;br /&gt;         p1,p2,p2,k3=,k2=,k1=&lt;br /&gt;&lt;br /&gt;Both are valid.&lt;br /&gt;&lt;br /&gt;Note : All parameters are separated by commas with no intervening spaces.&lt;br /&gt;&lt;br /&gt;Rule 3 : The absence of positional parameter is noted by a comma(,) coded in its  place, except for the last or remainder of the positional parameter are not present. The placeholder commas do not need to be coded.&lt;br /&gt;&lt;br /&gt;e.g. : p1,,p3,k1=,k2=,k3=      place holder comma required&lt;br /&gt;         p1,k1=,k2=,k3=&lt;br /&gt;&lt;br /&gt;Rule 4 :  Both positional parameters and variable information for keyword parameters may be composed of subparameters. The subparameters may be either positional or keyword. Subparameters must be coded as a list. The list must be enclosed in paranthesis unless only one subparameter is coded. When only one subparameter is coded the paranthesis are optional.&lt;br /&gt;&lt;br /&gt;e.g : p1,(sp1,sp2),p3,k1=(sk1,sk2),k2=,k3=&lt;br /&gt;        p1,(sp1),p3,k1=(sk1),k2=,k3=&lt;br /&gt;  or  p1,sp1,p3,k1=sk1,k2=,k3=&lt;br /&gt;&lt;br /&gt;Rules for continuation : The JCL statement can be continued in a simple way. The statement  must be interrupted at a comma. This means that the last valid character of the line must be a comma followed by atleast one blank. Then the statement can be continued into the next line by coding two slashes at the beginning of the line and continuing the parameter field starting anywhere between positions 4 and 16 (4 and 16 included). Note that the comma which indicates continuation, is  not an extraneous character but part of the statement. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//dd1       dd   dsn=da0001t.empfile,disp=(new,catalg,delete),&lt;br /&gt;//             unit=sysda,space=(trk,(5,1)),dcb=(lrecl=80,recfm=fb,blksize=800)&lt;br /&gt;//dd1       dd   dsn=da0001t.empfile,disp=(new,catalg,delete),&lt;br /&gt;//                   unit=sysda,space=(trk,(5,&lt;br /&gt;//                   1)),dcb=(lrecl=80,recfm=fb,blksize=800)&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Eg. 2.1  Examples of valid continuation&lt;br /&gt;&lt;br /&gt;Job Statement&lt;br /&gt;&lt;br /&gt;The job statement identifies job to the O/S with the job name operand.&lt;br /&gt;&lt;br /&gt;The format of the JOB statement is :&lt;br /&gt;&lt;br /&gt;//jobname  JOB parameters&lt;br /&gt;&lt;br /&gt;Note that jobname cannot exceed 8 characters and is usually the userid (loginid)&lt;br /&gt;&lt;br /&gt;//da0001ta  JOB parameters&lt;br /&gt;&lt;br /&gt;Loginid is generally 7 characters, so you need to add a suffix lest the system prompts you to enter the character when a job is submitted to the system for execution.&lt;br /&gt;&lt;br /&gt;When a job is submitted to the system, a job number is also assigned so that the job can be further identified. This way jobs with the same name can be uniquely identified. Jobs with the same name cannot execute simultaneously. If several jobs with the same name are submitted they execute sequentially even if additional jobs could be executing. Jobs waiting to run because of this time conflict are shown in hold status.&lt;br /&gt;&lt;br /&gt;Remark : 1 A JOB statement must be at the beginning of every job submitted to the   system  for execution.&lt;br /&gt;                2 A JOB statement must have a name. The absence of  a jobname will result in a JCL error. &lt;br /&gt;&lt;br /&gt;The rest of the JOB statement contains postional parameters followed by keyword.&lt;br /&gt;&lt;br /&gt;Accounting Information parameter :&lt;br /&gt;&lt;br /&gt;It is a positional parameter. If present (it normally is), it must be the first in the parameter field. It can have a maximum of 142 characters (including parenthesis and commas but not apostrophes) . It is used to tie the resources used by the job to the appropriate account.&lt;br /&gt;&lt;br /&gt;//jobname JOB ([account-number][,additional-accounting-information]),parameters&lt;br /&gt;&lt;br /&gt;The account-number is an alphanumeric field from 1 to 4 characters long (many installations permit the use of more than 4 characters.&lt;br /&gt;&lt;br /&gt;Additional-accounting-information is installation dependent. Many of the fields are not very important and are not often used. Note that except for the account number, all other subparameters can be supplied through the /*JOBPARM JES2 control statement. (JES2 control statements are not covered in this book, refer to IBM Manual.&lt;br /&gt;&lt;br /&gt;e.g :&lt;br /&gt;//da0001ta  JOB LA2719,parameters&lt;br /&gt;&lt;br /&gt;LA2719 is the account number for the training dept. This varies from project to project. Therefore, consult the right person. &lt;br /&gt;&lt;br /&gt;If any portion of the field contains a special character other than a “,” (comma) or a  “-“ (hyphen), the portion must be enclosed in apostrophes. If an ampersand or quotes is used in the accounting field, code two consecutive ampersands or quotes. &lt;br /&gt;&lt;br /&gt;e.g. :1 &lt;br /&gt;&lt;br /&gt; //da0001ta  JOB ‘LA2719,TRG’&lt;br /&gt;  or     //da0001ta  JOB (LA2719,TRG)&lt;br /&gt;      &lt;br /&gt; e.g. :2 &lt;br /&gt;&lt;br /&gt; //da0001ta  JOB (LA2719,’P&amp;&amp;G’)&lt;br /&gt;&lt;br /&gt;The system assumes a single ampersand.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Remark: An installation has the option of making the account number mandatory and most installations do. If so, its absence will cause a JCL error. &lt;br /&gt;               &lt;br /&gt;If the account number is incorrectly specified, in this case its not JCL error. However when job is submitted to the system for execution, we get the message JOB NOT RUN  in the sysout. &lt;br /&gt;&lt;br /&gt;Programmer’s Name : &lt;br /&gt;&lt;br /&gt;Following the accounting information parameter, another positional parameter, the programmer’s name can be coded. The installation determines if this parameter is required or not. If required, it must be coded immediately after the accounting information, and its omission will cause a JCL error. The programmer’s name cannot exceed 20 characters. If it contains any special characters other than a hyphen and a period in the middle or the beginning (but not at the end) of the name, the name must be enclosed in apostrophes. The apostrophes are not added to the length of the name. If a name contains an apostrophe (e.g., D’COSTA), two apostrophes must be coded. They count as one character in the length of the name.&lt;br /&gt;&lt;br /&gt;e.g. : 1 &lt;br /&gt;&lt;br /&gt;//da0001ta  JOB LA2719,Pai,parameters&lt;br /&gt;&lt;br /&gt; e.g. : 2&lt;br /&gt;&lt;br /&gt; //da0001ta   JOB LA2719,’D’’COSTA’,parameters&lt;br /&gt;&lt;br /&gt;Note : Accounting information and Programmer’s name are the only two positional   parameters in the JOB statement, what follows after that are keyword parameters. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MSGLEVEL parameter : &lt;br /&gt;&lt;br /&gt;This parameter specifies whether the submitted JCL and/or JCL-related messages should be shown on the job’s output.&lt;br /&gt;&lt;br /&gt;General syntax&lt;br /&gt;&lt;br /&gt;MSGLEVEL=([jcl][,messages])         Keyword parameter&lt;br /&gt;Jcl - 0, 1, or 2&lt;br /&gt;&lt;br /&gt;0 - only the JOB statement will be shown&lt;br /&gt;1 - All JCL will be shown&lt;br /&gt;• instream&lt;br /&gt;• expanded cataloged procedures&lt;br /&gt;• symbolic parameter substitutions&lt;br /&gt;2 - All JCL will be shown, but not expanded procedure listing.&lt;br /&gt;&lt;br /&gt;Messages – 0 or 1&lt;br /&gt;0 - No messages will be shown i.e information about step completion.&lt;br /&gt;1 – All messages will be shown viz allocation and termination messages.&lt;br /&gt;The messages subparameter can be thought of as On (1) or Off (0) . &lt;br /&gt;&lt;br /&gt;Remark:&lt;br /&gt;&lt;br /&gt;1.  If the entire parameter or either of the two fields is omitted, an installation-defined default is assumed.&lt;br /&gt;                    MSGLEVEL=1     ------------------MSGLEVEL=(1,default)&lt;br /&gt;                    MSGLEVEL=(,1) ------------------MSGLEVEL=(default,1)&lt;br /&gt;                    Parameter omitted  ------------------ MSGLEVEL=(default,default)&lt;br /&gt;           &lt;br /&gt;2. If the job encounter an ABEND failure, the second field always defaults to 1 even if coded as 0&lt;br /&gt;&lt;br /&gt;TheMSGCLASS parameter :&lt;br /&gt;&lt;br /&gt;This parameter assigns a sysout class to the Job log. The job log consists of what is what is known as system or JES datasets:&lt;br /&gt;• JES2 or JES3 log&lt;br /&gt;• JCL and its associated messages&lt;br /&gt;• Allocation and Termination messages&lt;br /&gt;&lt;br /&gt;MSGCLASS          - indicates the format of output&lt;br /&gt;                        - specifies output class for&lt;br /&gt;                                   job log (collection of all operations)&lt;br /&gt;                                   list (collection of all printed output like compiled listing)&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;MSGCLASS=class        Keyword parameter&lt;br /&gt;Class  - A character from A to Z or a number from 0 to 9 (in all 36 classes)&lt;br /&gt;&lt;br /&gt;MSGLEVEL parameter indicates whether or not one wishes to print the JCL statements and allocation messages. The MSGLEVEL can save paper. After a job is debugged, there may be no need to print all the JCL and allocation messages each time it runs. To reduce printing to a minimum, one may wish to MSGLEVEL=(0,0). &lt;br /&gt;&lt;br /&gt;All datasets to be printed must have a class. This is normally called the output class, sysout class or message class. Sysout datasets created by the executing programs are assigned a class by the SYSOUT DISTINCT statement. After the job terminates, the sysout datasets,  which are saved on the spool pack , will be selected and printed by a JES2 or JES3 component called a printer. There are several printers available, and each one is assigned one or more sysout classes (from 1 t0 36).  The sysout class can be thought of as a print-scheduling class. &lt;br /&gt;&lt;br /&gt;Remark : If the MSGCLASS parameter is omitted, an installation-defined default will be  used.&lt;br /&gt;&lt;br /&gt;The Class Parameter : &lt;br /&gt;&lt;br /&gt;This parameter assigns a class to a job.&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;CLASS=jobclass                Keyword parameter&lt;br /&gt;Jobclass – A letter from A to Z or a number from 0 to 9 ( in all 36 classes)&lt;br /&gt;&lt;br /&gt;The jobclass affects job’s processing in these ways :&lt;br /&gt;• When job is submitted, it is placed in an input queue where it waits to be executed. Queues can be thought of as waiting lines for jobs. Each job class has its own input queue&lt;br /&gt;• Job waits in the input queue until it is selected by an initiator to be processed. Each initiator is set to a list of job classes that it can select from.&lt;br /&gt;&lt;br /&gt;Simply put  Jobclass identifies the nature of the job&lt;br /&gt;- short running or long running&lt;br /&gt;- resource utilization&lt;br /&gt;&lt;br /&gt;Each installation group jobs that have like characterstics into classes. By segregrating jobs with similar characterstics, an installation can maintain a good mix of the jobs running at a given moment. This maintains system throughput and efficient use of resources. &lt;br /&gt;  &lt;br /&gt;Let us look at the sample table below &lt;br /&gt;&lt;br /&gt;Class Code Run Time (in minutes) Tape Disk Production Test&lt;br /&gt;1 5 X X X &lt;br /&gt;2 &gt;5 X X X &lt;br /&gt;A 5 X X  X&lt;br /&gt;B &lt;5 X X  X&lt;br /&gt;C &gt;5 X X  X&lt;br /&gt;&lt;br /&gt;Table 2.1&lt;br /&gt;&lt;br /&gt;In the sample table, the job classes were separated by&lt;br /&gt;- Production  vs Test&lt;br /&gt;- Tape vs disk &lt;br /&gt;- expected run time&lt;br /&gt;&lt;br /&gt;The example shows some of the characteristics an installation may look at, but certainly not all. Also, resources used by a job may be critical at one installation, but not at another. What is important is that one should follow installation’s standard.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For e.g. Suppose the default Class  is A&lt;br /&gt;&lt;br /&gt;This Job statement&lt;br /&gt;//DA0001TA   JOB LA2719,PCS,MSGCLASS=A,MSGLEVEL=(1,1)&lt;br /&gt;&lt;br /&gt;is equivalent to&lt;br /&gt;//DA0001TA   JOB LA2719,PCS,MSGCLASS=A,MSGLEVEL=(1,1),CLASS=A&lt;br /&gt;&lt;br /&gt;Remark : &lt;br /&gt;Frequently, installations develop a testing class structure that favors short-running jobs with minimal resource requirements and penalize long-running jobs with heavy resource demands. This is achieved by assigning the class used by trivial jobs to many initiators and class used by heavy jobs to few. To keep people honest, the CLASS parameter in a testing environment is often tied to several other parameters such as TIME,PRTY, REGION, etc. For example, a job coding CLASS=A can be given TIME=(0,5),PRTY=6. Note that the values assigned to these parameters is not shown in the output. However, if any of these parameters were coded in the JOB statement, they would be ignored.&lt;br /&gt;&lt;br /&gt;Most installation assigns a default job class if the Class parameter is omitted.&lt;br /&gt;&lt;br /&gt;The PRTY parameter&lt;br /&gt;&lt;br /&gt;This parameter determines the scheduling priority of a job in relation to other jobs in the job input queue of the same class.&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;PRTY=priorty           - keyword parameter&lt;br /&gt;Priorty – a number from 0 to 15 for JES2 or 0 to 14 for JES3&lt;br /&gt;&lt;br /&gt;The PRTY parameter is used to define the job’s input class selection priority :&lt;br /&gt;• The higher the number, the better (greater) the priority&lt;br /&gt;• The PRTY parameter simply controls the job’s position in the input queue. It  has no affect on the job’s performance.&lt;br /&gt;• Jobs with higher priorities will be selected before job’s will lower priority&lt;br /&gt;• A job’s priority does not affect its performance. Once the job is selected for execution, the priority function is finished.&lt;br /&gt;• Two jobs having same job class and same priority will be executed in sequence&lt;br /&gt;&lt;br /&gt;Comparing the PRTY parameter of two jobs belonging to different classes is meaningless.&lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;This parameter is of seldom use in a testing environment. Since high priorty would be used by practically all users negating the very purpose the parameter,. Therefore, in most installation the PRTY, whether coded or not, will default  to an installation-defined value or will be supplied by the CLASS parameter.&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;The TIME Parameter&lt;br /&gt;&lt;br /&gt;This parameter specifies the total amount of CPU time that all steps in a job can use collectively.&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;TIME=([minutes][,seconds] | [1440])             keyword parameter&lt;br /&gt;&lt;br /&gt;minutes - a number from 1 to 1439&lt;br /&gt;seconds - a number from 1 to 59&lt;br /&gt;1440 - The job will not be timed for CPU. It was also not “time out” (S522 ABEND failure) when a single wait state exceeds the installation-defined limit (often 10 to 20 minutes). Note that TIME=1440 is rarely used, and most installation disallow its use in a testing environment. TIME=1440 should be used by an on-line system like CICS OR ADS/O.&lt;br /&gt; &lt;br /&gt;When the TIME parameter is omitted, an installation-defined default will be used. This default is usually very high and unlikely to cause an S322 ABEND failure unless the program goes into an endless loop. &lt;br /&gt;&lt;br /&gt;If the TIME parameter is also coded in the JOB statement, both will be in effect and either can cause a S322 ABEND failure. It is not advisable to use them both.&lt;br /&gt;&lt;br /&gt;CPU time is the amount of time that the computer devoted to the job after it was selected for processing. It is not the amount of time it was in the machine.&lt;br /&gt;&lt;br /&gt;TIME parameter puts an upper limit on the amount of CPU time that a job may use.&lt;br /&gt;e.g : TIME=(3,20).&lt;br /&gt;&lt;br /&gt;All the steps in the job are allowed collectively 3 minutes and 20 seconds of CPU time. If this amount is exceeded, the result will be a S322 ABEND failure. &lt;br /&gt;&lt;br /&gt;If  the TIME parameter is coded using only minutes, seconds defaults to zero. For example, TIME=5 is the same as TIME=(6,0).&lt;br /&gt;&lt;br /&gt;If  the TIME parameter is coded using only seconds, minutes defaults to zero. For example, TIME=(,6) is the same as TIME=(0,6).&lt;br /&gt;&lt;br /&gt;The TIME parameter is intended almost exclusively for a testing environment and should be coded to preempt the program going into CPU loop.&lt;br /&gt;&lt;br /&gt;The TIME parameter can also be supplied by the CLASS parameter. When the TIME parameter is omitted and the CLASS  parameter does not supply it, the job will not be timed for CPU time. However each step will be individually timed (TIME parameter at EXEC statement or its installation-defined default), unless it contains TIME=1440. &lt;br /&gt;&lt;br /&gt;Remark:&lt;br /&gt;It is possible for a job to get more CPU time than that is specified in the TIME parameter by a maximum 10.5 seconds. This is due to the fact that the system checks for violations every 10.5 seconds. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The REGION parameter &lt;br /&gt;&lt;br /&gt;This parameter specifies the limit of available storage for each of the steps in the job within the job’s address space. i.e., the amount of storage the job is allocated. Or, in other words, it specfies the amount of storage needed by the step (within the job) with the highest storage requirements.&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;REGION=value{K|M}               keyword parameter&lt;br /&gt;Value – 1 to 2096128 if K (1024 bytes) is used. It should be an even number, it will be rounded to the next higher even number.&lt;br /&gt;&lt;br /&gt;Value – 1 to 2047 if M (1024K or 1048576 bytes) is used. M is not available to MVS/SP, only to MVS/XA and MVS/ESA&lt;br /&gt;&lt;br /&gt;When a job is selected by an initiator for execution, it is given an address space of 16 MB ( minus what MVS/SP uses) .Incase of MVS/XA, job is given an address space of 2GB. And all of it is available to the job’s steps. However a step normally requires only a small fraction of this huge storage, below the  16M line. An ordinary COBOL or any other language program seldom needs more than 1000k. This is normally what the value in the REGION parameter represents in the installations. Few jobs like CICS, IMS, DB2 need storage above the 16M line. An ordinary batch job seldom has such high requirements and, as a result confined to storage below the 16M line. Storage availability below this line varies in different installations, but is generally around 8MB in MVS/SP and around 9 MB in MVS/XA. Storage above the 16M line can be acquired by coding a value higher than 16M. However, it may be restricted by the installation to only those jobs that need it.&lt;br /&gt;&lt;br /&gt;E.g 1.&lt;br /&gt;Assume REGION=1000K was coded in the JOB statement. All the steps in the job are limited to this value. If more storage is needed, the usual result is S878 or S80A or S804 ABEND failure. If one of these failures occurs, the user must increase the value in the REGION parameter.&lt;br /&gt;&lt;br /&gt;E.g 2.&lt;br /&gt;REGION=10M   &lt;br /&gt;When the amount of storage requested in the REGION parameter is higher than the address space can provide, an S822 ABEND failure will result.&lt;br /&gt;&lt;br /&gt;Note that for job run under MVS/SP, the entire address space is limited to 16M, of which usually less than 8M is available to the user. In case of MVS/XA, the entire address space is limited to 2G, of which usually around 9M is available to the user. &lt;br /&gt;&lt;br /&gt;E.g 3. &lt;br /&gt;REGION=0K (or 0M) is coded the entire address space except for those areas used by MVS/SP (or MVS/XA) is available. &lt;br /&gt;&lt;br /&gt;The ADDRSPC parameter&lt;br /&gt;&lt;br /&gt;This parameter specifies if the job will use real or virtual storage.&lt;br /&gt;&lt;br /&gt;General syntax&lt;br /&gt;&lt;br /&gt;ADDRSPC={VIRT|REAL}&lt;br /&gt;VIRT – The REGION  will be virtual storage and is the default&lt;br /&gt;REAL – The REGION will be real storage.&lt;br /&gt;&lt;br /&gt;Remark: &lt;br /&gt;This is the rarely used parameter because of the default. Note that ADDRSPC=REAL is a parameter that is disallowed in practically all installation because it can cause serious performance problems for other jobs. &lt;br /&gt;&lt;br /&gt;The NOTIFY parameter&lt;br /&gt;&lt;br /&gt;This parameter informs a TSO user when his or his job terminates.&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;NOTIFY=userid                  keyword parameter&lt;br /&gt;Userid – A name from 1 to 7 character, identifying a valid TSO user.&lt;br /&gt;&lt;br /&gt;E.g NOTIFY=DA0001T&lt;br /&gt;&lt;br /&gt;If coded, a message will appear on the user’s TSO terminal indicating if the job abended or got a JCL error. If the job terminates while the user was logged off, the message will appear when the user logs on. If the NOTIFY parameter is omitted, no message will appear when the job terminates.&lt;br /&gt;&lt;br /&gt;Remark : &lt;br /&gt;You can also code NOTIFY=&amp;SYSUID instead of your userid.&lt;br /&gt;&lt;br /&gt;The RESTART parameter&lt;br /&gt;&lt;br /&gt;This parameter requests that a job begin its execution with a step other than the first one. &lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;RESTART={stepname|procexec.stepname| *}      keyword parameter&lt;br /&gt;&lt;br /&gt;Stepname                –  The name of the step where execution is to begin.&lt;br /&gt;Procexec.stepname – The name of the EXEC statement invoking a procedure and the name of the step within the procedure where execution is to begin&lt;br /&gt;&lt;br /&gt;Note : Procedures will be covered on day 4.&lt;br /&gt;&lt;br /&gt;* - indicates that execution of the job is to begin with the first step and is the default.&lt;br /&gt;&lt;br /&gt;Things to avoid :&lt;br /&gt;• Duplicate name for EXEC statements invoking procedure. If RESTART=procsexec.stepname is used, the first procexec found will be used.&lt;br /&gt;• Duplicate stepnames within procedure. If RESTART=procsexec.stepname is used, the first stepname within procexec found will be used.&lt;br /&gt;• Duplicate stepnames. If RESTART=stepname is used, the first stepname found will be used.&lt;br /&gt;• EXEC statements (invoking procedures or any step) without names. No restart is possible&lt;br /&gt;• Creating and passing temporary datasets. Such datasets are always deleted by the time the job terminates and, therfore unavailable for restarting.&lt;br /&gt;• Creating and passing nontemporary datasets. If such a dataset is not received and assigned a permanent disposition, Job  Termination will delete it, making restart impossible&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The TYPRUN parameter&lt;br /&gt;&lt;br /&gt;This parameter requests special processing for the job.&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;TYPRUN={HOLD|JCLHOLD|SCAN|COPY}     keyword parameter&lt;br /&gt;&lt;br /&gt;HOLD  - Job will held (and not executed temporarily) until the operator uses a command to release. A job will be held in the input queue only if syntactically correct&lt;br /&gt;JCLHOLD (JES2 only) – Job will held (and not executed) until the operator uses a command to release it. Note the job will be held in queue if it is syntactically incorrect. Rarely used&lt;br /&gt;&lt;br /&gt;SCAN – Job will be scanned for all syntactical JCL errors but will not execute.&lt;br /&gt;&lt;br /&gt;COPY (JES2 only)- Job will be printed. No execution and no syntax checking takes place. Rarely used.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/03/jcl.html"&gt;Back to JCL Index&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com"&gt;Back to home page&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-7719672180737357780?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dJyB6pPSjeewuGx0I47xXXOfBMg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dJyB6pPSjeewuGx0I47xXXOfBMg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/dJyB6pPSjeewuGx0I47xXXOfBMg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dJyB6pPSjeewuGx0I47xXXOfBMg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/sZtkumH1eQg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/7719672180737357780/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=7719672180737357780" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7719672180737357780?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7719672180737357780?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/sZtkumH1eQg/2-jcl-syntax.html" title="2. JCL Syntax" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/03/2-jcl-syntax.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQFQnc9cSp7ImA9WxBbEEs.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-7543729135731636622</id><published>2010-03-08T07:53:00.000-08:00</published><updated>2010-03-08T08:05:13.969-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-08T08:05:13.969-08:00</app:edited><title>3. The EXEC Statement</title><content type="html">An EXEC statement identifies a step during the reading the reading process when a job is submitted to the system. When an EXEC is found, the system accepts all JCL statements that follow as belonging to the step, until a delimiter is found. There are four possible delimiters for a step during the reading process :&lt;br /&gt;• Another EXEC statement in the input stream. It signals the end of (reading) one step and the beginning of (reading) of another.&lt;br /&gt;• A JOB statement&lt;br /&gt;• A null statement i.e //. All JCL statements will be ignored except for a JOB statement.&lt;br /&gt;• End-of-file on the reading device, meaning there are no more statements to read.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;//[stepname]   EXEC  parameters&lt;br /&gt;stepname is optional. When the stepname is omitted no reference can be made. A job can contain a maximum of 255 steps.&lt;br /&gt;&lt;br /&gt;The PGM Parameter&lt;br /&gt;The PGM parameter identifies the program to be executed in a step.&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;PGM=pgmname              positional parameter&lt;br /&gt;&lt;br /&gt;Pgmname  - Name of the program to be fetched from the loadlibrary and executed.&lt;br /&gt;      &lt;br /&gt;The program specified in PGM is always a member of library (PDS). This is commonly known as an executable program library or a load library. The EXEC statement can identify only the member. It has no parameter available to identify the library. If necessary, this must be done by using a JOBLIB or a STEPLIB  DD statement. &lt;br /&gt;&lt;br /&gt;E.g.3.1&lt;br /&gt;&lt;br /&gt;//da0001ta    job  la2719,pcs,msglevel=(1,1),notify=&amp;sysuid&lt;br /&gt;//joblib          dd  dsn=da0001t.lib.loadlib=shr &lt;br /&gt;//s1                    exec   pgm=ass1 &lt;br /&gt;  &lt;br /&gt;    OR&lt;br /&gt;&lt;br /&gt;//da0001ta    job  la2719,pcs,msglevel=(1,1),notify=&amp;sysuid&lt;br /&gt;//s1                    exec   pgm=ass1 &lt;br /&gt;//steplib          dd  dsn=da0001t.lib.loadlib=shr &lt;br /&gt;&lt;br /&gt;If neither JOBLIB or STEPLIB is coded, the system searches certain predefined libraries. They are the system default libraries. If the specified member is found, it is executed. If not found, the result is S806-04 ABEND failure. &lt;br /&gt;&lt;br /&gt;The following keyword parameters can be specified at the EXEC statement. They are REGION, ADDRSPC, TIME , PARM and ACCT. &lt;br /&gt;&lt;br /&gt;The REGION Parameter&lt;br /&gt;&lt;br /&gt;This parameter specifies the limit of available storage for the step within the job’s address space. &lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;REGION=value{K|M}               keyword parameter&lt;br /&gt;Value – 1 to 2096128 if K (1024 bytes) is used. It should be an even number, it will be rounded to the next higher even number.&lt;br /&gt;&lt;br /&gt;Value – 1 to 2047 if M (1024K or 1048576 bytes) is used. M is not available to MVS/SP, only to MVS/XA and MVS/ESA&lt;br /&gt;&lt;br /&gt;If the REGION parameter is omitted , the REGION parameter in the EXEC statements within the job will be used. If it is coded in neither the JOB nor the EXEC  statement, an installation-defined default will be used. The default value of most installations is between 500K and 1000K.&lt;br /&gt;If the REGION parameter is coded in both the JOB and an EXEC statement within the job, the value in the JOB statement will be used.&lt;br /&gt;The REGION parameter in the JOB statement is used much more often than the one in the EXEC statement. Coding the same value for all steps would have the same effect as the REGION parameter in the JOB statement. &lt;br /&gt;&lt;br /&gt;E.g. 3.2&lt;br /&gt;&lt;br /&gt;//da0001ta    job  la2719,pcs,msglevel=(1,1),notify=&amp;sysuid&lt;br /&gt;//s1                    exec   pgm=ass1,region=500k &lt;br /&gt;//steplib          dd  dsn=da0001t.lib.loadlib=shr &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The TIME parameter&lt;br /&gt;&lt;br /&gt;This parameter specifies the total amount of CPU time  that the step is allowed to use.&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;TIME=([minutes][,seconds] | [1440])             keyword parameter&lt;br /&gt;&lt;br /&gt;minutes - a number from 1 to 1439&lt;br /&gt;seconds – a number from 1 to 59&lt;br /&gt;&lt;br /&gt;1440 - The step will not be timed for CPU. It was also not “time out” (S522 ABEND failure) when a single wait state exceeds the installation-defined limit (often 10 to 20 minutes). Note that TIME=1440 is rarely used, and most installation disallow its use in a testing environment. TIME=1440 should be used by an on-line system like CICS OR ADS/O.&lt;br /&gt;&lt;br /&gt;When the TIME parameter is omitted, an installation-defined default will be used. This default is usually very high and unlikely to cause an S322 ABEND failure. &lt;br /&gt;If the TIME parameter is also coded in the JOB statement, both will be in effect and either can cause a S322 ABEND failure. It is not advisable to use them both. &lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;It is possible for a step to get more CPU time than that is specified in the TIME parameter  or the default by a maximum 10.5 seconds. This is due to the fact that the system checks for violations every 10.5 seconds.&lt;br /&gt;&lt;br /&gt;E.g 3.3&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;          //da0001ta    job  la2719,pcs,msglevel=(1,0),notify=&amp;sysuid&lt;br /&gt;          //s1                    exec   pgm=ass1,region=500k,time=(,3) &lt;br /&gt;          //steplib          dd  dsn=da0001t.lib.loadlib=shr &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The ADDRSPC parameter&lt;br /&gt;&lt;br /&gt;This parameter specifies if the step will use real or virtual storage.&lt;br /&gt;&lt;br /&gt;General syntax&lt;br /&gt;&lt;br /&gt;ADDRSPC={VIRT|REAL}&lt;br /&gt;VIRT – The REGION  will be virtual storage and is the default&lt;br /&gt;REAL – The REGION will be real storage.&lt;br /&gt;&lt;br /&gt;If the ADDRSPC parameter is also coded in the JOB statement, the value in the JOB will be used. &lt;br /&gt;&lt;br /&gt;Remark:&lt;br /&gt;This is the rarely used parameter because of the default. Note that ADDRSPC=REAL is a parameter that is disallowed in practically all installation because it can cause serious performance problems for other jobs. &lt;br /&gt;&lt;br /&gt;The ACCT Parameter&lt;br /&gt;&lt;br /&gt;The parameter specifies accounting information to be used for the step as opposed to the accounting information in the JOB statement.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;ACCT=(acctno [additional-acct-info])           keyword parameter&lt;br /&gt;&lt;br /&gt;Acctno – The account number to be used for the step&lt;br /&gt;Additional-acct-info – same as in the JOB statement.&lt;br /&gt;&lt;br /&gt;The ACCT parameter is seldom used, and when it is, only the account number normally appears. This is used to charge resource utilization for a step to a different account number other than the one coded in the JOB statement. &lt;br /&gt;&lt;br /&gt;If an account number is also coded in the JOB statement, the account number in the EXEC statement will be used. &lt;br /&gt;&lt;br /&gt;E.g 3.4 &lt;br /&gt;&lt;br /&gt;          //da0001ta    job  la2719,pcs,msglevel=(1,0),notify=&amp;sysuid&lt;br /&gt;          //s1               exec   pgm=iefbr14,acct=(‘es0013,hr4200,iefbr14’)&lt;br /&gt;          //dd1                 dd  dsn=da0001t.pai.empfile,disp=(mod,delete),&lt;br /&gt;          //                         space=(trk,0),unit=sysda&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The PARM Parameter&lt;br /&gt;&lt;br /&gt;This parameter provides a way to supply data of limited size to the executing program&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;PARM=string                 keyword parameter&lt;br /&gt;&lt;br /&gt;String –A string of characters up to 100. If commas are part of the string, the entire field must be enclosed in parenthesis (or apostrophes). If any portion of the string contains special characters (other than hyphen), that portion of the entire string must be enclosed in apostrophes. Note that any parenthesis used count toward the maximum. Apostrophes do not. &lt;br /&gt;&lt;br /&gt;All information after the “=” in the PARM parameter, excluding apostrophes, will be saved by the system within the step’s own region. When the program begins execution by using the appropriate instructions, it can find the saved information in storage. &lt;br /&gt;&lt;br /&gt;In COBOL, the following must be coded :&lt;br /&gt;&lt;br /&gt;LINKAGE SECTION. &lt;br /&gt;01 PARM. &lt;br /&gt;05   PLENGTH            PIC S9(04)    COMP. &lt;br /&gt;05   INFO                     PIC X(05).&lt;br /&gt;PROCEDURE DIVISION USING PARM. &lt;br /&gt;0000-MAIN-PARA.  &lt;br /&gt;&lt;br /&gt;Note that any valid name may be used in place of PARM.  The string is stored in PARM and the PLENGTH is set to the length of the string. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;E.g 3.5&lt;br /&gt;&lt;br /&gt;//da0001ta  job  la2719,pcs,msglevel=(1,1),notify=&amp;sysuid&lt;br /&gt;//s1                    exec   pgm=ass2,parm=’g2   ‘,time=(,3) &lt;br /&gt;//steplib          dd  dsn=da0001t.lib.loadlib=shr&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Rules for continuation&lt;br /&gt;&lt;br /&gt;E.g 3.6&lt;br /&gt;&lt;br /&gt;//da0001ta  job  la2719,pcs,msglevel=(1,1),notify=&amp;sysuid&lt;br /&gt;//cob                exec   pgm=ikfcbl00,region=1024k,&lt;br /&gt;//          parm=(‘notrunc,nodynam,lib,size=4096k,buf=116k’,&lt;br /&gt;//                            ‘apost,nores,seq’)&lt;br /&gt;                     .&lt;br /&gt;                     .&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;//da0001ta    job  la2719,pcs,msglevel=(1,1),notify=&amp;sysuid&lt;br /&gt;//cob                exec   pgm=ikfcbl00,region=1024k,&lt;br /&gt;//          parm=(notrunc,nodynam,lib,’size=4096k’,’buf=116k’,&lt;br /&gt;//                            apost,nores,seq)&lt;br /&gt;                     .&lt;br /&gt;                     .&lt;br /&gt;Note that an expression in quotes cannot be continued, we need to enclose the string in parenthesis and field containing special characters in apostrophes.  &lt;br /&gt;&lt;br /&gt;E.g.2     PARM=’29/06/00’    or  (‘29/06/00’)&lt;br /&gt;E.g 3      PARM=(A,B,C,D)     or ‘A,B,C,D’&lt;br /&gt;The two, however , are not the same. When parentheses are used, the information found by the program is (A,B,C,D). If apostrophes are used, the information found by the program is A,B,C,D. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The COND Parameter&lt;br /&gt;&lt;br /&gt;The COND parameter can be coded in the JOB as well as the EXEC statement. It is mostly used in the EXEC statement. The main tool for controlling the execution of steps within a job is the COND parameter. &lt;br /&gt;&lt;br /&gt;A Return (or Condition) code &lt;br /&gt;&lt;br /&gt;A return code is a number between 0 and 4095, issued by an executing program just before its execution is finished. It is intended to identify an important event found (or not found) during the execution. For example, a program may issue a return code of 21 to indicate that a problematic event (such as a record is out of sequence) was detected during the execution  or a return code of 0 to indicate that the execution was trouble free. The return code issued by a program is saved by the system for the duration of the job. Any subsequent step of the same job can interrogate this return code by using the COND parameter either in the JOB or EXEC statement. The result of this interrogation is to permit or bypass the execution of the step. Note that the return code is never available to a job other than the one issued it. In other words, the step that interrogates the return code must be in the same job as, and subsequent to, the step that issued it. &lt;br /&gt;&lt;br /&gt;IBM-established conventions.&lt;br /&gt;• Return code of 0 indicates a complete success.&lt;br /&gt;• Return code of 4 indicates a warning. The warning is benign, so a return code will normally be treated as acceptable.&lt;br /&gt;• Return code of 8 indicates a questionable results.&lt;br /&gt;• Return code of 12 indicates bad results.&lt;br /&gt;• Return code of 16 indicates a terminal condition. &lt;br /&gt;&lt;br /&gt;The COND Parameter in the JOB statement. &lt;br /&gt;&lt;br /&gt;The COND Parameter can perform a test (or multiple tests) at the beginning of each step against the return (condition) codes issued by the previous steps. If a test is satisfied , none of the steps from that point on will be executed. &lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;COND=((code,operator) [,(code,operator)]…….)      keyword parameter&lt;br /&gt;Code  - is a number between 0 and 4095&lt;br /&gt;Operator – provides a comparison between a return code and the code. There are six operators : LT, LE, NE, EQ, GT, GE&lt;br /&gt;&lt;br /&gt;There can be a maximum of eight  tests in the COND parameter. Condition is evaluated from left to right and if a test is satisfied, the job stops execution at that point.&lt;br /&gt;&lt;br /&gt;An example can best illustrate the mechanism of the COND parameter. Consider a job with five steps. Assume that none will ABEND. &lt;br /&gt;&lt;br /&gt;//da0001ta    job la2719,pcs,cond=((12,lt),(8,eq))&lt;br /&gt;&lt;br /&gt;STEP1  issues a return code of 0&lt;br /&gt;STEP2, if executed, issues a return code of 4&lt;br /&gt;STEP3, if executed, issues a return code of 16&lt;br /&gt;STEP4, if executed, issues a return code of 0&lt;br /&gt;STEP5, if executed, issues a return code of 4&lt;br /&gt;(warning : This example does not adhere to conventions.)&lt;br /&gt;&lt;br /&gt;STEP 1 is executed by default, since no previous return codes exist and hence, the COND parameter in the JOB statement will be ignored for the first step. &lt;br /&gt;&lt;br /&gt;Before STEP2 begins execution, the system interrogates the existing return code (0), using the tests in the COND parameter and reading the test from left to right,&lt;br /&gt;• Is 12 less than 0? The answer is “no”. The first test of the COND parameter was not satisfied. The second test is tested. &lt;br /&gt;• Is 8 equal to 0? . The answer is “no”. Neither of the two tests was satisfied, and therefore, STEP2 is executed. &lt;br /&gt;&lt;br /&gt;Before STEP3 begins execution, the system interrogates the existing return codes (0 and 4), using the tests in the same  COND parameter. Since the result for return code 0 is already known, only 4 will be tested :&lt;br /&gt;• Is 12 less than 4? The answer is “no”. The first test of the COND parameter was not satisfied. The second test is tested. &lt;br /&gt;• Is 8 equal to 4 . The answer is “no”. Neither of the two tests was satisfied, and therefore, STEP3 is executed. &lt;br /&gt;&lt;br /&gt;Before STEP4 begins execution, the system interrogates the existing return codes (0 , 4 and 16), using the tests in the same  COND parameter. Since the results for return code 0 and 4 are  already known, only 16 will be tested :&lt;br /&gt;• Is 12 less than 16? The answer is “yes”. The first test of the COND parameter was  satisfied. There is no need for the second test . Executions of the job stops. STEP 4 and the remaining steps will not be executed.  &lt;br /&gt;&lt;br /&gt;A message will appear in the output:&lt;br /&gt;IEF2011 DA0001TA STEP4-JOB TERMINATED BECAUSE OF CONDITION CODES.&lt;br /&gt;&lt;br /&gt;A formula can be devised and used to code the COND parameter, if return code conventions are strictly adhered to :&lt;br /&gt;    COND=(last-good-return-code,LT)&lt;br /&gt;Or&lt;br /&gt;    COND=(first-bad-return-code,LE)&lt;br /&gt;&lt;br /&gt;Let us apply this formula to this example 0-4 is a good return code :&lt;br /&gt;4 -is the last good return code….COND=(4,LT)&lt;br /&gt;or&lt;br /&gt;5 - is the first bad return code…..COND=(5,LE)&lt;br /&gt;The two COND parameters are logically equivalent to each other, and it makes no difference which one is used.&lt;br /&gt;&lt;br /&gt;Exercise : Code the COND parameter, where 0 is the only good return code. &lt;br /&gt;&lt;br /&gt;The COND parameter in the EXEC statement&lt;br /&gt;The COND parameter can perform a test (or multiple tests) before a step begins execution against the return (condition) codes issued by previous steps. If a test is satisfied, the step will not be executed.&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;COND=((code,operator[,stepname])[,(code,operator[,stepname])]……[,EVEN|ONLY])        keyword parameter&lt;br /&gt;&lt;br /&gt;Code  - is a number between 0 and 4095&lt;br /&gt;&lt;br /&gt;Operator – provides a comparison between a return code and the code. There are six operators : LT, LE, NE, EQ, GT, GE&lt;br /&gt;Stepname – Identifies the name of the preceding step whose  return code will be interrogated. It can also appear as two names procexec.stepname where “procexec” identifies the name of the EXEC statement invoking a procedure and “stepname” the stepname within the procedure.&lt;br /&gt;EVEN  - requests that execution be permitted even though a previous (any previous) step has ABENDed.&lt;br /&gt;ONLY  - requests that execution be permitted only if  a previous (any previous) step has ABENDed.&lt;br /&gt;&lt;br /&gt;There can be a maximum of eight  tests in the COND parameter. EVEN or ONLY counts toward eight. Condition is evaluated from left to right and if a test is satisfied, only that step is not executed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Remark : &lt;br /&gt;• EVEN and ONLY cannot make reference to a particular step. They refer to any previous step that has ABENDed.&lt;br /&gt;• EVEN and ONLY are mutually exclusive&lt;br /&gt;• EVEN and ONLY have no positional significance. Each can be coded anywhere in the COND parameter in relation to other tests&lt;br /&gt;• Following an ABEND failure, a step cannot be executed unless it contains EVEN or ONLY in the COND parameter of its EXEC statement&lt;br /&gt;• The first step will always be executed unless COND=ONLY appears in the exec statement. COND=ONLY would cause the first step to be bypassed, since no previous  ABEND failures could have occurred. Any other COND parameter in the first EXEC statement will be ignored (i.e., COND=(4,LT) or COND=EVEN) or will result in JCL error (i.e., COND=(5,LT,stepname)) – since there are no previous step. &lt;br /&gt;• A step that is not executed issues no return code because a program responsible for for issuing the return code was not even loaded into the storage. As a result no return code exists. An attempt to interrogate the return code of such a step in the COND parameter of  a subsequent step will be ignored.&lt;br /&gt;• A step that ABEND’s issues no return code because a program always issues a return code (conditionally or by default) if it reaches the end of its execution and intentionally returns control to the system. When an ABEND occurs, the program loses control instantly. And is evicted from from execution by the system. As a result when a step ABEND’s no return code exists ( a completion code exists). An attempt to interogate the return code of such a step in the COND parameter of a step will be ignored until it contains EVEN or ONLY.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;     &lt;br /&gt;&lt;br /&gt;An example can best illustrate the mechanism of the COND parameter. Consider a job with five steps. This is a class room exercise.&lt;br /&gt; &lt;br /&gt;//da0001ta    job la2719,pcs,notify=&amp;sysuid,msglevel=(1,1)&lt;br /&gt;//s1                   exec   pgm=p1                                                       (4)&lt;br /&gt;//s2                   exec   pgm=p2,cond=((0,lt,s1),even)                    (12)&lt;br /&gt;//s3                   exec   pgm=p3,cond=(8,lt,s2)                                (0)&lt;br /&gt;//s4                   exec   pgm=p4,cond=(4,lt)                                     (8)&lt;br /&gt;//s5                   exec   pgm=p5,cond=((4,lt,s1),(0,lt,s3))            abend&lt;br /&gt;//s6                   exec   pgm=p6,cond=(even,(0,le,s5),)                 (16)*&lt;br /&gt;//s7                   exec   pgm=p7,cond=((0,lt,s1),even)                   (0)&lt;br /&gt;//s8                   exec   pgm=p8,cond=((0,lt,s1),(12,lt,s3) )            (0)&lt;br /&gt;//s9                   exec   pgm=p9,cond=only)                                   (4)&lt;br /&gt;//s10                 exec   pgm=p10,cond=only                                   (0)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If the COND parameter is  coded  neither at the JOB  nor at the EXEC statement, the step will be executed regardless of previous return codes. However it will not be if a previous step has ABENDed.&lt;br /&gt;&lt;br /&gt;If the COND parameter is coded in both the JOB statement as well as an EXEC statement within the JOB. The COND parameter of the JOB statement is tested first. If none of its tests are satisfied, then the COND parameter of the EXEC statement is tested. If a test is satisfied, none of the steps from that point on will be executed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This is a class room exercise. &lt;br /&gt;&lt;br /&gt;//DA0001TA    JOB LA2719,PCS,COND=(5,EQ),NOTIFY=DA0001T&lt;br /&gt;//S1                   EXEC   PGM=P1                                                              (4)&lt;br /&gt;//S2                   EXEC   PGM=P2,COND=(7,LT)                                     (ABEND)&lt;br /&gt;//S3                   EXEC   PGM=P3,COND=((20,GT,S1),EVEN)               (6)&lt;br /&gt;//S4                   EXEC   PGM=P4,COND=(3,EQ),ONLY)                       (8)&lt;br /&gt;//S5                   EXEC   PGM=P5,COND=(2,LT,S3)                                 -                        &lt;br /&gt;//S6                   EXEC   PGM=P6                                                                -&lt;br /&gt;//S7                   EXEC   PGM=P7,COND=((6,EQ,S5),ONLY)                 (5)&lt;br /&gt;//S8                   EXEC   PGM=P8,COND=EVEN                                     (0)&lt;br /&gt;//S9                   EXEC   PGM=P9                                                            -&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/03/jcl.html"&gt;Back to JCL Index&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com"&gt;Back to home page&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-7543729135731636622?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/kIggUWpsfnlEYqvwHW9NzClkAqk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kIggUWpsfnlEYqvwHW9NzClkAqk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/kIggUWpsfnlEYqvwHW9NzClkAqk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kIggUWpsfnlEYqvwHW9NzClkAqk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/RJ6V0opH4g4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/7543729135731636622/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=7543729135731636622" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7543729135731636622?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7543729135731636622?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/RJ6V0opH4g4/3-exec-statement.html" title="3. The EXEC Statement" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/03/3-exec-statement.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQHQ3cyfyp7ImA9WxBbEEs.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-8971837861639345811</id><published>2010-03-08T07:08:00.000-08:00</published><updated>2010-03-08T08:05:32.997-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-08T08:05:32.997-08:00</app:edited><title>4. The DD statement</title><content type="html">A DD (Data Definition_ statement must appear in a step when the executing program expects to read from or write to a dataset. In other words DD statement describes the dataset. The DD statement is the most complicated of all the JCL statements.&lt;br /&gt;The maximum number of DD statements in a step is 3273 . The DD statement can be coded in any order and always appear after the EXEC statement with the exeception of&lt;br /&gt;JOBLIB, JOBCAT, PROCLIB DD statement.&lt;br /&gt;&lt;br /&gt;The DSN Parameter&lt;br /&gt;&lt;br /&gt;The DSN (or DSNAME) parameter identifies the name of the dataset to be created or retreived. &lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;DSN=name| referback                                keyword parameter&lt;br /&gt;&lt;br /&gt;Name -      It could be a qualified name. This name consists of two or more simple name separated by periods for a maximum of 44 characters.&lt;br /&gt;E.g 1  DSN=da0001t.pcs.empfile&lt;br /&gt;&lt;br /&gt;E.g.2  DSN=da0001t.pcs.cobol(ass1)       identifies a library (da0001t.pcs.cobol) and a particular member. This notation describes a sequential dataset.&lt;br /&gt;&lt;br /&gt;e.g.3   DSN=&amp;&amp;name&lt;br /&gt;A simple name preceded by two ampersands identifies a temporary dataset. Temporary because it is not retained beyond job termination.&lt;br /&gt;The system generates a name with the following format :&lt;br /&gt;SYSyyddd.Thh.mm.ss.RV001.jobname.name&lt;br /&gt;Yyddd – Julian Calender; &lt;br /&gt;hhmmss – uses 24 hour clock ;&lt;br /&gt; RV001 –system provided information in reference to the reader; &lt;br /&gt;jobname – as it appears in the JOB statement ;&lt;br /&gt; Name – whatever is coded after &amp;&amp;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For e.g  DSN=&amp;&amp;temp&lt;br /&gt;              SYS00173.T090000.RV001.da0001ta.temp&lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;If the DSN name is omitted from a DD statement (except DD * , SYSOUT and DUMMY) also indicates a temporary dataset. However the system generates a name with the following format :&lt;br /&gt;SYSyyddd.Thhmmss.RV001.jobname.R0000001&lt;br /&gt;//SORTWK1     DD  UNIT=SYSDA,SPACE=(TRK,(1,2),RLSE)&lt;br /&gt;&lt;br /&gt;SYS00173.T100000.RV001.da0001ta.R0000001&lt;br /&gt;&lt;br /&gt;This form is basically used when a step requires a work dataset (a dataset created at the beginning of the step’s exeution and deleted at the end). Mostly by utilities.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Most utility uses this form&lt;br /&gt;&lt;br /&gt;Referback : This can have three formats :&lt;br /&gt;- *.stepname.ddname – Requests that the dataset name be copied from DD statement “ddname “ found in a previous step “stepname”.&lt;br /&gt;&lt;br /&gt;      e.g : DSN=*.step1.dd1&lt;br /&gt;&lt;br /&gt;- *.ddname – Requests that the dataset name be copied from a previous DD statement “ddname “ found in the same step “stepname”.&lt;br /&gt;&lt;br /&gt;             e.g : DSN=*.dd1&lt;br /&gt;&lt;br /&gt;- *.procexec.stepname.ddname – Requests that the dataset name be copied from DD statement “ddname “ found in a previous step “stepname” found within procedure “procexec”. (name of EXEC statement invokinh the procedure)&lt;br /&gt;     e.g : DSN=*.ps1.step1.dd1&lt;br /&gt;&lt;br /&gt;The DISP Parameter&lt;br /&gt;&lt;br /&gt;The DISP parameter specifies :&lt;br /&gt;- if the dataset is to be created or retreived&lt;br /&gt;- how to dispose of the dataset when the step terminates (normally or abnormally)&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;    NEW     ,DELETE        ,DELETE &lt;br /&gt;    OLD      ,KEEP        ,KEEP&lt;br /&gt;DISP= (  SHR      ,CATLG        ,CATLG      )     keyword parameter&lt;br /&gt;    MOD     ,UNCATLG      ,UNCATG;&lt;br /&gt;       ,PASS&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;DISP=(status-field,normal-disp-field,abnormal-disp-field)&lt;br /&gt;The status-field : This field tells the system whether the dataset is to be created or retrieved.&lt;br /&gt;&lt;br /&gt;NEW – Indicates that the dataset will be created in this step&lt;br /&gt;&lt;br /&gt;OLD - Indicates that an existing dataset will be retrieved and demands exclusive    control. &lt;br /&gt;&lt;br /&gt;SHR  - Indicates that an existing dataset will be retrieved. It also indicates that this dataset ,if on disk, can be shared with one or more other users.&lt;br /&gt;&lt;br /&gt;MOD  - This subparameter has two possible meanings :&lt;br /&gt;             Indicates that an existing dataset will be retrieved . This will be true if &lt;br /&gt;• The dataset is either cataloged or passed&lt;br /&gt;• The DD statement contains either VOL=SER or VOL=REF (a VOL                                          VOL=REF referring to a DD statement, which is a nonspecific request  for a new dataset, is not included)&lt;br /&gt;            Indicates that the dataset will be created. This is true if :&lt;br /&gt;• The DD statement contains neither VOL=SER nor VOL=REF and it describes a dataset which is neither cataloged nor passed.&lt;br /&gt;• The DD statement contains VOL=REF referring to a DD statement which is nonspecific request for a new dataset.&lt;br /&gt;&lt;br /&gt;e.g. 1 //dd1    dd  dsn=da0001t.empfile,disp=(mod,catlg),&lt;br /&gt;         //            unit=tape&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;1. The system assumes da0001t.empfile to be an existing dataset, since the DD statement contains neither VOL=SER or VOL=REF. The system searches the catalog and gets volume informatiom from the catalog entry. The volume have been found. This dataset will be treted as existing dataset.&lt;br /&gt;2. Had the dataset been neither cataloged nor passed. The systen would have been unable to find the volume information and MOD will default to new.&lt;br /&gt;&lt;br /&gt;e.g 2 //dd1    dd  dsn=da0001t.empfile,disp=(mod,catlg),&lt;br /&gt;         //            unit=sysda,vol=ser=bs3003,space=(trk,(1,2))&lt;br /&gt;&lt;br /&gt;Explanation: Since VOL=SER is specified, the fate of MOD is sealed, whether or not it exists. It will be treated as OLD (with appropriate positioning). If the dataset exists on that volume no problem, however, if it does not exist the result will be S213-04 ABEND failure (i.e dataset does not exists)&lt;br /&gt;&lt;br /&gt;Note :When UNIT and VOL=SER is specified the system does not search the catalog to locate the dataset. &lt;br /&gt;&lt;br /&gt;The normal disposition field : This field is used to tell the system how to dispose of the dataset when the step terminates normally (without an ABEND). &lt;br /&gt;DELETE – indicates that the dataset is to be deleted when the step terminates. For an existing  dataset, OLD, SHR or MOD (not defaulting to NEW), the dataset will also be uncataloged, if the catalog were used while retreiving the dataset.  It will only delete if the catalog were not used during the retrieval. This means that for a cataloged dataset, if you specify UNIT and VOL=SER the system does not search the catalog.&lt;br /&gt;&lt;br /&gt;Note :&lt;br /&gt; 1 When a tape dataset is deleted, nothing happens. A tape dataset cannot be deleted    through the DISP parameter. It is effectively deleted when the dataset is written over. &lt;br /&gt;2 A VSAM cluster cannot be deleted by coding DISP=(OLD,DELETE) as it defaults to DISP=(OLD,KEEP).&lt;br /&gt;3 A member of PDS cannot be deleted, as DISP applies to the entire PDS, and as   result it deletes the entire PDS. Use either TSO or IEHPROGM utility.&lt;br /&gt;4 The system always issues a message indicating “ DELETED’ or  “NOT DELETED N” N indicates the reason for failing. &lt;br /&gt;&lt;br /&gt;KEEP – Indicates that the dataset is to be kept when the step terminates. The system takes no action and issues a message indicating the dataset was kept. Again, the system issues a message “KEPT”. Note that  “NOT KEPT”  message does not exists.&lt;br /&gt;&lt;br /&gt;Note : KEEP does not imply CATLG. As a result, DISP=(NEW,KEEP) should be rarely used because next time you retrieve the dataset, you need to specify UNIT and VOL=SER. &lt;br /&gt; &lt;br /&gt;CATLG – Indicates that the dataset is to be kept and an entry for it placed in the catalog when the step terminates.&lt;br /&gt;&lt;br /&gt;Note :&lt;br /&gt;1. If cataloging is successful, the system issues “CATALOGED”&lt;br /&gt;2. If cataloging fails for a NEW dataset, the message will “NOT CATLGD n”&lt;br /&gt;(n indicates the reason for failing).&lt;br /&gt;3. If the dataset to be catologed is OLD or MOD , which was opened but did extend into additional volume(s), the message will “RECATALOGED n”&lt;br /&gt;4. If the dataset to be cataloged is OLD or MOD and has extended into additional volume(s), the message will be “recataloged”&lt;br /&gt;5. CATLG implies KEEP. DISP=(NEW,CATLG,DELETE)  is a very common parameter.&lt;br /&gt;&lt;br /&gt;When an attempt to catalog fails ?&lt;br /&gt;Explanation: Under certain conditions, the attempt to catalog a new entry fails. The step termination routines normally issue a message to inform the user :&lt;br /&gt;IEF287I    dataset name&lt;br /&gt;IEF287I    VOL=SER=BS3001, BS3003             NOT CATLGD n&lt;br /&gt;Followed by the message identifing the user catalog where the attempt to add the entry was made.&lt;br /&gt;IEF285I  user catalog name&lt;br /&gt;IEF285I VOL=SER=vol serial                             KEPT&lt;br /&gt;“n”  identifies the reason for which the cataloging operation failed.&lt;br /&gt;Often, n is 2. There are several reasons for failing to catalog a dataset. Most of them are seldom encountered. For instance, the failure could be due to an I/O error or an out-of-space condition in the catalog, both extremely rare. The one that is common is illustrated by means of an example.&lt;br /&gt;&lt;br /&gt;//dd1     dd dsn=da0001t.empfile,disp=(new,catlg,delete),&lt;br /&gt;//             space=(trk,(1,2)),unit=sysda,&lt;br /&gt;//             dcb=(lrecl=80,recfm=fb,blksize=800)&lt;br /&gt;&lt;br /&gt;If an entry for DA0001T.EMPFILE already exists in the catalog, the step termination routines will not replace the existing entry with the new one, however it keeps the dataset and issues the appropriate message. Unfortunately, “NOT CATLGD 2 “ is just a warning, operator tend to ignore.&lt;br /&gt;Whenever, you get this message. The existing entry must be removed before the one with the same one is added. Use IEHPROGM or any other utility to remove the catalog before adding a new one.&lt;br /&gt;What are the implications of ignoring this warning ? Assume that the existing catalog entry for dataset points to BS3001, which may or may not contain such a dataset. As a result of DD statement DD1 the dataset by the same name has been created and kept on different volume say BS3008 while the catalog entry remains unaltered.&lt;br /&gt;Later, the user, who did not notice the “NOT CATLGD 2” message submits a job containing a DD statement.&lt;br /&gt;//infile     dd  dsn=da0001t.emfile,disp=shr&lt;br /&gt;&lt;br /&gt;The system will search the catalog, retrieves the dataset residing on volume BS3001, with no outward appearance of failure. If the dataset by that name does not exist, the result is S213-04 ABEND failure. &lt;br /&gt;Note that an attempt to add a dulpicate entry in the volume encounters a “DULPCIPATE NAME ON DIRECT ACCESS VOLUME” JCL error.&lt;br /&gt;This problem is not encountered in MVS/ESA, because the system deletes the dataset as well as uncatalog.&lt;br /&gt;&lt;br /&gt;PASS – Indicates that an entry for the dataset (containing dsn, volume and unit information) be placed on a table in storage (Passed Dataset Queue). This entry is to be used in a subsequent step to “receive the passed dataset”. A message will appear “PASSED”. &lt;br /&gt;&lt;br /&gt;The abnormal (or conditional) disposition field : This field is used to tell the systen how to dispose of the dataset when the step terminates abnormally (ABENDs). It is required only if this disposition is different from the normal disposition.&lt;br /&gt;DELETE,KEEP,CATLG, and UNCATLG have the same meaning they do in the normal disposition. Note that PASS is not permitted in the abnormal disposition field.&lt;br /&gt;The best example of using the abnormal disposition field is DISP=(NEW,CATLG,DELETE). If there is ABEND, the dataset is to be deleted. This eliminates future manual intervention to delete and uncatalog the dataset in order to restart.&lt;br /&gt;&lt;br /&gt;Defaults: Some defaults in the DISP parameter are fixed and others variable.&lt;br /&gt;• If the DISP parameter is omitted, the default is always (NEW,DELETE.&lt;br /&gt;//sysut1       dd  unit=sysda,space=(trk,(1,2))&lt;br /&gt;//*     (NEW,DELETE)  IS THE DEFAULT&lt;br /&gt;&lt;br /&gt;• If the status is omitted, the default is always NEW&lt;br /&gt;DISP=(,CATLG)   is same as DISP=(NEW,CATLG)&lt;br /&gt;&lt;br /&gt;• If the normal disposition field is omitted&lt;br /&gt;- If the status field is NEW, the default is DELETE&lt;br /&gt;- If the status field is OLD or SHR and the dataset name non temporary&lt;br /&gt;          If the DD statement is not receiving a passed dataset, the default is      KEEP.&lt;br /&gt;      //dd1     dd dsn=da0001t.empfile,disp=shr&lt;br /&gt;&lt;br /&gt;• If a DD statement is receiving a passed dataset, which was created during the execution of the job and was never given a permanent disposition, the default is DELETE. &lt;br /&gt;&lt;br /&gt;• If a DD statement is receiving a passed dataset, which was created during the execution of the job but was  given permanent disposition since being created, the default is KEEP.  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;• If a DD statement is receiving a passed dataset which existed before the job began execution, the default is KEEP.&lt;br /&gt;&lt;br /&gt;• If the status field is OLD or SHR and the dataset name temporary, the default is pass.&lt;br /&gt;          //dd1     dd dsn=old,dsn=&amp;&amp;temp&lt;br /&gt;          DISP=OLD defaults to DISP=(OLD,PASS) and the message will appear in the   output –“INVALID DISP FIELD – PASS SUBSTITUTED”&lt;br /&gt;&lt;br /&gt;• If the abnormal disposition field is omitted, the default is the normal disposition field.&lt;br /&gt;&lt;br /&gt;The UNIT Parameter &lt;br /&gt;&lt;br /&gt;The UNIT parameter identifies :&lt;br /&gt;The device type or device address where the volume is mounted. The volume is the one where the dataset resides (or will reside if DISP=NEW).&lt;br /&gt;• The number of devices to be allocated to the dataset.&lt;br /&gt;&lt;br /&gt;• When the mount message is to be shown to the operator. &lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;      device address  &lt;br /&gt;UNIT =(  generic device name ,device count   ,DEFER   )  Keyword parameter&lt;br /&gt;       generated device name &lt;br /&gt;&lt;br /&gt;device address – Identifies the exact device address. This notation is almost never used.&lt;br /&gt;&lt;br /&gt;Generic device name – Identifies the device type using a universal system-supplied name.&lt;br /&gt;e.g : UNIT=3390 ; UNIT=3400-5 ; UNIT=3480&lt;br /&gt;&lt;br /&gt;generated device name – Identifies the device type using an installation-defined name.&lt;br /&gt;&lt;br /&gt;UNIT=SYSDA ; UNIT=DISK ; UNIT=TAPE&lt;br /&gt;The generated names can be made to mean whatever an installation wishes them to mean. For example, UNIT=SYSDA can mean all 3380 devices of any density, or single density only, or a subset of double density devices or a combination of 3380 and 3390 device. Their definition can vary from installation to installation. Our GE machine has UNIT=SYSALLDA.&lt;br /&gt;&lt;br /&gt;Of the three, the generated name is far the most commonly used.&lt;br /&gt;&lt;br /&gt;Device count – Specifies the number of devices to be allocated for the dataset. The limit is 59 devices. If omitted default is 1 except when DD statement describes a disk multivolume dataset. In such case, device count=number of volumes. &lt;br /&gt;E.g. 1 UNIT=(SYSDA,5) ; UNIT=(TAPE,2)&lt;br /&gt;&lt;br /&gt;E.g. 2  UNIT=SYSDA is same as UNIT=(SYSDA,1) because of default&lt;br /&gt;&lt;br /&gt;E.g. 3 //dd1     dd  dsn=da0001t.empfile,disp=(,catlg,delete),&lt;br /&gt;          //             unit=sysda,vol=ser=(bs3001,bs3002,bs3003),&lt;br /&gt;          //             space=(trk,(1,2)),dcb=(lrecl=80,recfm=fb,&lt;br /&gt;         //              blksize=800)&lt;br /&gt;&lt;br /&gt;In this example UNIT =SYSDA defaults to UNIT=(SYSDA,3)&lt;br /&gt;&lt;br /&gt;Note : UNIT=(,2) can also be used if the device is being supplied by the catalog. &lt;br /&gt;&lt;br /&gt;DEFER : Requests that the mount message to the operator not be issued by the allocation routines but by the open routines when, and, if the dataset is opened. &lt;br /&gt;Note : DEFER must never be used with disk. Generally, used for tapes.  &lt;br /&gt;There is no default for device name. If it is not coded in the UNIT parameter and it is also not supplied by the catalog, the Passed dataset Queue, the result will be allocation JCL error .  The message is &lt;br /&gt;“IEF210I JOBNAME  STEPNAME DDANAME –UNIT FIELD SPECIFIES INCORRECT DEVICE NAME”, which is misleading. It means that the device name was needed but not coded. &lt;br /&gt;&lt;br /&gt;The VOL Parameter&lt;br /&gt;&lt;br /&gt;The main function of the VOL (or VOLUME) is to identify the volume(s) by serial number where an existing dataset resides or where a new dataset will reside. &lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;  vol    ,SER=(vol1 [,vol2]…….&lt;br /&gt;  Volume     =(  ,REF=referback&lt;br /&gt;    ,REF=dsname &lt;br /&gt;&lt;br /&gt;SER=(vol1,vol2….) – Specifies the serial number(s) of the volume(s) to be used. The maximum number of volumes is 255.&lt;br /&gt;&lt;br /&gt;A volume serial is a combination of alphabetic , numeric, and national characters ($ @ #) up to 6. A hyphen is also permitted. In a real (or production) environment, the number of characters is almost never less than 6. &lt;br /&gt;&lt;br /&gt;e.g  VOL=SER=BS3001 OR VOLUME=SER=BS3001&lt;br /&gt;       VOL=SER=(BS3013,BS3014)&lt;br /&gt;&lt;br /&gt;REF=referback&lt;br /&gt;Referback – This can have three formats :&lt;br /&gt;*.stepname.ddname  - Requests that the volume be the same as for DD statement “ddname” found in the previous step “stepname”. &lt;br /&gt;&lt;br /&gt;VOL=REF=*.STEP2.DD1&lt;br /&gt;&lt;br /&gt;*.ddname  - Requests that the volume be the same as for previous  DD statement “ddname” found in the same step “stepname”. &lt;br /&gt;&lt;br /&gt;VOL=REF=*.DD1&lt;br /&gt;&lt;br /&gt;*.procexec.stepname.ddname  - Requests that the volume be the same as for DD statement “ddname” found in the previous step “stepname” found within a procecure “procexec” (name of  EXEC statement invoking the procedure. &lt;br /&gt;&lt;br /&gt;VOL=REF=*.PR1.STEP2.DD1&lt;br /&gt;&lt;br /&gt;Remark:&lt;br /&gt;Referbacks are not encouraged. They should be used only when they are necessary. A referback with a “stepname” will cause a JCL error if the referenced step does not execute. Such referbacks must be avoided where restart is required. &lt;br /&gt;&lt;br /&gt;REF=dsname – Requests that the volume be the same as the one where dataset “dsname” resides on. The dataset must be cataloged or Passed. The dataset does not even have to exist, as long as it is cataloged or passed. The name of the referenced dataset need not appear anywhere else in the job. &lt;br /&gt;&lt;br /&gt;e.g : VOL=REF=DA0001T.EMPFILE&lt;br /&gt;&lt;br /&gt;Remark:&lt;br /&gt;When VOL=REF (referback or dsname) is used, the system supplies the volume as well as the unit information. Therefore, the UNIT parameter is usually unnecessary. &lt;br /&gt;&lt;br /&gt;The SPACE Parameter&lt;br /&gt;&lt;br /&gt;The SPACE parameter must be included in a DD statement when :&lt;br /&gt;• A new disk dataset is created.&lt;br /&gt;&lt;br /&gt;• An old dataset needs to alter its entitlement to additional space. i.e., Request additional disk space for an old dataset when available space is exausted. &lt;br /&gt;&lt;br /&gt;• An old disk dataset must free up all unused space. &lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;      TRK,&lt;br /&gt;SPACE=( CYL, (prim-alloc [,sec-alloc] [,directory]) [,RLSE])&lt;br /&gt;      Blksize,&lt;br /&gt;TRK – Requests that space be allocated in tracks. &lt;br /&gt;CYL – Requests that space be allocated in cylinders.&lt;br /&gt;Blksize – Specifies the average blocksize of the dataset. The system will translate it to tracks. &lt;br /&gt;Prim-alloc. Primary allocation or primary quantity. It identifies the number of tracks (if TRK is coded) or cylinders (if CYL is coded) or the number of blocks (if blksize is coded) that must be allocated during the allocation process for a new dataset before the step begins execution. The system will allocate the requested space in one extent. If this is not possible (and CONTIG is not coded), two extents will be used, then three and so on up to five extents. If as many as five extents still cannot satisy the request, the result will be a allocation JCL error :&lt;br /&gt;&lt;br /&gt;IEF257I jobname stepname ddname –SPACE REQUESTED NOT   AVAILABLE.&lt;br /&gt;If the request is nonspecific (no VOL=SER or VOL=REF), needing a storage volume, the  JCL error message will be different :&lt;br /&gt;&lt;br /&gt;IEF257I jobname stepname ddname –INSUFFICIENT SPACE ON STORAGE VOLUMES. &lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;The system will always allocate the primary quantity in the least number of extents possible on a single volume. The primary quantity cannot be split over multiple volumes.  The primary allocation cannot be omitted (coding 0 is allowed). It is ignored if the dataset is old. &lt;br /&gt;e.g 1  SPACE=(TRK,3)&lt;br /&gt;e.g 2  SPACE=(CYL,4)&lt;br /&gt;e.g 3  SPACE=(23440,100)&lt;br /&gt;e.g 5 SPACE=(TRK,0)&lt;br /&gt;&lt;br /&gt;sec-alloc  - Secondary allocation or secondary quantity. It identifies the number of tracks (if TRK is coded) or cylinders (if CYL is coded) or the number of blocks (if blksize is coded) that are to be allocated when all available space is exhausted  while writing to a dataset. The system will allocate the secondary quantity in the least number of extents possible, and just like the primary quantity, it can be given in as many as five extents, if necessary. &lt;br /&gt;The system will always supply the specified secondary allocation when one is needed unless one of the two events occurs :&lt;br /&gt;• The allocated volume does not have enough space to satisfy the secondary allocation and no other volumes are allocated. &lt;br /&gt;&lt;br /&gt;• The needed secondary allocation, if granted, will cause the dataset to exceed 16 extents on the volumes and no other volumes are allocated. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If either of these two conditions arises, the result will be a SB37-04 ABEND failure (normally for a sequential dataset). For a PDS, the ABEND, can also be SE37-04. Please note that a PDS is confined to a single volume, ehile a sequential dataset can extend into a maximum of 59 volumes. The 16-extent-per-volume limit for a dataset is system-supplied and cannot be altered. &lt;br /&gt;The secondary allocation is optional. If omitted, defaults to 0. When no secondary allocation is coded and the primary allocation is exhausted, the result is an SD37-04 ABEND failure. &lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;The secondary allocation can be used for new as well as old datasets. The secondary allocation requested when the dataset is created is recorded in the dataset’s  DSCB (VTOC entry). If space is exhausted when the dataset is retrieved as OLD and extended, the system attempts to provide secondary allocation appearing in the DSCB. If ,however, a SPACE parameter is included in the DD statement, the secondary allocation will be based on what is coded in this SPACE parameter rather than what appears in the dataset’s DSCB. &lt;br /&gt;&lt;br /&gt;E.g  1  SPACE=(TRK,(1,2))&lt;br /&gt;E.g  2  SPACE=(CYL,(7,4))&lt;br /&gt;E.g  3  SPACE=(23440,(200,100))&lt;br /&gt;&lt;br /&gt;directory – Specifies the number of directory blocks (256 bytes each) to be assigned to the directory of a PDS.&lt;br /&gt;The directory quantity, if not coded, defaults to zero; therefore, the directory quantity must be specified for a new PDS. If it is, not S013-14 ABEND failure will occur if an attempt is made to add the first member to a PDS. &lt;br /&gt;&lt;br /&gt;Remark : &lt;br /&gt;The directory quantity is taken away from the beginning of the primary allocation if TRK or CYL is coded in the SPACE parameter. When blksize is coded, the system adds the directory blocks to the data blocks and then computes the amount of primary space. &lt;br /&gt;&lt;br /&gt;E.g 1  SPACE=(TRK,(20,5,5))  OR SPACE=(TRK,(20,,5)) if no secondary&lt;br /&gt;E.g 2  SPACE=(CYL,(20,5,5))  OR SPACE=(CYL,(20,,5)) if no secondary&lt;br /&gt;E.g 3  SPACE=(23440,(200,50,5)) OR SPACE=(23440,(200,,5)) if no secondary&lt;br /&gt;&lt;br /&gt;RLSE –Requests that any unused space be freed when the dataset is closed. This works for both new and old datasets, provided they were opened for output. Space will be released on the boundary used in the SPACE parameter. If tracks (or cylinders) were allocated, unused tracks (or cylinders), will be released. &lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;Using RLSE is highly recommended for datasets not intended for future expansions. Temporary datasets are ideal candidates. For datasets that expand in future runs, RLSE can result in a larger number of extents, and, possibly, a premature SB37-04 ABEND failure. RLSE will be ignored if the dataset is opened by another user (or shared by another job) ot the step ABEND’s.&lt;br /&gt;&lt;br /&gt;e.g:  SPACE=(TRK,(5,1),RLSE)&lt;br /&gt;&lt;br /&gt;The LABEL Parameter&lt;br /&gt;&lt;br /&gt;The LABEL parameter can specify :&lt;br /&gt;• The sequence of a tape dataset on a volume.&lt;br /&gt;&lt;br /&gt;• The type of label of the dataset. &lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;LABEL=([seq-no][,type])                keyword parameter&lt;br /&gt;&lt;br /&gt;Seq-no – Identifies the sequence number of the dataset on a tape volume. 1 to 4 digits. If omitted, it defaults to 1. If 0 is coded, it defaults to 1. Maximum : 9999&lt;br /&gt;e.g LABEL=3&lt;br /&gt;&lt;br /&gt;type – Identifies the type of label for the dataset. &lt;br /&gt;There are many types of labels. To name a few, which are important from project perspective.&lt;br /&gt;SL – Indicates IBM standard label. If the subparameter is omitted, SL is the default.&lt;br /&gt;&lt;br /&gt;NL – Indicates no labels are used. NL is not commonly used. Normally, NL is used for a tape coming from or going to another installation which has no SL capabilities.&lt;br /&gt;&lt;br /&gt;BLP – Bypass Label Processing : Indicates that labels will not be recognized and will be treated as ordinary files. BLP is used as a last resort when neither SL nor NL can accomplish what is required. &lt;br /&gt;&lt;br /&gt;Label Verification : When retrieving an SL tape dataset, both the volume serial and the dataset name will be verified. When creating an SL tape dataset with VOL=SER or VOL=REF, only the volume serial will be verified.&lt;br /&gt;&lt;br /&gt;When retrieving an NL tape dataset, neither the volume serial nor dataset name can be verified. However, only an NL tape volume can be mounted. An SL volume will be rejected.&lt;br /&gt;&lt;br /&gt;Defaults : If omitted, the LABEL parameter defaults to (1,SL). There are four ways to supply the same information.&lt;br /&gt;• Omit the LABEL parameter&lt;br /&gt;&lt;br /&gt;• Code LABEL=(,SL) 1 is the default&lt;br /&gt;&lt;br /&gt;• Code LABEL=1 SL is the default&lt;br /&gt;SL&lt;br /&gt;VOL HDR1 HDR2 TM SL DATA SET # 1 TM EOF1 EOF2 TM  TM&lt;br /&gt;NL&lt;br /&gt;NL DATASET #1 TM NL DATASET #2 TM  TM &lt;br /&gt;&lt;br /&gt;TM – Tape Mark&lt;br /&gt;&lt;br /&gt;The DCB Parameter&lt;br /&gt;&lt;br /&gt;The DCB parameter specifies values to be used to complete the Data Control Block (DCB) when a dataset is opened. A DCB is constructed by the language processor (compiler or assembler), based on the appropriate instructions of the language being used, and resides inside the code of the program. The compiler, collects this information and defaults from various parts of the program (For e.g In COBOL, RECORD CONTAINS 80 CHARACTERS; BLOCK CONTAINS 10 RECORDS and so on ) and constructs the DCB. Note that the DCB exists only for non VSAM datasets and is checked by the OPEN routines (for input or output). Certain values must be “hard-coded” in the DCB by the program.  Others can can be left out, giving the user the option of supplying these values via the DCB parameter( as well as other means). &lt;br /&gt;&lt;br /&gt;There are three suppliers of DCB information :&lt;br /&gt;• Values supplied by the program, referred to as hard-coded. When a value is hard-coded, it cannot be changed unless the program is changed.&lt;br /&gt;&lt;br /&gt;• Values coded in the DCB parameter of the DD statement. These values will be ignored if they are already hard-coded. &lt;br /&gt;&lt;br /&gt;• Values from the standard label of the dataset. The values supplied by the label are limited to : BLKSIZE,LRECL, RECFM, DSORG etc. Values from the label will not be used if they are hard-coded inside the program or coded in the DCB parameter. &lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;DCB=([referback] | [model][,subparameter],……  keyword parameter&lt;br /&gt;&lt;br /&gt;Referback – This can have three formats :&lt;br /&gt;*.stepname.ddname  - Requests that the DCB parameter be copied from the DD statement “ddname” found in the previous step “stepname”. &lt;br /&gt;DCB=*.STEP2.DD1&lt;br /&gt;&lt;br /&gt;*.ddname  - Requests that the DCB parameter be copied from a previous  DD statement “ddname” found in the same step “stepname”. &lt;br /&gt;DCB=*.DD1&lt;br /&gt;&lt;br /&gt;*.procexec.stepname.ddname  - Requests that the DCB parameter be copied from DD statement “ddname” found in the previous step “stepname” found within a procecure “procexec” (name of  EXEC statement invoking the procedure. &lt;br /&gt;DCB=*.PR1.STEP2.DD1&lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;The DCB referback copies the DCB parameter as opposed to the DSN and VOL=REF referbacks which acquire the dataset name and the volser respectively, whether or not the DSN and VOL parameters are present in the referenced DD statement. If the DCB referback refers to a DD statement which contains no DCB, nothing is copied and no message appears. &lt;br /&gt;&lt;br /&gt;Model – specifies the name of the dataset which :&lt;br /&gt;• Must be cataloged. If it is not, the result will be a JCL error :                               IEF2121 jobname stepname ddname –DATASET NOT FOUND&lt;br /&gt;&lt;br /&gt;• Must be on disk (Tapes not allowed)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;• Must reside on a volume that is accessible (online)&lt;br /&gt;&lt;br /&gt;This dataset is called a model DSCB. The DCB information from the label of the model is extracted and can be used. &lt;br /&gt;&lt;br /&gt;E.g  1. DCB=DA0001T.EMPFILE&lt;br /&gt;E.g 2. In case you want to override some of the subparameters, the overriding subparameters must follow the DSCB model dataset name.&lt;br /&gt;&lt;br /&gt;DCB=(DA0001T.EMPFILE,LRECL=100,BLKSIZE=800)&lt;br /&gt;&lt;br /&gt;Models, are generally used, during the creations of GDG’s and dummying the PDS.&lt;br /&gt;&lt;br /&gt;Subparameters : There is vast number of subparameters, the great majority of which are seldom or never used. &lt;br /&gt;• BLKSIZE  -Specifies the size of the block (also known as the physical record). For RECFM=FB, the blocksize must be multiple of the logical record length, and it identifies the exact size of the block. For RECFM=VB, the blocksize can be any value up to the limit but atleast 4 bytes larger than the logical record length. For RECFM=U, the blocksize can be any value up to the limit&lt;br /&gt;Remark : There is no default for BLKSIZE. Coding BLKSIZE=0, the system will compute the optimum blocksize based on the device type.&lt;br /&gt;&lt;br /&gt;E.g DCB=BLKSIZE=800&lt;br /&gt;&lt;br /&gt;LRECL – Specifies the size of the logical record. The maximum size is 32,760, and it cannot be larger than blocksize, unless RECFM=VBS is used.&lt;br /&gt;&lt;br /&gt;E.g. DCB=(LRECL=80,BLKSIZE=800)&lt;br /&gt;&lt;br /&gt;RECFM –Specifies the record format. There are several values (or combinations of values) that can be coded.&lt;br /&gt;• F - All blocks and all logical records are fixed in size.&lt;br /&gt;&lt;br /&gt;• V - Blocks as well as logical records are of variable size. The first 4 bytes of each block (and logical record) describes its length.&lt;br /&gt;&lt;br /&gt;• B – One or more logical records reside in each block. B cannot be coded alone. It is used in conjunction with F or V. For example FB or VB.&lt;br /&gt;&lt;br /&gt;• U – Blocks are of variable size. There are no logical records. Mainly used with Load Library. &lt;br /&gt;&lt;br /&gt;• S- For fixed-size records, it indicates that no short blocks are permitted anywhere but the end of the data. For variable-size records, it indicates that a logical record can span more than one block. S cannot be coded alone. It must follow F,V,FB or VB.&lt;br /&gt; &lt;br /&gt;• A – Indicates that the first character of each record is an ANSI control character to be used for printer carriage control. A cannot be coded alone. It must follow F,V,FB,VB or U. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;E.g DCB=(LRECL=80,RECFM=FB,BLKSIZE=800)&lt;br /&gt;&lt;br /&gt;If RECFM is not supplied through any means, U is the default. &lt;br /&gt;&lt;br /&gt;DEN – Identifies the density of the tape. DEN=3(or 4) indicates 1600 (or 6250 ) BPI density. &lt;br /&gt;&lt;br /&gt;BUFNO – Identifies the number of buffers to be allocated in virtual storage by the OPEN routines, which will contain the blocks to be rean in or written out. If omitted, default is 5. The maximum is 255. Coding for BUFNO a number greater than 5 may require that the REGION parameter be increased. &lt;br /&gt;&lt;br /&gt;EROPT – Specifies what action to take if an unrecoverable I/O error occurs while reading or writing a block.&lt;br /&gt;• ABE – Cause an ABEND failure (S001-1).&lt;br /&gt;&lt;br /&gt;• SKP – Skip the block containing the error. &lt;br /&gt;&lt;br /&gt;• ACC – Accept the block containing the error&lt;br /&gt;&lt;br /&gt;The default is ABE&lt;br /&gt;&lt;br /&gt;DSORG – Identifies the organization of the dataset&lt;br /&gt;• PS – Specifies physical sequential organization. Mostly QSAM and sometimes BSAM.&lt;br /&gt;&lt;br /&gt;• PO  -  Specifies partitioned organization (or BPAM)&lt;br /&gt;&lt;br /&gt;• DA- Specifies direct organization (or BDAM)&lt;br /&gt;&lt;br /&gt;• IS – Specifies indexed sequential organization(or ISAM)&lt;br /&gt;&lt;br /&gt;ABEND failures due to inconsistent DCB values :&lt;br /&gt;• S013-20 ABEND when RECFM=FB is used but the BLKSIZE is not an exact multiple of LRECL. Note that SYSOUT is an exception. &lt;br /&gt;&lt;br /&gt;• S013-34 ABEND when RECFM=FB is used and the LRECL is greater than the BLKSIZE. &lt;br /&gt;&lt;br /&gt;• S013-34 ABEND when RECFM=VB is used and the LRECL is greater than the BLKSIZE-4.&lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;If values for BLKSIZE or LRECL are not supplied by any source (hard-coded  or the DCB parameter or DSCB), the result will be an S013-34 ABEND failure.  &lt;br /&gt;&lt;br /&gt;• S001-04 ABEND when BLKSIZE in the DCB parameter is smaller than the actual blocksize and is a multiple of the LRECL in the DSCB of the dataset. &lt;br /&gt;&lt;br /&gt;It is important to understand which of these often-used parameters are normally hard-coded and which are not :&lt;br /&gt;• BLKSIZE - Seldom hard-coded. The BLKSIZE is unrelated to the logic of the program and hard-coding its value would cause unnecessary changes whenever the BLKSIZE is changed.  In COBOL, BLOCK CONTAINS 0 RECORDS must be coded to avoid hard-coding the BLKSIZE. Omitting this clause will cause a default of 1 to be used. The result will be a hard-coded BLKSIZE is equal to LRECL. Many installation standards disallow hard-coding the BLKSIZE for sequential and partitioned datasets.&lt;br /&gt;&lt;br /&gt;• LRECL – Frequently hard-coded. The logic of any ordinary program is dependent on the LRECL and, as a result, the LRECL cannot be changed without changing the logic of the program. Many high-level languages like COBOL always hard-code the LRECL.&lt;br /&gt;&lt;br /&gt;• RECFM – Frequently hard-coded. The logic of any ordinary program is dependent on the RECFM and, as a result, the RECFM cannot be changed without changing the logic of the program. Many high-level languages like COBOL always hard-code the RECFM.&lt;br /&gt;&lt;br /&gt;Instream Data&lt;br /&gt;&lt;br /&gt;The input stream submitted to the system for execution consists of two possible parts :&lt;br /&gt;• JCL  mandatory part of the input stream&lt;br /&gt;&lt;br /&gt;• Data mixed in with JCL in the input stream. This data is known as sysin data or input stream data. It is optional part of the input stream and always has a logical record length of 80. Any records encountered in the input stream which are not JCL statements will be treated as sysin data. &lt;br /&gt;&lt;br /&gt;Sysin data must be preceded by a DD statement such as :&lt;br /&gt;//name       dd  *&lt;br /&gt;  data&lt;br /&gt;  /*&lt;br /&gt;&lt;br /&gt;Sysin data encountered by JES2 or JES3 following a DD * statement will be saved on the SPOOL volume for future use. This is known as input spooling The sysin is delimited (the spooling stops) by :&lt;br /&gt;• A /* (delimiter) statement found.&lt;br /&gt;• A valid JCL statement.&lt;br /&gt;• An end-of-file condition on reading device. &lt;br /&gt;&lt;br /&gt;The asterisk (*) is a positional parameter. The DD * is a special statement which is under complete JES2 or JES3 control. &lt;br /&gt;&lt;br /&gt;SYSIN is a very common ddname used by many vendor-written programs to pass control information to the utility. E.g SORT,IEBGENER,IDCAMS utilities.&lt;br /&gt;&lt;br /&gt;In user writtem programs, if you use COBOL ACCEPT statement. In your run JCL one of the DD statements will be SYSIN dd statement.&lt;br /&gt;//sysin   dd *&lt;br /&gt;1234&lt;br /&gt;/*&lt;br /&gt;&lt;br /&gt;With the above type of DD statement, one complication arises if the sysin data must consist of JCL statement. Because any JCL statement delimits sysin data. To accomplish this, DD DATA instead of DD * must be used.&lt;br /&gt;&lt;br /&gt;//sysut1   dd data&lt;br /&gt;1234&lt;br /&gt;abcd&lt;br /&gt;//dd1    dd dsn=da0001t.empfile,disp=shr&lt;br /&gt;/*&lt;br /&gt;&lt;br /&gt;A /* must be used to delimit a DD DATA statement. A word of caution: Failure to supply a /* will cause serious problems. JCL statements following DD DATA will unintentionally become part of sysin data. However, If you want /* to be part of sysin data, code DLM parameter.&lt;br /&gt;&lt;br /&gt;//sysut1   dd data,dlm=’)(‘&lt;br /&gt;1234&lt;br /&gt;abcd&lt;br /&gt;//dd1    dd dsn=da0001t.empfile,disp=shr&lt;br /&gt;/*&lt;br /&gt;xyz&lt;br /&gt;)(&lt;br /&gt;&lt;br /&gt;The two characters that are coded in the DLM parameter (apostrophes must be used for special characters) will act as a delimiter and /* will be treated as data. Any two characters can be used. However, characters that are likely to appear in the first two positions of any record must be avoided to prevent premature delimiting sysin data.&lt;br /&gt;&lt;br /&gt;DD parameter Function&lt;br /&gt;* For reading data without // or /* in columns 1 and 2.&lt;br /&gt;DATA For reading data with // but not /* in columns 1 and 2 containing JCL or statements.&lt;br /&gt;DLM For reading data with either // or /* in columns 1 and 2.&lt;br /&gt;&lt;br /&gt;* and DATA are positional parameters whereas DLM is a keyword parameter.&lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;If sysin data is not preceded by DD *, the system will generate a statement and place it in front of the sysin data .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;E.g&lt;br /&gt; //da0001ta job la2719,…..&lt;br /&gt;//s1          exec pgm=ass1&lt;br /&gt;//steplib    dd …&lt;br /&gt;1234&lt;br /&gt;//dd1        dd …&lt;br /&gt;&lt;br /&gt;is equivalent to&lt;br /&gt;&lt;br /&gt;//da0001ta job la2719,…..&lt;br /&gt;//s1          exec pgm=ass1&lt;br /&gt;//steplib    dd …&lt;br /&gt;//sysin      dd  *     (generated statement)&lt;br /&gt;1234&lt;br /&gt;//dd1        dd …&lt;br /&gt;&lt;br /&gt;Note : A line with blanks is the most common offender. It is invisible to the user but it will be treated as data by the system This may or may not cause problem. Let us look at the following example.&lt;br /&gt;//da0001ta job la2719,…..&lt;br /&gt;//s1    exec pgm=ass1&lt;br /&gt;&lt;br /&gt;//steplib    dd …&lt;br /&gt;//sysin  dd *   &lt;br /&gt;1234&lt;br /&gt;//dd1  dd …&lt;br /&gt;&lt;br /&gt;The system will interpret the above JCL in the following way :&lt;br /&gt;//da0001ta job la2719,…..&lt;br /&gt;//s1    exec pgm=ass1&lt;br /&gt;//sysin        dd *&lt;br /&gt;   &lt;br /&gt;//steplib    dd …&lt;br /&gt;//sysin  dd *     (generated statement)&lt;br /&gt;1234&lt;br /&gt;//dd1  dd …&lt;br /&gt;&lt;br /&gt;Conclusion : If there are two or more DD statements by the same name in the same step. This is not an error condition. When the program opens for SYSIN the first of the two be used. The other will be allocated and ignored.&lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;Generically, each DD statement must have a unique ddname except in special cases viz concatenation. In JES2, if a step contains identical ddnames, the system allocates devices and space and does disposition processing for both the DD statements. However, the systen directs all references to the first DD statement with that name in the step. In JES3, if a step contains identical ddnames, the job ABEND’S during allocation. &lt;br /&gt;&lt;br /&gt;The SYSOUT Parameter&lt;br /&gt;&lt;br /&gt;Print records generated by a program are not normally routed directly to a physical printer(theoretically it is possible, but in practice it is seldom done). Instead, they are written on the SPOOL pack and saved there for later viewing on a terminal or printing (or both). This is called output spooling, and is under the control of JES2 or JES3 which later can use one of their print routines to print the dataset. These print routines must schedule the datasets for printing, and msgclasses are used for this purpose. All print routines (called printers or writers) are associated with one or more classes (in all 36 classes) and each dataset to printed must also be assigned classes. The printer routines selects datasets for printing in a very similar way as initiators selects jobs for executions.  Use S.ST option of ISPF menu to view the output dataset.&lt;br /&gt;&lt;br /&gt;The SYSOUT parameter can assign this class, known as sysout or output class, to a dataset. Such datasets are called sysout or  output datsets.&lt;br /&gt;&lt;br /&gt;General Syntax&lt;br /&gt;&lt;br /&gt;SYSOUT=(class| *)            keyword parameter&lt;br /&gt;&lt;br /&gt;Class – Identifies the sysout class of the dataset from A to Z and 0 to 9.&lt;br /&gt; *- Indicates that the same class used in the MSGCLASS parameter of the JOB statement (or the installation-defined default, if MSGCLASS parameter is omitted) is to be used. &lt;br /&gt;E.g 1. sysout=a  &lt;br /&gt;E.g 2 //sysprint   dd sysout=*&lt;br /&gt;&lt;br /&gt;This DD statement is used for printing system messages generated by JES2 or JES3. Each step must have SYSPRINT DD  statement. Absence will cause “ SYSPRINT DD STATEMENT MISSING” message in the sysout.&lt;br /&gt;&lt;br /&gt;E.g 3 //sysout dd sysout=*  (or any sysout class may be assigned)&lt;br /&gt;This DD statement is used when you have COBOL DISPLAY clause in your program. &lt;br /&gt;&lt;br /&gt;Concatenation&lt;br /&gt;&lt;br /&gt;Concatenating Datasets&lt;br /&gt;&lt;br /&gt;At times, program may have to read in sequence several input datasets as if they were one. This can accomplished without physically putting the data in one datasets. This is done by concatenating the datasets in JCL code with comparable DCB characteristics without programming changes. &lt;br /&gt;&lt;br /&gt;Note that only sequential and partitioned datasets can be concatenated. For sequential datasets, the maximum number of concatenations is 255 and for PDS it is 16. Concatenation has meaning only for sequential processing.&lt;br /&gt;&lt;br /&gt;E.g 1. Concatenation of physical sequential files.&lt;br /&gt;&lt;br /&gt;//dd1     dd  dsn=da0001t.pcs.group1,disp=shr&lt;br /&gt;//           dd  dsn=da0001t.pcs.group2,disp=shr&lt;br /&gt;//           dd  dsn=da0001t.pcs.group3,disp=shr&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;E.g 2. Concatenation of partitioned datasets.&lt;br /&gt;&lt;br /&gt;//dd1     dd  dsn=da0001t.pds1.group1,disp=shr&lt;br /&gt;//           dd  dsn=da0001t.pds2.group2,disp=shr&lt;br /&gt;//           dd  dsn=da0001t.pds3.group3,disp=shr&lt;br /&gt;&lt;br /&gt;There are number of rules and restrictions for concatenations :&lt;br /&gt;1. The first concatenation is the only one with a ddname.&lt;br /&gt;2. The logical record length and the record format of concatenated datasets must be the same. However, the blocksizes need not be.&lt;br /&gt;3. The blocksize of the first concatenation must be greater than or equal to blocksizes of all subsequent concatenation. Violation of this rule results in S001-04 ABEND failure. This is true for DFP Version 2.3. For version DFP 2.4, one can concatenate datasets in any sequence, but for the first concatenation code the DCB parameter with the largest blocksize of all the concatenations. &lt;br /&gt;&lt;br /&gt;E.g. Assume that in the JCL below, the first concatenation has a blocsize of 800, the second a blocksize of 800- and the third a blocksize of 23400.&lt;br /&gt;//infile     dd  dsn=da0001t.pcs.group1,disp=shr,dcb=23400&lt;br /&gt;//             dd  dsn=da0001t.pcs.group2,disp=shr&lt;br /&gt;//             dd  dsn=da0001t.pcs.group3,disp=shr&lt;br /&gt;&lt;br /&gt;4. Both sequential datasets and partitioned datasets can be concatenated, but not with each other – sequential with sequential and partitioned with partitioned only. Member of a PDS is treated as sequential dataset and thus can be concatenated with sequential dataset. &lt;br /&gt;E.g &lt;br /&gt;//in           dd  dsn=da0001t.empfile,disp=shr&lt;br /&gt;//               dd  dsn=da0001t.pcs.data(emp),disp=shr&lt;br /&gt;&lt;br /&gt;5. Disk as well as tape datasets can be concatenated but not with each other. Only like devices should be concatenated, disk with disk and tape with tape.&lt;br /&gt;&lt;br /&gt;DUMMY Parameter&lt;br /&gt;&lt;br /&gt;The DUMMY parameter is a positional parameter. At times, one might want to execute a program but suppress read or write operations in certain jobs, For example., not print a report. At other times, one might want to test a program without actually processing data.&lt;br /&gt;&lt;br /&gt;The DUMMY parameter specifies that :&lt;br /&gt;• No device or external storage be allocated.&lt;br /&gt;&lt;br /&gt;• No disposition processing is performed.&lt;br /&gt;&lt;br /&gt;• No input or output operations are performed for sequential access methods.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;1 DCB information is established. Generally used during testing process and in procedures.  Instead of using DUMMY, one may use DSN=NULLFILE. It differs from DUMMY by virtue of its position. It is a keyword parameter.&lt;br /&gt;      E.g    //DD1      DD  DSN=NULLFILE &lt;br /&gt;&lt;br /&gt;2 When an attempt to dummy a PDS is made will cause an S013-64 ABEND failure.&lt;br /&gt;&lt;br /&gt;3 The DCB parameter may be required while coding DUMMY. Failure to do so may cause an S013-10 ABEND failure.&lt;br /&gt;&lt;br /&gt;4 DUMMY provides a safe way to eliminate I/O activity when required. &lt;br /&gt;&lt;br /&gt;The JOBLIB DD Statement&lt;br /&gt;&lt;br /&gt;The JOBLIB statement identifies the program library (load library) where the programs to be executed throughout the job resides. It must be placed between the JOB and the first EXEC statement. &lt;br /&gt;E.g :&lt;br /&gt;//da0001ta    job,la2719,……&lt;br /&gt;//joblib          dd dsn=da0001t.lib.loadlib,disp=shr&lt;br /&gt;//s1              exec  pgm=proga&lt;br /&gt;//s2              exec  pgm=progb&lt;br /&gt;&lt;br /&gt;Expanation : PROGA (and PROGB) is expected to reside in DA0001T.LIB.LOADLIB as a member of a library and the system searches the directory. If not found will search certain predefined libraries and the S806-04 ABEND failure occurs. &lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;A JOBLIB DD statement can have several concatenations (max: 16) &lt;br /&gt;E.g&lt;br /&gt;//da0001ta  job,la2719,……&lt;br /&gt;//joblib        dd dsn=da0001t.lib.loadlib,disp=shr&lt;br /&gt;//                     dd  dsn=da0001t.lib1.loadlib,disp=shr&lt;br /&gt;//                     dd dsn=da0001t.prod.loadlib,disp=shr &lt;br /&gt;//s1                 exec  pgm=proga&lt;br /&gt;&lt;br /&gt;Explanation : All concatenations may be searched to locate a program. If, however, the program is found in a concatenation other than the last one, other concatenations will not be used. Note that, if a duplicate names exist in different concatenations, the user can decide which one is to be executed by determining the sequence of the concatenations. &lt;br /&gt;&lt;br /&gt;The STEPLIB STATEMENT&lt;br /&gt;&lt;br /&gt;The STEPLIB statement identifies the program library (load library) where the program to be executed for the step where STEPLIB resides. It can be placed anywhere after the EXEC statement.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;E.g 1:&lt;br /&gt;//da0001ta    job,la2719,……&lt;br /&gt;//s1                   exec  pgm=proga&lt;br /&gt;//steplib        dd dsn=da0001t.lib.loadlib,disp=shr&lt;br /&gt;//s2                   exec  pgm=progb&lt;br /&gt;//steplib        dd dsn=da0001t.lib.loadlib1,disp=shr&lt;br /&gt;&lt;br /&gt;Explanation : Program PROGA is expected to reside in DA0001TA.LIB.LOADLIB as a member of the library. If not found, will search certain predefined libraries and the S806-04 ABEND failure occurs. &lt;br /&gt;&lt;br /&gt;E.g 2:&lt;br /&gt;//da0001ta    job,la2719,……&lt;br /&gt;//joblib          dd dsn=da0001t.lib.loadlib1,disp=shr&lt;br /&gt;//s1                   exec  pgm=proga&lt;br /&gt;//s2                   exec  pgm=progb&lt;br /&gt;//steplib        dd dsn=da0001t.lib.loadlib,disp=shr&lt;br /&gt;//s3                   exec  pgm=progc&lt;br /&gt;&lt;br /&gt;A STEPLIB DD statement has the effect of negating the JOBLIB DD statement for a particular step. &lt;br /&gt;&lt;br /&gt;STORAGE DUMP&lt;br /&gt;&lt;br /&gt;When a step encounters an ABEND failure, it is often advantageous to request a virtual storage dump, which can then be helpful in determining the cause of an ABEND. To request a storage dump, one of the following three DD statements must be included in the step :&lt;br /&gt;• A SYSUDUMP DD statement&lt;br /&gt;&lt;br /&gt;• A SYSMDUMP DD statement&lt;br /&gt;&lt;br /&gt;• A SYSABEND DD statement&lt;br /&gt;&lt;br /&gt;//sysudump   dd sysout=*&lt;br /&gt;&lt;br /&gt;All virtual storage allocated to your program i.e user region of job’s address space. It is a formatted dump. SYSUDUMP usually writes to sysout. It can, however, write to a disk dataset, providing a way to preserve the SYSUDUMP information for later viewing and analysis.&lt;br /&gt;&lt;br /&gt;//sysudump dd dsn=da0001t.dumpfile,space=(trk,(0,5),rlse),&lt;br /&gt;//        disp=(,delete,catlg),unit=sysda&lt;br /&gt;&lt;br /&gt;No DCB is required. &lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;SYSUDUMP DD statement is more often used.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//sysmudump   dd sysout=*&lt;br /&gt;&lt;br /&gt;This is same as SYSUDUMP DD statement except for the fact that the dump is nonformatted. This type of dump is very difficult to analyze unless it is saved on a disk and then processed by the PRDUMP service aid. &lt;br /&gt;SYSMDUMP is seldom used. &lt;br /&gt;&lt;br /&gt;//sysabend   dd sysout=*&lt;br /&gt;&lt;br /&gt;When a SYSUDUMP   DD statement is included in a step which ABEND’s, a formatted virtual storage dump will be provided. This dump will also include information about the failed step, as well as most of the MVS storage-resident information which is of no use to the average user. SYSABEND is intended for system programmer. &lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;1 If neither a SYSUDUMP nor a SYSMDUMP nor a SYSABEND statement is coded wihin a JCL of an ABENDing step, a small amount of information is provided. This information is seldom useful in resolving the problem that caused the ABEND failure.&lt;br /&gt;&lt;br /&gt;2 If more than one of the above statements is included in the JCL of a step, only the last one will be used. The previous ones will be ignored.                     &lt;br /&gt;&lt;br /&gt;//s1                exec pgm=ass1&lt;br /&gt;//sysabend    dd sysout=*&lt;br /&gt;//sysudump   dd sysout=*           &lt;br /&gt;&lt;br /&gt;       Note that SYSUDUMP will be in use.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/03/jcl.html"&gt;Back to JCL Index&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com"&gt;Back to home page&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-8971837861639345811?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/T4_gfj_K3Ae9o1e4WfZ1OSrPjXE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/T4_gfj_K3Ae9o1e4WfZ1OSrPjXE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/T4_gfj_K3Ae9o1e4WfZ1OSrPjXE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/T4_gfj_K3Ae9o1e4WfZ1OSrPjXE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/s2jxJX_hKFY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/8971837861639345811/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=8971837861639345811" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/8971837861639345811?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/8971837861639345811?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/s2jxJX_hKFY/4-dd-statement.html" title="4. The DD statement" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/03/4-dd-statement.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQASHY6fSp7ImA9WxBbEEs.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-5450308079229054158</id><published>2010-03-08T07:05:00.000-08:00</published><updated>2010-03-08T08:05:49.815-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-08T08:05:49.815-08:00</app:edited><title>5. PROCEDURE</title><content type="html">• There are two types of procedures :&lt;br /&gt;- Catalogue Procedures&lt;br /&gt;- InStream Procedures&lt;br /&gt;&lt;br /&gt;• CATALOGUED PROCEDURE is a member of a PDS which is often refered to as procedure library or PROCLIB.&lt;br /&gt;&lt;br /&gt;• INSTREAM PROCEDURES contained within job's input stream.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;INVOKING A PROCEDURE&lt;br /&gt;&lt;br /&gt;//PR EXEC ABC&lt;br /&gt; OR&lt;br /&gt;//PR EXEC PROC = ABC&lt;br /&gt;&lt;br /&gt;RESTRICTIONS&lt;br /&gt;&lt;br /&gt;- max 255 steps&lt;br /&gt;&lt;br /&gt;• The following are not permitted to reside in a procedure :&lt;br /&gt;- JOB Statement&lt;br /&gt;- An EXEC statement invoking a procedure&lt;br /&gt;- JOBLIB&lt;br /&gt;- JOBCAT&lt;br /&gt;- DD * or DATA&lt;br /&gt;- // null statement&lt;br /&gt;- A PEND statement&lt;br /&gt;&lt;br /&gt;Common Rules for EXEC &amp; DD Statement to Override for JCL Procedures&lt;br /&gt;&lt;br /&gt;• A parameter can be replaced, added or nullified&lt;br /&gt;&lt;br /&gt;• When replacing an existing parameter, the overriding parameter must be specified in its complete format.  DCB is an exception&lt;br /&gt;&lt;br /&gt;• An overriding parameter replaces the same parameter, if it exists.  It is added to the statement if it does not exist.&lt;br /&gt;&lt;br /&gt;• A syntactical JCL error inside a procedure cannot be corrected by overriding the erroneous parameter.&lt;br /&gt;&lt;br /&gt;• To nullify an existing parameter "parameter" = must be coded&lt;br /&gt;&lt;br /&gt;• To override any parameters in an concatenation other than the first one, the following must be coded :&lt;br /&gt;&lt;br /&gt;//stepname.ddname DD&lt;br /&gt;//          DD&lt;br /&gt;//           .&lt;br /&gt;//           .&lt;br /&gt;//         DD overriding parameters&lt;br /&gt;&lt;br /&gt;• To add an entire DD statement &lt;br /&gt;// stepname.ddname DD complete parameter field.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;RULES FOR EXEC STATEMENT OVERRIDING     &lt;br /&gt;&lt;br /&gt;• To override any parameter in a DD statement an independent DD statement must be supplied in the following format :&lt;br /&gt;&lt;br /&gt;• The sequence of overriding DD statements must be the same as the sequence of the corresponding overridden statements.  However, parameters within a DD statement need not be overridden in sequence.&lt;br /&gt;&lt;br /&gt;• An additional DD statement must be the last one in a step's overriding statements.&lt;br /&gt;&lt;br /&gt;• To override an EXEC parameter, " parameter.stepname=value" must be coded when adding or replacing a parameter and "parameter.stepname=" must be coded when nullifying a parameter.&lt;br /&gt;&lt;br /&gt;• The PGM parameter cannot be overridden&lt;br /&gt;&lt;br /&gt;• All overriding EXEC parameters must be coded in the EXEC statement that invokes the procedure.&lt;br /&gt;&lt;br /&gt;• All overrides to EXEC parameters must be completed before overriding parameters in a subsequent step.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;procedure lam&lt;br /&gt;&lt;br /&gt;//S1  EXEC PGM=ED, PARM=(A,B,C,E)&lt;br /&gt;//  REGION=900K, TIME = (5,30)&lt;br /&gt;//STEPLIB DD DSN=DEV.LOADLIB,DISP=SHR&lt;br /&gt;//IN1  DD DSN=USER1.FILE2,DISP=SHR&lt;br /&gt;//IN2  DD DSN=USER1.FILEX,DISP=OLD&lt;br /&gt;//  UNIT=TAPE, VOL=SER=000101&lt;br /&gt;//REP  DD SYSOUT =*,&lt;br /&gt;//OUT  DD DSN=USER1.PLA,DISP=(,CTLG,DELETE),&lt;br /&gt;//   UNIT=SYSDA, VOL=SER=BS3003&lt;br /&gt;//   SPACE=(CYL,(20.5),DCB=(BLKSIZE=4000,&lt;br /&gt;//   LRECL=80, RECFM=FB)&lt;br /&gt;&lt;br /&gt;Required in step S1:&lt;br /&gt;&lt;br /&gt;a) PARM must be (A,B,C,D) and TIME nullified&lt;br /&gt;b) In IN1, DSN must be USER1.FILE3&lt;br /&gt;c) IN2 must retrieve USER1.FILEX as a cataloged dataser&lt;br /&gt;d) In OUT, BLKSIZE must be 23440&lt;br /&gt;&lt;br /&gt;//S2  EXEC PGM=FORM, REGION=900K&lt;br /&gt;//INA  DD DSN=USER1.PLA,DISP=SHR   &lt;br /&gt;//  DD DSN=USER1.F226,DISP=SHR&lt;br /&gt;//  DD  DSN=USER1.F232,DISP=SHR&lt;br /&gt;//  DD  DSN=USER1.F118,DISP=SHR&lt;br /&gt;//OUTA     DD DSN=USER.F323,DISP=(,CATLG,DELETE),&lt;br /&gt;//  UNIT=TAPE, VOL=SER=001110&lt;br /&gt;//  DCB=BLKSIZE=32700, LRECL=100,       &lt;br /&gt;//   RECFM=FB)&lt;br /&gt;//PRNT DD SYSOUT=*&lt;br /&gt;&lt;br /&gt;Required in Step S2 :&lt;br /&gt;&lt;br /&gt;a) COND = (0,LT) must be coded &lt;br /&gt;b) In INA DSN in the third concatenation must be USER1.F228&lt;br /&gt;c) In DD statement OUTA, UNIT be SYSDA&lt;br /&gt;d) An entire DD statement :&lt;br /&gt;//STEPLIB DD DSN=DEV.LOADLIB,DISP=SHR&lt;br /&gt;must be coded.&lt;br /&gt;&lt;br /&gt;//S3  EXEC PGM=REPO,REGION = 400K, COND=(O,LT)&lt;br /&gt;//1N3  DD DSN=USER1.F333, DISP=OLD&lt;br /&gt;//OUT3 DD DSN=USER1.F111,DISP=(,CRLG,DELETE),&lt;br /&gt;//  UNIT=SYSDA, VOL=SER=DEVO12,&lt;br /&gt;//  SPACE=(CYL,(50,15),RLSE),&lt;br /&gt;//  DC3=(BLKSIZE=23440,LRECL=80,RECFM=FB)&lt;br /&gt;//PRINT DD SYSOUT =*&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Required in Step S3 :&lt;br /&gt;&lt;br /&gt;a) EVEN must be added to the COND parameter&lt;br /&gt;b) In DD statement OUT3, RLSE must be removed from the SPACE parameter must be nullified.&lt;br /&gt;&lt;br /&gt;SOME TYPICAL EXAMPLES &lt;br /&gt;&lt;br /&gt;Example 1:&lt;br /&gt;&lt;br /&gt;//S1  EXEC PGM=ONE&lt;br /&gt;//OUT1  DD DSN=U1.S1,&lt;br /&gt;//   DISP=(,CTLG, DELETE),&lt;br /&gt;//   UNIT=TAPE&lt;br /&gt;//   DCB=(BLKSIZE=32700)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Required &lt;br /&gt;OUT1 must be dummied&lt;br /&gt;&lt;br /&gt;Override&lt;br /&gt;//S.OUT1 DD DUMMY&lt;br /&gt;&lt;br /&gt;Regardless of the contents, no other parameters are needed.&lt;br /&gt;&lt;br /&gt;SOME TYPICAL EXAMPLES&lt;br /&gt;&lt;br /&gt;Example 2 :&lt;br /&gt;&lt;br /&gt;//S1  EXEC PGM=ONE&lt;br /&gt;//IN1  DD DSN=U1.B1,DISP=SHR&lt;br /&gt;//  DD DSN=U2.B2,DISP=SHR&lt;br /&gt;//  DD DSN=U3.B3,DISP=SHR&lt;br /&gt;&lt;br /&gt;Required&lt;br /&gt;Second concatenation of INI must be dummy&lt;br /&gt;&lt;br /&gt;Override&lt;br /&gt;//S1.INI DD&lt;br /&gt;  DD DSN=U1.B3&lt;br /&gt;  DD DUMMY&lt;br /&gt;&lt;br /&gt;Example 3:&lt;br /&gt;&lt;br /&gt;//S1  EXEC PGM=ONE&lt;br /&gt;//CNTL  DD DSN=U1.CNTLIB(S1), DISP=SHR&lt;br /&gt;&lt;br /&gt;Required &lt;br /&gt;DD statement CNTL must be //CNTL DD*&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Override &lt;br /&gt;//S1.CNTL  DD*&lt;br /&gt;&lt;br /&gt;Regardless of the contents DD * will override all.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Example 4 :&lt;br /&gt;&lt;br /&gt;//S1  EXEC PGM = ONE&lt;br /&gt;//OVT4 DD DSN=U1.D1,DISP=NEW&lt;br /&gt;//   DISP=SYSDA,VOL=SER=TEST26,&lt;br /&gt;//   SPACE=CTRK,(500,50)),&lt;br /&gt;//   DCB=(BLKSIZE=23400,&lt;br /&gt;//   LRECL=100,RECFM=FB)&lt;br /&gt;&lt;br /&gt;Required &lt;br /&gt;DCB parameter must be eliminated&lt;br /&gt;&lt;br /&gt;Override&lt;br /&gt;//S1.OUT4 DD DCB=(BLKSIZE=LRECL=RECFM)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SYMBOLIC PARAMETERS &amp; SYMBOLIC OVERRIDES&lt;br /&gt;&lt;br /&gt;• Symbolic overrides can be used only when symbolic parameters have been coded inside the procedure&lt;br /&gt;&lt;br /&gt;• A symbolic parameter is a name preceded by an ampersand (&amp;)&lt;br /&gt;&lt;br /&gt;• A symbolic parameter can be coded in place of any parameter, part of a parameter in the parameter field of an EXEC, DD or OUTPUT statement.&lt;br /&gt;&lt;br /&gt;SYMBOLIC PARAMETER&lt;br /&gt;&lt;br /&gt;Example 1 :&lt;br /&gt;&lt;br /&gt;//S1 EXEC PGM=BL&lt;br /&gt;//IN DD DSN=&amp;H1..INFILE,DISP=SHR&lt;br /&gt;//OUT DD DSN=&amp;HQ..OUTFILE,DISP=,CATLG,DELETE),&lt;br /&gt;//  UNIT=SYSDA, DCB=(BLKSIZE=32700)&lt;br /&gt;&lt;br /&gt;//PSK EXEC BLTX,HQ=PROD&lt;br /&gt;&lt;br /&gt;- First period works as delimiter&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Example 2 :&lt;br /&gt;&lt;br /&gt;Procedure BLTX&lt;br /&gt;&lt;br /&gt;//S1 EXEC  PGM=BL&lt;br /&gt;//IN DD DSN=&amp;HQ…INFILE,DISP=SHR&lt;br /&gt;//OUT DD DSN=&amp;HQ…OUTFILE,DISP=,CATLG,DELETE&lt;br /&gt;//  UNIT=SYSDA,DCB(=BLKSIZE=32700)&lt;br /&gt;&lt;br /&gt;//PSK EXEC BLTX,HQ='PROD.'&lt;br /&gt;&lt;br /&gt;SYMBOLIC OVERRIDING&lt;br /&gt;&lt;br /&gt;RULES FOR SYMBOLIC OVERRIDING&lt;br /&gt;&lt;br /&gt;• An EXEC statement keyword (TIME, REGION etc.) cannot be used as a symbolic parameter.&lt;br /&gt;&lt;br /&gt;• A symbolic override in either the EXEC or PROC statement that has no corresponding parameter in the procedure will result in a 'SYMBOL NOT DEFINED' JCL  error.&lt;br /&gt;&lt;br /&gt;• If a symbolic and a regular override conflict, the regular override always prevails.&lt;br /&gt;&lt;br /&gt;• A symbolic parameter which is immediately followed by an alphabetic, numeric or national character must have a period at its end.&lt;br /&gt;&lt;br /&gt;• A symbolic parameter can be coded many times in a procedure.  When substitution occurs, all the occurrences will receive the same value.&lt;br /&gt;&lt;br /&gt;• When nothing must be substituted for a symbolic parameter, "symbolic-override=' must be coded in the EXEC or PROC statement.&lt;br /&gt;&lt;br /&gt;PROCEDURE SSP&lt;br /&gt;&lt;br /&gt;//S1 EXEC PGM = P1, PARM = &amp;PEL&lt;br /&gt;&lt;br /&gt;Assume possible values that the PARM parameter can assume are ALD, BLD, CLD, etc. &lt;br /&gt;&lt;br /&gt;//S1 EXEC PGM=P1, PARM = &amp;PELLD&lt;br /&gt;&lt;br /&gt;This will not work&lt;br /&gt;Procedure SSP can be coded as &lt;br /&gt;&lt;br /&gt;//S1 EXEC PGM=P1, PARM = PEL.LD&lt;br /&gt;&lt;br /&gt;Now if the procedure is invoked &lt;br /&gt;&lt;br /&gt;//A EXEC SSP, PEL=F&lt;br /&gt;&lt;br /&gt;Substitution results in &lt;br /&gt;&lt;br /&gt;//S1 EXEC PGM=P1, PARM = FLD&lt;br /&gt;&lt;br /&gt;//S1 EXEC PGM = P1, PARM = &amp;PEL&lt;br /&gt;&lt;br /&gt;Example 1 :&lt;br /&gt;&lt;br /&gt;//A EXEC SSP, PEL=FLD&lt;br /&gt;&lt;br /&gt; Substitution results in &lt;br /&gt;&lt;br /&gt;//S1 EXEC PGM=P1, PARM=FLD&lt;br /&gt;&lt;br /&gt;Example 2 :&lt;br /&gt;&lt;br /&gt;//B EXEC SSP, PEL = FLD, TIME = (5, 10)&lt;br /&gt;&lt;br /&gt; substitution results in &lt;br /&gt;&lt;br /&gt;//S1 EXEC PGM = P1, PARM=FLD, TIME = (5,10)&lt;br /&gt;&lt;br /&gt;PROCEDURE SWP&lt;br /&gt;&lt;br /&gt;//ABC  PROCR=800K, Q=AUX, U=TAPE&lt;br /&gt;//S1 EXEC PGM=P2, REGION=&amp;R&lt;br /&gt;//IN DD DSN=&amp;Q..FILEX, DISP=SHR&lt;br /&gt;//OUT DD DSN=&amp;Q..FILEY, DISP=(,CATLG)&lt;br /&gt;//  UNIT = &amp;U&lt;br /&gt;&lt;br /&gt;//A EXEC SWP, Q=MAX&lt;br /&gt;&lt;br /&gt;Substitution results in&lt;br /&gt;&lt;br /&gt;//S1 EXEC PGM=P2, REGION=800K&lt;br /&gt;//IN DD DSN=MAX.FILEX, DISP=SHR&lt;br /&gt;//OUT  DD DSN=MAX.FILEY, DISP=(,CATLG),&lt;br /&gt;//  UNIT =TAPE&lt;br /&gt;&lt;br /&gt;THE PROC STATEMENT&lt;br /&gt;&lt;br /&gt;• The purpose of the PROC statement is to contain symbolic override defaults.&lt;br /&gt;&lt;br /&gt;• When a procedure is executed, the system will substitute symbolic parameters using symbolic overrides coded in the EXEC statement.&lt;br /&gt;&lt;br /&gt;• For those symbolic overrides not found in the EXEC statement, the default symbolic overrides in the PROC statement will be used.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;IN-STREAM PROCEDURES&lt;br /&gt;&lt;br /&gt;• An in-stream procedures is a part of a job's input stream and exists only for the duration of the job.&lt;br /&gt;&lt;br /&gt;• The PROC statement in an in-stream procedure is mandatory and serves two functions -&lt;br /&gt;a) It signals the beginning of in-stream procedure&lt;br /&gt;b) It contains default symbolic overrides.&lt;br /&gt;&lt;br /&gt;• The PEND statement must be coded in an in-stream procedure to provide a delimiter&lt;br /&gt;&lt;br /&gt;Remark :&lt;br /&gt;1) A PROC statement in a catalogued procedure is optional.  The only reason it is required is to contain default symbolic overrides.&lt;br /&gt;&lt;br /&gt;Example :&lt;br /&gt;&lt;br /&gt;//da0001ta JOB  la2719,pcs,msgclass=A,&lt;br /&gt;//  msglevel=(1,1,),notify=da0001t&lt;br /&gt;//* Instream prosedure&lt;br /&gt;//procbr14 proc&lt;br /&gt;//s1  exec pgm=iefbr14&lt;br /&gt;//sysprint dd sysout=*&lt;br /&gt;//dd1  dd dsn=da0001t.temp,&lt;br /&gt;//    disp=(old,delete)&lt;br /&gt;//  pend&lt;br /&gt;//*&lt;br /&gt;//step1  exec proc=procbr14&lt;br /&gt;//s1.dd1 dd dsn=da0001t.temp1,&lt;br /&gt;//  disp=(,catlg,delete), unit=sysda,&lt;br /&gt;//  space=(trk,(2,1)),&lt;br /&gt;//  dcb=(1recl=80,recfm=fb,blksize=800)&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/03/jcl.html"&gt;Back to JCL Index&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com"&gt;Back to home page&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-5450308079229054158?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Og4j1xM8EzdYnyG1uj_Pb2cfJbg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Og4j1xM8EzdYnyG1uj_Pb2cfJbg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Og4j1xM8EzdYnyG1uj_Pb2cfJbg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Og4j1xM8EzdYnyG1uj_Pb2cfJbg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/Wf42OaXLQro" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/5450308079229054158/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=5450308079229054158" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/5450308079229054158?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/5450308079229054158?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/Wf42OaXLQro/5-procedure.html" title="5. PROCEDURE" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/03/5-procedure.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQCQX0-fip7ImA9WxBbEEs.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-2264591582894249853</id><published>2010-03-08T07:02:00.000-08:00</published><updated>2010-03-08T08:06:00.356-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-08T08:06:00.356-08:00</app:edited><title>6. UTILITY</title><content type="html">IEFBR14 UTILITY&lt;br /&gt;&lt;br /&gt;This Utility is commonly used to delete, allocate and to uncatalog dataset&lt;br /&gt;&lt;br /&gt;Example 1 :&lt;br /&gt;&lt;br /&gt;//DELETE  EXEC PGM=IEFBR14&lt;br /&gt;//* TO DELETE A FILE&lt;br /&gt;//DD1  DD DSN=DA0001T.EMPLOYEE,&lt;br /&gt;//   DISP=(MOD,DELETE,DELETE),&lt;br /&gt;//   UNIT=SYSDA, SPACE=(TRK,0)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Example 2 &lt;br /&gt;&lt;br /&gt;//CREATE  EXEC PGM=IEFBR14&lt;br /&gt;//*TO ALLOCATE A NEW FILE&lt;br /&gt;//DD1   DD DSN=DA0001T.EMPLOYEE,&lt;br /&gt;//   DISP=(NEW,CATLG,DELETE),&lt;br /&gt;//   UNIT=SYSDA,&lt;br /&gt;//   SPACE=(TRK,(2,1)),&lt;br /&gt;//   DCB=(BLKSIZE=800,LRECL=80,&lt;br /&gt;//   RECFM=FB,DSORG=PS)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;An excerpt of a code illustrating, the deletion of a dataset, before COBRUN1 step is executed. &lt;br /&gt;&lt;br /&gt;//DA000ITA JOB LA2719,PCS,NOTIFY=DA0001T,&lt;br /&gt;//   MSGCLASS=X, MSGLEVEL=(1,0)&lt;br /&gt;//DELETE EXEC PGM=IEFBR14&lt;br /&gt;//LOGFILE DD DSN=DA0001T.MYFILE2,&lt;br /&gt;//   SPACE=(TRK, (0),),UNIT=SYSDA&lt;br /&gt;//COBRUN1  EXEC PGM=PROG2V1,PARM='AAAA'&lt;br /&gt;//STEPLIB DD DSN=DA00021T,PVDB2.LOADLIB,&lt;br /&gt;//   DISP=SHR&lt;br /&gt;//INFILE DD DSN=DA00021T, EMPLOYEE&lt;br /&gt;   DISP=OLD&lt;br /&gt;//OUTFILE DD DSN=DA00021T.MYFILE2,&lt;br /&gt;//   DISP=(NEW,CATLG,DELETE),&lt;br /&gt;//   DCB=(LRECL=80, DSORG=PS,&lt;br /&gt;//   BLKSIZE=80, RECFM=FB),&lt;br /&gt;//   VOL=SER=BS3011,&lt;br /&gt;//   SPACE=(TRK, (45,15))&lt;br /&gt;//SYSOUT DD SYSOUT=*&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;IEBGENER UTILITY&lt;br /&gt;&lt;br /&gt;• This utility is commonly used to copy, concatenate and to empty sequential datasets&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;*  USING THE IEBGENER UTILITY TO COPY DATASETS &lt;br /&gt;*  SYSSUTI PROVIDING THE INPUT AND SYSUT2 BEING &lt;br /&gt;*  THE OUTPUT&lt;br /&gt;************************************************************************&lt;br /&gt;&lt;br /&gt;//DA0001TA JOB LA2719, PCS, NOTIFY=DA000IT,&lt;br /&gt;//   MSGCLASS=X&lt;br /&gt;//CPYSTEP EXEC PGM=IEBGENER&lt;br /&gt;//SYSSUT1 DD DSN=DA000IT.INDATA3, DISP=SHR&lt;br /&gt;//SYSUT2 DD DSN=DA0001T.NEW,DISP=MOD&lt;br /&gt;//SYSIN DD DUMMY&lt;br /&gt;//SYSPRINT  DD SYSOUT=*&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;*  USING THE IEBGENER UTILITY TO CONCATENATE DATASETS&lt;br /&gt;*  SYSSUT1 PROVIDING THE INPUT AND SYSUT2 BEING &lt;br /&gt;*  THE OUTPUT&lt;br /&gt;************************************************************************&lt;br /&gt;//DA0001TA JOB  LA2719,PCS,NOTIFY=DA000IT,&lt;br /&gt;//   MSGCLASS=X&lt;br /&gt;//CPYSTEP EXEC PGM=IEBGENER&lt;br /&gt;//SYSUT1 DD DSN=DA000IT.INDATA1,DISP=SHR&lt;br /&gt;//  DD DSN=DA000IT.INDATA3,DISP=SHR&lt;br /&gt;//SYSUT2 DD DSN=DA0001T.MYOUT,&lt;br /&gt;//   DISP=(NEW, CATLG, DELETE),&lt;br /&gt;//   UNIT=SYSALLDA,&lt;br /&gt;//   SPACE=(TRK,(5,1),RLSE)&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;************************************************************************&lt;br /&gt;*  USING THE IEBGENER UTILITY TO EMPTY EXISTING DATASET&lt;br /&gt;************************************************************************&lt;br /&gt;//DA0001TA JOB LA2719,PCS,NOTIFY=DA00IT,&lt;br /&gt;//   MSGCLASS=X&lt;br /&gt;//CPYSTEP EXEC PGM=IEBGENER&lt;br /&gt;//SYSPRINT DD SYSOUT=*&lt;br /&gt;//SYSUT1 DD DUMMY, DCB=(BLKSIZE=800,&lt;br /&gt;//   LRECL=80, RECFM=FB)&lt;br /&gt;//SYSUT2 DD DSB=DA000IT.MYOUT,&lt;br /&gt;//   DISP=SHR&lt;br /&gt;//SYSIN DD DUMMY&lt;br /&gt;// &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;SORT UTILITY&lt;br /&gt;&lt;br /&gt;• The utility is commonly used to sort data, copy selective data, remove duplicates, change data throughout  the file.&lt;br /&gt;&lt;br /&gt;• This is the utility provided by MVS&lt;br /&gt;&lt;br /&gt;USAGE  :  It reorders the Physical Sequential dataset  as per requirement on given          &lt;br /&gt;                  field(s)&lt;br /&gt;     :  These fields are called control fields or key fields.&lt;br /&gt;&lt;br /&gt;WORKING :  It assumes that all input records are out of sequence and it puts them in sequence you  request.&lt;br /&gt;&lt;br /&gt;Eg. Employee data is sorted in the sequence of Emp. No., Emp. Name or Salary etc.&lt;br /&gt;&lt;br /&gt;SORT UTILITY&lt;br /&gt;&lt;br /&gt;Syntax&lt;br /&gt;&lt;br /&gt;Sort fields = (position, length, format, sequence)  or&lt;br /&gt;Sort fields = (position, length, sequence….), format = format&lt;br /&gt;&lt;br /&gt;This syntax is used if all the fields on which the dataset to be sorted are of same type.&lt;br /&gt;&lt;br /&gt;Position :  Location of the 1st byte of the key field, in the input record&lt;br /&gt;&lt;br /&gt;Length :  Length in bytes of the key field.  Sum of all key fields (their lengths) should not exceed 4092&lt;br /&gt;&lt;br /&gt;Format :  Two characters code that identifies the format (type) of the data&lt;br /&gt;&lt;br /&gt;Sequence :   A - Ascending&lt;br /&gt;          D - Descending &lt;br /&gt;&lt;br /&gt;MERGE UTILITY&lt;br /&gt;&lt;br /&gt;• This assumes that record are in proper sequence but at different locations i.e. in different files.  It merges those files into one, in the given sequence.&lt;br /&gt;&lt;br /&gt;Eg.  :  General ledger transactions for different months, in the sequence of a/c no. to be merged in one file.&lt;br /&gt;&lt;br /&gt;SORT UTILITY&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SORT JCL 1&lt;br /&gt;&lt;br /&gt;//DA001TA JOB LA2719,PCS, NOTIFY=DA0001T.MSGCLASS=X&lt;br /&gt;//*******************************************************&lt;br /&gt;//*SORT ON THE EMPLOYEE NAME IN ASCENDING ORDER&lt;br /&gt;//*******************************************************&lt;br /&gt;//SRTSTEP EXEC  PGM = SORT&lt;br /&gt;//SYSIN DD   *&lt;br /&gt;  SORT FIELDS = (1,5,CH,A)&lt;br /&gt;/*&lt;br /&gt;//SORTIN DD DSN=DA0001T.EMPLOYEE,DISP=SHR&lt;br /&gt;//SORTOUT  DD DSN=DA0001T.OUT SORT,&lt;br /&gt;//   SPACE=(TRK,(3,3)), UNIT=SYSDA&lt;br /&gt;//SORTWK01 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA&lt;br /&gt;//SORTWK02 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA&lt;br /&gt;//SORTWK03 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA&lt;br /&gt;//SORTWK04 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA&lt;br /&gt;//SYSPRINT DD SYSOUT=*&lt;br /&gt;//SYSOUT DD SYSOUT=*&lt;br /&gt;//SORTMSG DD SYSOUT=*&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SORT JCL 2&lt;br /&gt;&lt;br /&gt;//DA001TA JOB LA2719,PCS, NOTIFY=DA0001T.MSGCLASS=X&lt;br /&gt;//*******************************************************&lt;br /&gt;//*SORTS ON ASCENDING DEPTNO &amp; DESCENDING ENAME&lt;br /&gt;//*******************************************************&lt;br /&gt;//SRTSTEP EXEC  PGM=SORT&lt;br /&gt;//SYSIN DD *  &lt;br /&gt;SORT FIELDS = (17,2,PD,A,2,6,CH,D)&lt;br /&gt;//SORTIN DD DSN=DA000IT.DEPT,DISP=SHR&lt;br /&gt;//SORTOUT DD DSN=DA000IT.SORTOUT2&lt;br /&gt;//   DISP=NEW,CATLG,DELETE)&lt;br /&gt;//    SPACE=(TRK,(3,3)),UNIT = SYSDA&lt;br /&gt;//SORTWK01 DD SPACE(TRK,(10,5)), UNIT=SYSALLA&lt;br /&gt;//SORTWK02 DD SPACE(TRK,(10,5)), UNIT=SYSALLA&lt;br /&gt;//SORTWK03 DD SPACE(TRK,(10,5)), UNIT=SYSALLA&lt;br /&gt;//SORTWK04 DD SPACE(TRK,(10,5)), UNIT=SYSALLA&lt;br /&gt;//SYSPRINT DD SYSOUT=*&lt;br /&gt;//SYSOUT DD SYSOUT=*&lt;br /&gt;//SORTMSG DD SYSOUT=*&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SORT JCL 3&lt;br /&gt;&lt;br /&gt;TO COPY SELECTIVE DATA &lt;br /&gt;&lt;br /&gt;a) INCLUDE COND copies data that matches the condition given for e.g. in this case it will copy data where one character in 19th position equals 'M' or 'S'.&lt;br /&gt;&lt;br /&gt;//DA001TA JOB LA2719,PCS, NOTIFY=DA0001T.MSGCLASS=X&lt;br /&gt;/***********************************************************************&lt;br /&gt;*  SORTS ON THE INPUT FILE ON JOB AND SELECTS JOB BEGINNING WITH M    &lt;br /&gt;    OR S INTO A DATA SET&lt;br /&gt;//**********************************************************************&lt;br /&gt;//SRTSTEP   EXCE PGM=SORT&lt;br /&gt;//SYSIN  DD  *&lt;br /&gt;  OPTION EQUALS&lt;br /&gt;  SORT FIELDS = (19,6,A), FORMAT=CH&lt;br /&gt;  INCLUDE COND = (19,1,CH,EQ,C'M', OR, 19, 1, CH, EQ, C 'S')&lt;br /&gt;/*&lt;br /&gt;//SORTIN DD DSN=DA0001T.INDATA3,DISP=SHR&lt;br /&gt;//SORTOUT DD DSN=DA0001T.SORTOUT3,DISP=(NEW, CATLG)&lt;br /&gt;//   SPACE=(TRK,(3,3)), UNIT = SYSDA,&lt;br /&gt;//   DCB=(BLKSIZE=800, LRECL=80, RECFM=FB,&lt;br /&gt;//   DSORG=PS)&lt;br /&gt;//SORTWK01 DD SPACE=(TRK,(10,5)), UNIT=SYSALLDA&lt;br /&gt;//SORTWK02 DD SPACE=(TRK,(10,5)), UNIT=SYSALLDA&lt;br /&gt;//SORTWK03 DD SPACE=(TRK,(10,5)), UNIT=SYSALLDA&lt;br /&gt;//SORTWK04 DD SPACE=(TRK,(10,5)), UNIT=SYSALLDA&lt;br /&gt;//SYSOUT  DD SYSOUT=*&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;SORT JCL 4 (Sorts on Job and selects Jobs beginning with M and Deptno beginning with 1)&lt;br /&gt;&lt;br /&gt;//DA001TA JOB LA2719,PCS, NOTIFY=DA0001T.MSGCLASS=X&lt;br /&gt;//********************************************************&lt;br /&gt;//*SORTS ON JOB INCLUDES JOBS BEGINNING WITH M AND DEPTNO &lt;br /&gt;*BEGINNING WITH 1&lt;br /&gt;//********************************************************&lt;br /&gt;//SRTSTEP EXEC PGM=SORT&lt;br /&gt;//SYSIN DD *&lt;br /&gt;  OPTION EQUALS&lt;br /&gt;  SORT FIELDS = (19,6,A),FORMAT=CH&lt;br /&gt;  INCLUDE COND=(19,1,CH,EQ,C'M',AND,51,1,CSF,EQ,1)&lt;br /&gt;/*&lt;br /&gt;//SORTIN DD DSN=DA0001T.INDATA3,DISP=SHR&lt;br /&gt;//SORTOUT DD DSN=DA0021T.SORTOUT4,DISP=NEW,CATLG),&lt;br /&gt;//   SPACE=(TRK,(3,3,)), UNIT = SYSDA,&lt;br /&gt;//   DCB=(BLKSIZE=800, LRECL=80, RECFM=FB,&lt;br /&gt;//   DSORG=PS)&lt;br /&gt;//SORTWK01 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA&lt;br /&gt;//SORTWK02 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA&lt;br /&gt;//SORTWK03 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA&lt;br /&gt;//SORTWK04 DD SPACE=(TRK,(10,5)),UNIT=SYSALLDA&lt;br /&gt;//SYSOUT  DD SYSOUT=*&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;SORT UTILITY&lt;br /&gt;&lt;br /&gt;SORT JCL 5 (Sorts on Job and omits Jobs beginning with M or S&lt;br /&gt;&lt;br /&gt;OMIT COND: INCLUDE and OMIT are mutually exclusive&lt;br /&gt;&lt;br /&gt;Records which do not satisfy the condition are sorted and copies into the output dataset&lt;br /&gt;&lt;br /&gt;//DA001TA JOB LA2719,PCS, NOTIFY=DA0001T,MSGCLASS=X&lt;br /&gt;&lt;br /&gt;//********************************************************&lt;br /&gt;//*SORTS ON JOB *OMITS JOBS BEGINNING WITH M OR S&lt;br /&gt;//********************************************************&lt;br /&gt;//SRTSTEP  EXEC PGM=SORT&lt;br /&gt;//SYSIN  DD  *&lt;br /&gt;OPTION EQUALS&lt;br /&gt;SORT FIELDS = (19,6,A),FORMAT=CH&lt;br /&gt;OMIT COND = (19,1,CH,EQ,C,'M',OR, 19,1,CH,EQ,C'S')&lt;br /&gt;/*&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/03/jcl.html"&gt;Back to JCL Index&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com"&gt;Back to home page&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-2264591582894249853?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/iEj89N2DPoVLZ4GxYSvyC60wKOo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iEj89N2DPoVLZ4GxYSvyC60wKOo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/iEj89N2DPoVLZ4GxYSvyC60wKOo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iEj89N2DPoVLZ4GxYSvyC60wKOo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/0TFAXlZKgD8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/2264591582894249853/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=2264591582894249853" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/2264591582894249853?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/2264591582894249853?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/0TFAXlZKgD8/6-utility.html" title="6. UTILITY" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/03/6-utility.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIAQXk6cCp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-2724220006331825071</id><published>2010-02-17T16:33:00.000-08:00</published><updated>2010-02-17T16:39:00.718-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:39:00.718-08:00</app:edited><title>COBOL Tutorial</title><content type="html">&lt;a href="http://mftuto.blogspot.com/2010/02/1-introduction.html"&gt;1. Introduction&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/2-working-with-data.html"&gt;2. Working with data&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/3-acceptdisplay-verbs.html"&gt;3. ACCEPT/DISPLAY verbs&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/4-move-statements.html"&gt;4. MOVE statements&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/5-arithmetic-verbs.html"&gt;5. Arithmetic verbs&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/6-decision-making.html"&gt;6. Decision Making&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/7-iterations.html"&gt;7. Iterations&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/8-file-handling.html"&gt;8.File Handling&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/9-sorting-and-merging-files.html"&gt;9.Sorting and merging files&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/10-trapping-runtime-errors.html"&gt;10.Trapping Runtime errors&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/11-control-break-processing.html"&gt;11.CONTROL BREAK PROCESSING&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/12-indexed-files.html"&gt;12.Indexed Files&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/13-table-handling.html"&gt;13.Table Handling&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/14-call-statement.html"&gt;14.Call statement&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/15-string-handling.html"&gt;15.String Handling&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-2724220006331825071?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ApbUTbXYyu_X9Q6nidBGXZOLJnk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ApbUTbXYyu_X9Q6nidBGXZOLJnk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ApbUTbXYyu_X9Q6nidBGXZOLJnk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ApbUTbXYyu_X9Q6nidBGXZOLJnk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/iS0h8lyzNDE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/2724220006331825071/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=2724220006331825071" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/2724220006331825071?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/2724220006331825071?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/iS0h8lyzNDE/cobol-tutorial.html" title="COBOL Tutorial" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/cobol-tutorial.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAEQXo-eSp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-7713317046884248250</id><published>2010-02-17T16:32:00.001-08:00</published><updated>2010-02-17T16:41:40.451-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:41:40.451-08:00</app:edited><title>1. Introduction</title><content type="html">COBOL was developed in 1959 by a group called the CODASYL Committee. CODASYL is an abbreviation for Conference on Data Systems Languages. This committee included representatives from academia, user groups, and computer manufacturers. The ultimate objective of this committee was to develop a standard business-oriented language for which all major manufacturers would provide compilers. The Department of Defense convened this conference since it, as well as other government agencies, was particularly dissatisfied with the lack of standards in the computing field.&lt;br /&gt;&lt;br /&gt;Features of COBOL&lt;br /&gt;&lt;br /&gt;1. Business-Oriented Language&lt;br /&gt;As a business-oriented language COBOL is designed specifically for commercial applications, such as payroll and inventory, that typically operate on a large volume of data.&lt;br /&gt;&lt;br /&gt;2. A Standard Language&lt;br /&gt;COBOL compilers are available for most computers. The same COBOL program may be compiled and run on a variety of different machines.&lt;br /&gt;The universality of COBOL allows computer uses greater flexibility than they would have with many other languages. A company is free to acquire different brands of computers while using a single programming language. Similarly, conversion from one model computer to a more advanced or newer one presents no great problem as long as there is a COBOL compiler for each model.&lt;br /&gt;&lt;br /&gt;3. An English-like Language&lt;br /&gt;COBOL is an English-like language. All instructions can be coded using English words rather than complex codes. To add two numbers together, for example, we use the word ADD. Similarly, the rules for programming in COBOL conform to many of the rules for writing in English, making it a relatively simple language to learn.&lt;br /&gt;&lt;br /&gt;4. Self Documenting&lt;br /&gt;One advantage of COBOL computer programs is that they can be substantially self-documenting. Self-documentation is a characteristic of a language that allows a reader of a program to understand its function and follow its processing steps. The language instructions are very English-like, but the programmer has substantial choice as to whether to make a program self-documenting or obscure.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Structure of COBOL programs&lt;br /&gt;COBOL programs are written according to a special structure which is organized into a hierarchy of parts.&lt;br /&gt;&lt;br /&gt;A character is the lowest form in the program structure&lt;br /&gt;&lt;br /&gt;A word is made up of one or more characters.&lt;br /&gt;&lt;br /&gt;A clause consists of characters and words and is used to specify an attribute of an entry.&lt;br /&gt;&lt;br /&gt;A statement is a syntactically valid combination of words and characters written in the PROCEDURE DIVISION of a COBOL program and beginning with a verb.&lt;br /&gt;&lt;br /&gt;A sentence is a sequence of one or more statements, the last of which is terminated by a period followed by a space.&lt;br /&gt;&lt;br /&gt;A paragraph consists of one or more sentences.&lt;br /&gt;&lt;br /&gt;A section consists of one or more paragraphs.&lt;br /&gt;&lt;br /&gt;A division consists of one or more paragraphs or sections. Every COBOL program consists of four divisions in the following order : IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION and PROCEDURE DIVISION.&lt;br /&gt;&lt;br /&gt;COBOL Words&lt;br /&gt;A sequence of continuous characters from the character set can form a word. There are two types of COBOL words, reserved words and user-defined words.&lt;br /&gt;&lt;br /&gt;COBOL words are formed by using the following character set :&lt;br /&gt;&lt;br /&gt;Digits 0-9&lt;br /&gt;Letters A-Z&lt;br /&gt;Space (blank)&lt;br /&gt;Special characters ( ) . “ + - * / = $ , ; &lt; &gt;&lt;br /&gt;&lt;br /&gt;Reserved words are words that are defined both syntactically and semantically by the COBOL language. The programmer cannot use any of these words except in the form specified by the language.&lt;br /&gt;&lt;br /&gt;User-defined words (data names) are words supplied by the programmer in order to satisfy the format of a clause or statement in the language.&lt;br /&gt;&lt;br /&gt;Rules for forming user-defined words&lt;br /&gt;&lt;br /&gt;· 1 to 30 characters.&lt;br /&gt;· Letters, digits, and hyphens (-) only.&lt;br /&gt;· No embedded blanks.&lt;br /&gt;· At least one alphabetic character.&lt;br /&gt;· May not begin or end with a hyphen.&lt;br /&gt;· No COBOL reserved words such as DATA, DIVISION, etc.&lt;br /&gt;&lt;br /&gt;Valid datanames Invalid datanames&lt;br /&gt;HOURS DISCOUNT-&lt;br /&gt;SALES-TOTAL AUTHOR&lt;br /&gt;SUBJECT1 BASIC+HRA&lt;br /&gt;AMOUNT-OF-TRANSACTION-OUT 123&lt;br /&gt;&lt;br /&gt;Divisions&lt;br /&gt;· IDENTIFICATION DIVISION&lt;br /&gt;The IDENTIFICATION DIVISION is the first division of a COBOL program. It supplies the information about the program to others who may read or use the program. The IDENTIFICATION DIVISION is divided into the following paragraphs :&lt;br /&gt;&lt;br /&gt;PROGRAM-ID. Program-name.&lt;br /&gt;Ø Used to specify the program name. Use names of eight characters or less, letter and digits only, because such names are accepted on all systems.&lt;br /&gt;&lt;br /&gt;AUTHOR. author-name.&lt;br /&gt;Ø Used to specify the programmer’s name.&lt;br /&gt;&lt;br /&gt;DATE-WRITTEN. Date.&lt;br /&gt;Ø Specify the date the program was coded.&lt;br /&gt;&lt;br /&gt;DATE-COMPILED. Date.&lt;br /&gt;Ø Can be coded with an actual date. But if it is coded without a date entry, the compiler itself will automatically fill in the actual date of compilation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;· ENVIRONMENT DIVISION&lt;br /&gt;The ENVIRONMENT DIVISION is the only machine-dependent division of a COBOL program. It is composed of two sections :&lt;br /&gt;&lt;br /&gt;CONFIGURATION SECTION.&lt;br /&gt;SOURCE-COMPUTER. Computer.&lt;br /&gt;Ø Computer used for compiling the program.&lt;br /&gt;OBJECT-COMPUTER. Computer.&lt;br /&gt;Ø Computer used for executing the program.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;INPUT-OUTPUT SECTION.&lt;br /&gt;Ø Supplies information concerning the input and output devices used. This section is required only if the program uses files or prints reports.&lt;br /&gt;FILE-CONTROL.&lt;br /&gt;&lt;br /&gt;· DATA DIVISION&lt;br /&gt;The DATA DIVISION defines and describes fields, records, and files in storage. Commonly, it consists of the following sections :&lt;br /&gt;&lt;br /&gt;FILE SECTION.&lt;br /&gt;Ø Defines all input and output files.&lt;br /&gt;&lt;br /&gt;WORKING-STORAGE SECTION.&lt;br /&gt;Ø Reserves storage for fields not part of input or output but nonetheless required for processing. These include constants, end-of-file indicators, and work areas.&lt;br /&gt;&lt;br /&gt;LINKAGE SECTION.&lt;br /&gt;Ø Used to identify items that will be passed to the called program from the calling program and vice-versa.&lt;br /&gt;&lt;br /&gt;· PROCEDURE DIVISION&lt;br /&gt;The PROCEDURE DIVISION is divided into paragraphs. Each paragraph is an independent module or routine that includes a series of instructions designed to perform specific set of operations. Paragraph names are coined by the programmer following the rules for forming data-names.&lt;br /&gt;A PROCEDURE DIVISION may also consist of several sections. A section may contain several paragraphs.&lt;br /&gt;&lt;br /&gt;Coding a COBOL program&lt;br /&gt;A COBOL program file will have an extension .CBL. A COBOL program needs to be coded following the below mentioned coding rules.&lt;br /&gt;Columns&lt;br /&gt;Use&lt;br /&gt;Explanation&lt;br /&gt;1-6&lt;br /&gt;Sequence numbers or Page and Line numbers (optional)&lt;br /&gt;Used for sequence-checking&lt;br /&gt;7&lt;br /&gt;Indicator column&lt;br /&gt;Denotes&lt;br /&gt;* comments&lt;br /&gt;/ page break&lt;br /&gt;- continue strings&lt;br /&gt;8-11&lt;br /&gt;Area A&lt;br /&gt;DIVISION, SECTION, paragraph names and level 01, 77 entries&lt;br /&gt;12-72&lt;br /&gt;Area B&lt;br /&gt;Statements and sentences&lt;br /&gt;73-80&lt;br /&gt;Comment&lt;br /&gt;Ignored by the compiler&lt;br /&gt;Note : Division, Section, Paragraph Names and Sentences must end with a period followed by at least one space.&lt;br /&gt;&lt;br /&gt;A Sample COBOL Program – Eg. 1.1&lt;br /&gt;&lt;br /&gt;IDENTIFICATION DIVISION.&lt;br /&gt;PROGRAM-ID. SAMPLE1.&lt;br /&gt;AUTHOR. XYZ.&lt;br /&gt;DATE-WRITTEN. 1-JUN-2000.&lt;br /&gt;DATE-COMPILED.&lt;br /&gt;&lt;br /&gt;ENVIRONMENT DIVISION.&lt;br /&gt;CONFIGURATION SECTION.&lt;br /&gt;SOURCE-COMPUTER. IBM-PC.&lt;br /&gt;OBJECT-COMPUTER. IBM-PC.&lt;br /&gt;&lt;br /&gt;DATA DIVISION.&lt;br /&gt;&lt;br /&gt;PROCEDURE DIVISION.&lt;br /&gt;0000-MAIN.&lt;br /&gt;STOP RUN.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-7713317046884248250?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/T0QZ71L2Br47M3r9jXcJ8whCrTs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/T0QZ71L2Br47M3r9jXcJ8whCrTs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/T0QZ71L2Br47M3r9jXcJ8whCrTs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/T0QZ71L2Br47M3r9jXcJ8whCrTs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/nGLLktcepwY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/7713317046884248250/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=7713317046884248250" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7713317046884248250?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7713317046884248250?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/nGLLktcepwY/1-introduction.html" title="1. Introduction" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/1-introduction.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAFRn4yfip7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-3578703570899793276</id><published>2010-02-17T16:31:00.000-08:00</published><updated>2010-02-17T16:41:57.096-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:41:57.096-08:00</app:edited><title>2. Working with data</title><content type="html">Hierarchical representation of data&lt;br /&gt;Level numbers&lt;br /&gt;The record description specifies the format of a record . Record description entries indicate :&lt;br /&gt;The items or fields to appear in the record&lt;br /&gt;The order in which the fields appear&lt;br /&gt;How these fields are related to one another&lt;br /&gt;&lt;br /&gt;Data is grouped in COBOL using the concept of a level. Records are considered the highest level of data in a file, and are coded on the 01 level. There can be only one data-name at the 01 level for each record, as it is the all-inclusive data-name. A field of data within the record is coded on a level subordinate to 01, i.e 02, 03 and so on. Any level number between 02 and 49 may be used to describe fields within a record.&lt;br /&gt;&lt;br /&gt;Elementary and Group Items&lt;br /&gt;An elementary item has no subordinate parts. A group item may consist of one or more group items. In the code below :&lt;br /&gt;FIRST-NAME, ZIP-CODE are elementary items&lt;br /&gt;CUSTOMER-ADDRESS, STREET are group items&lt;br /&gt;&lt;br /&gt;Eg 2.1:&lt;br /&gt;&lt;br /&gt;01 CUSTOMER-ADDRESS&lt;br /&gt;02 NAME&lt;br /&gt;03 FIRST-NAME&lt;br /&gt;03 LAST-NAME&lt;br /&gt;02 STREET&lt;br /&gt;03 S-NUMBER&lt;br /&gt;03 STREET-NAME&lt;br /&gt;02 ZIP-CODE&lt;br /&gt;&lt;br /&gt;PICTURE Clauses&lt;br /&gt;Group items are defined by a level number and a name, which is followed by a period. Elementary items must be described with a PICTURE (or PIC, for short) clause.&lt;br /&gt;&lt;br /&gt;Functions of the PICTURE Clause&lt;br /&gt;Specifies the type of data contained within an elementary item.&lt;br /&gt;Indicates the size of the field.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Types of data fields&lt;br /&gt;&lt;br /&gt;Type&lt;br /&gt;Picture clause&lt;br /&gt;Explanation&lt;br /&gt;Alphabetic&lt;br /&gt;A&lt;br /&gt;A field that may contain only letters or blanks. E.g. a name or item description field.&lt;br /&gt;Alphanumeric&lt;br /&gt;X&lt;br /&gt;A field that may contain any character i.e. letters, digits, blanks and/or special characters. E.g. an address field.&lt;br /&gt;Numeric&lt;br /&gt;9&lt;br /&gt;Any signed or unsigned field that will contain only digits is considered numeric.&lt;br /&gt;&lt;br /&gt;Size of data fields&lt;br /&gt;The size of the field is denoted by the number of A’s, X’s, or 9’s used in the PICTURE.&lt;br /&gt;&lt;br /&gt;Eg 2.2:&lt;br /&gt;05 AMT PIC 99999.&lt;br /&gt;&lt;br /&gt;AMT is an elementary field consisting of five positions of numeric data. Alternatively, the same can be coded as follows :&lt;br /&gt;&lt;br /&gt;Eg 2.3:&lt;br /&gt;05 AMT PIC 9(5).&lt;br /&gt;&lt;br /&gt;At least one space must follow the word PIC. All A’s, X’s, or 9’s should appear consecutively with no spaces between the characters. Similarly, if parentheses are used to denote the size of a field, no spaces should appear within the parentheses.&lt;br /&gt;&lt;br /&gt;Eg 2.4:&lt;br /&gt;01 CUSTOMER-ADDRESS.&lt;br /&gt;02 NAME.&lt;br /&gt;03 FIRST-NAME PIC X(10).&lt;br /&gt;03 LAST-NAME PIC X(15).&lt;br /&gt;02 STREET.&lt;br /&gt;03 S-NUMBER PIC 9(3).&lt;br /&gt;03 STREET-NAME PIC X(20).&lt;br /&gt;02 ZIP-CODE PIC 9(6).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;WORKING-STORAGE SECTION&lt;br /&gt;Defines and describes all data storage fields required for Processing (Including constants).&lt;br /&gt;These fields are not part of any input/output file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Can be used for storing&lt;br /&gt;Intermediate results&lt;br /&gt;Counters, Flags&lt;br /&gt;Input/Output Records&lt;br /&gt;Tables etc.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Types of data&lt;br /&gt;Variable&lt;br /&gt;Data entered by the user at run-time.&lt;br /&gt;&lt;br /&gt;Constant&lt;br /&gt;Data required for processing that is not dependent on the input to the system. There are 3 types of literals.&lt;br /&gt;&lt;br /&gt;1. Numeric Literals&lt;br /&gt;A numeric literal is a constant used primarily for arithmetic operations.&lt;br /&gt;&lt;br /&gt;Rules for forming numeric literals&lt;br /&gt;a) 1 to 18 digits&lt;br /&gt;b) A + or – sign may be used, but it must appear to the left of the number.&lt;br /&gt;c) A decimal point is permitted within the literal. The decimal point, however may not be the rightmost character of the literal.&lt;br /&gt;&lt;br /&gt;Eg 2.5:&lt;br /&gt;+34&lt;br /&gt;-8.6&lt;br /&gt;.008&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Nonnumeric Literals&lt;br /&gt;A nonnumeric literal is a constant that is used in the PROCEDURE DIVISION for all operations except arithmetic.&lt;br /&gt;&lt;br /&gt;Rules for forming nonnumeric literals&lt;br /&gt;a) The literal must be enclosed in quotation marks.&lt;br /&gt;b) A maximum of 120 characters are permitted.&lt;br /&gt;c) Any character permitted in the COBOL character set may be used except the quotation mark.&lt;br /&gt;&lt;br /&gt;Eg 2.6:&lt;br /&gt;‘CODE’&lt;br /&gt;‘$ 123’&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Figurative Constants&lt;br /&gt;A figurative constant is a COBOL reserved word that has special significance to the compiler.&lt;br /&gt;&lt;br /&gt;The figurative constants are&lt;br /&gt;ZERO, ZEROS, ZEROES - references the value of zeros&lt;br /&gt;SPACE, SPACES - reference the value of blank&lt;br /&gt;QUOTE, QUOTES -references the quotation mark&lt;br /&gt;-used in nonnumeric literals to include a&lt;br /&gt;quote.&lt;br /&gt;e.g ‘D’Quote’Souza will store the value D’Souza.&lt;br /&gt;LOW-VALUE , LOW-VALUES - references the lowest value in the collating&lt;br /&gt;sequence for the particular computer system.&lt;br /&gt;HIGH-VALUE, HIGH_VALUES - references the highest value in the collating&lt;br /&gt;sequence for the particular computer system.&lt;br /&gt;ALL - references one or more occurrences of the&lt;br /&gt;single character nonnumeric literal.&lt;br /&gt;e.g. MOVE ALL “A” TO HEAD-1, will&lt;br /&gt;result in the field HEAD-1 being filled with A’s.&lt;br /&gt;&lt;br /&gt;Special Characters (Numeric Field) :&lt;br /&gt;Implied decimal point&lt;br /&gt;The symbol V denotes an implied decimal point, which does not occupy a storage position. In the code below, AMOUNT occupies 5 positions.&lt;br /&gt;&lt;br /&gt;Eg 2.7:&lt;br /&gt;05 AMOUNT PIC 999V99.&lt;br /&gt;&lt;br /&gt;Eg 2.8:&lt;br /&gt;PIC Description Value Stored as&lt;br /&gt;99V9 38.50 385&lt;br /&gt;9(4)V99 452.39 045239&lt;br /&gt;999 550 550&lt;br /&gt;&lt;br /&gt;Signed numbers&lt;br /&gt;If a numeric field can have negative contents, then it must have an S in its PIC clause. It must be the leftmost character. It does not take any storage space.&lt;br /&gt;&lt;br /&gt;Eg 2.9:&lt;br /&gt;02 BALANCE PIC S999.&lt;br /&gt;&lt;br /&gt;Edited fields&lt;br /&gt;&lt;br /&gt;The purpose of editing is to make data more suitable for human reading. Thus editing in its most common use is associated with printing data on the printer. For example, we may suppress leading zeros, we may use commas to make long numeric values more legible, we may insert a dollar sign in front of a value, etc.&lt;br /&gt;&lt;br /&gt;The editing characters are Z * $ - + CR DB . , B 0 /&lt;br /&gt;&lt;br /&gt;Z - Suppressing leading zeros&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Z PICTURE character is used to replace leading zeros by blanks and thus performs a function identical to that of the floating . Zero suppression terminates when the first nonzero digit or the . character is encountered, whichever occurs first. When Z’s have been designated for all positions in a field and the value to be inserted in that field is zero, in that case the entire field is blanked. Z’s can appear before as well as after the decimal point. The number of Z’s representing integers in the report-item should be equal to the number of integers or 9’s in the sending field.&lt;br /&gt;&lt;br /&gt;Eg 2.10:&lt;br /&gt;PIC Description Value Printed as&lt;br /&gt;Z99 25 b25&lt;br /&gt;ZZZV99 25 b2500&lt;br /&gt;ZZZV99 0.10 bbb10&lt;br /&gt;ZZZVZZ 0.052 bbb05&lt;br /&gt;ZZZVZZ 0.00 bbbbb&lt;br /&gt;&lt;br /&gt;* - Check Protection&lt;br /&gt;The * character is referred to as a check-protect character and is normally used to protect dollar amounts written on checks or other negotiable documents. Asterisks are zero-suppression characters that replace each non-significant zero and comma with * instead of a space.&lt;br /&gt;&lt;br /&gt;Eg 2.11:&lt;br /&gt;PIC Description Value Printed as&lt;br /&gt;**999 04678 *4678&lt;br /&gt;***99 00052 ***52&lt;br /&gt;&lt;br /&gt;$ - Dollar Sign&lt;br /&gt;By use of the $ PICTURE character the dollar sign is written in the position in which it is to appear in the output. Since the $ sign is counted in the size of the field, the field should be assigned at least one more position than the maximum number of significant digits expected. The $ may also be floated, by which we mean that it will be entered to the left of the first significant digit in the field and be preceded by blanks. The $ float stops when wither the first nonzero digit or the . or V is encountered. When the $ sign appears in all positions and the value is zero, the effect is to blank the entire field (including any . and ,).&lt;br /&gt;&lt;br /&gt;Eg 2.12:&lt;br /&gt;PIC Description Value Printed as&lt;br /&gt;$999V99 125.13 $12513&lt;br /&gt;$9(5)V99 100.00 $0010000&lt;br /&gt;$$99V99 12.49 b$1249&lt;br /&gt;$$$$9V99 150.10 $15010&lt;br /&gt;$$$$V99 0.15 bbb$15&lt;br /&gt;$$$$V$$ 0.0 bbbbb&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;. - (Decimal Point)&lt;br /&gt;The . (decimal) PICTURE character indicates the position of the decimal point and serves to align the actual decimal values in the field, only one such character may appear in a field. Further, a field cannot contain both a V and a . PICTURE character. It cannot be the rightmost character. If all the digits before and after the decimal point are zero, the resulting field will be blank.&lt;br /&gt;&lt;br /&gt;Eg 2.13:&lt;br /&gt;PIC Description Value Printed as&lt;br /&gt;$9,999.99 2,350.22 $2,350.22&lt;br /&gt;$9,999.99 150.31 $0,150.31&lt;br /&gt;$$,999.99 150.31 bb$150.31&lt;br /&gt;$$,$$$.99 24.40 bbb$25.40&lt;br /&gt;$$,$$$.999 0.019 bbbbb$.019&lt;br /&gt;$$$$$.$$$ 0.0 bbbbbbbbb&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;, - (Comma)&lt;br /&gt;The comma is placed in the positions in which it is desired. A field may include more than one , (comma) PICTURE character if the size of the field warrants it. A comma will be appropriately suppressed if no significant digit precedes it. It cannot appear as the leftmost or rightmost character.&lt;br /&gt;&lt;br /&gt;Eg 2.14:&lt;br /&gt;PIC Description Value Printed as&lt;br /&gt;$9,999.99 2,350.22 $2,350.22&lt;br /&gt;$9,999.99 150.31 $0,150.31&lt;br /&gt;$$,999.99 150.31 bb$150.31&lt;br /&gt;$$,$$$.99 24.40 bbb$25.40&lt;br /&gt;$$,$$$.999 0.019 bbbbb$.019&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$$,$$$.$$$ 0.009 bbbbb$.009&lt;br /&gt;$$,$$$.$$$ 0.0 bbbbbbbbbb&lt;br /&gt;$$,$$9.999 2,210.2 $2,210.200&lt;br /&gt;$$,999.9 2,210.2 $2,210.2&lt;br /&gt;$$,999.9 2,210.256 $2,210.2&lt;br /&gt;$9,999.9999 23 $0,023.0000&lt;br /&gt;&lt;br /&gt;- (Minus) and + (Plus)&lt;br /&gt;The – PICTURE character prints a minus sign only if the quantity is negative and omits a sign for all other quantities. It can appear as the leftmost or rightmost character. The – PICTURE insertion character differs from the S character in that the use of the S character identifies a field as a signed one for computational purposes, but the sign does not occupy a position. Use of the – PICTURE character leads to a field in which the sign occupies a character position.&lt;br /&gt;&lt;br /&gt;The + PICTURE character is used to print wither a plus sign or a minus sign for all values. A + sign will be generated for positive or unsigned quantities, and a – sign will be generated for negative quantities. The sending field should have an $ in its PICTURE clause for it to be interpreted as a signed number.&lt;br /&gt;&lt;br /&gt;The + or – PICTURE character can appear as the leftmost or rightmost character. They can also be floated, similar to the $ character. However , the +, -, and $ are mutually exclusive as floating characters. If we want to have both $ float and + or – sign representation, we write the + or – to the right of the field.&lt;br /&gt;&lt;br /&gt;Eg 2.15:&lt;br /&gt;PIC Description Value Printed as&lt;br /&gt;+999.9 35.2 +035.2&lt;br /&gt;999.9+ 35.2 035.2+&lt;br /&gt;999.9+ -35.2 035.2-&lt;br /&gt;++9.9 -001.3 b-1.3&lt;br /&gt;+++9.99 .05 bb+0.05&lt;br /&gt;+++9.99 -.05 bb-0.05&lt;br /&gt;++++.++ .01 bbb+.01&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;----.-- 0.0 bbbbbbb&lt;br /&gt;--99.99 -10.25 b-10.25&lt;br /&gt;--999.99 100.25 b100.25&lt;br /&gt;999.9- -10.2 010.2-&lt;br /&gt;&lt;br /&gt;DB/CR&lt;br /&gt;In accounting applications there is often need to identify values that represent debits or credits. The COBOL language facilitates such differentiation by means of the DB (debit) and CR (CR) editing characters. The DB or CR symbol is written only to the right of a field in the PICTURE clause, and in both cases it is represented in storage for the purpose of subsequent output only when the value is negative.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Summary for use of + - DB CR&lt;br /&gt;PIC Storage when Storage when&lt;br /&gt;Character data positive data negative&lt;br /&gt;&lt;br /&gt;+ + -&lt;br /&gt;- Blank -&lt;br /&gt;DB Blank DB&lt;br /&gt;CR Blank CR&lt;br /&gt;&lt;br /&gt;Eg 2.16:&lt;br /&gt;PIC Description Value Printed as&lt;br /&gt;$999.99DB 135.26 $135.26bb&lt;br /&gt;$999.99DB -135.26 $135.26DB&lt;br /&gt;$,$$99.99CR -10.50 bb$10.50CR&lt;br /&gt;&lt;br /&gt;B – (blank)&lt;br /&gt;The B insertion editing character results in blanks being entered in the designated positions.&lt;br /&gt;&lt;br /&gt;Eg 2.17:&lt;br /&gt;05 NAME PIC ABABA(10) VALUE ‘RBSMITH’.&lt;br /&gt;NAME = RbBbSMITHbbbbb&lt;br /&gt;&lt;br /&gt;0 - (Zero)&lt;br /&gt;The zero insertion character causes zeros to be inserted in the positions in which it appears.&lt;br /&gt;&lt;br /&gt;Eg 2.18:&lt;br /&gt;05 AMOUNT PIC 9(4)000 VALUE 1365.&lt;br /&gt;AMOUNT = 1365000&lt;br /&gt;&lt;br /&gt;/ - (stroke)&lt;br /&gt;Each / (stroke) in the PICTURE character string represents a character position into which the stroke character will be inserted.&lt;br /&gt;&lt;br /&gt;Eg 2.19:&lt;br /&gt;05 PRINT-DATE PIC 99/99/99 VALUE 040798.&lt;br /&gt;PRINT-DATE = 04/07/98&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;VALUE Clause&lt;br /&gt;In addition to defining storage fields using the PICTURE clause it is often desirable to assign initial values to elementary items in the WORKING-STORAGE SECTION. Such a value may remain unchanged throughout the program, or it may change in the course of program execution. Such initial values are generally not assigned to FILE SECTION items, since such fields either receive their data from the external medium or from other storage location as the result of program execution.&lt;br /&gt;&lt;br /&gt;Eg 2.20:&lt;br /&gt;02 PAGE-TITLE PIC A(14) VALUE “SAMPLE PROGRAM”.&lt;br /&gt;02 TAX-RATE PIC V99 VALUE IS 0.03.&lt;br /&gt;&lt;br /&gt;Continuation of Literals from one line to the next&lt;br /&gt;A nonnumeric literal may contain up to 120 characters. The same applies to a nonnumeric literal in a VALUE clause. Sometimes a nonnumeric literal may not fit on a single line, hence it is necessary to continue this literal.&lt;br /&gt;&lt;br /&gt;Rules for continuation of nonnumeric literals&lt;br /&gt;Begin the literal in the VALUE clause with a quotation mark.&lt;br /&gt;Continue the literal until position 72, the end of the line, is reached. Do not end with a quotation mark on this line.&lt;br /&gt;Place a hyphen on the next line in the position beginning in Area B of the second line. Begin with a quotation mark.&lt;br /&gt;End the literal with a quotation mark.&lt;br /&gt;&lt;br /&gt;Eg 2.21:&lt;br /&gt;01 PAGE-HEADING PIC X(36) VALUE “MONTHLY TRANSACTIONS FOR AP&lt;br /&gt;- “RIL 2000”.&lt;br /&gt;&lt;br /&gt;USAGE clause&lt;br /&gt;Numeric data in a computer may be represented in one of two basic modes. They may be represented as character data or as numeric data. The arithmetic registers of computers perform arithmetic with numeric data that is in numeric, not character mode. If numeric data is represented in character mode, it must first&lt;br /&gt;be converted to numeric mode before arithmetic computations can be performed.&lt;br /&gt;In COBOL, data in character mode is described in DISPLAY mode, while data in numeric mode is described as being COMPUTATIONAL MODE. All data items are assumed to be in DISPLAY mode unless they are declared to be COMPUTATIONAL. The declaration is done in the DATA DIVISION with the USAGE clause.&lt;br /&gt;&lt;br /&gt;Eg 2.22:&lt;br /&gt;02 AMOUNT-1 PIC 99.&lt;br /&gt;02 AMOUNT-2 PIC 99 USAGE DISPLAY.&lt;br /&gt;02 AMOUNT-3 PIC 99 USAGE COMPUTATIONAL.&lt;br /&gt;02 AMOUNT-4 PIC 99 USAGE COMP.&lt;br /&gt;&lt;br /&gt;REDEFINES Clause&lt;br /&gt;The REDEFINES clause can be used to allow the same storage location to be referenced by different data-names or to allow a regrouping or different description of the data in a particular storage location.&lt;br /&gt;&lt;br /&gt;Restrictions&lt;br /&gt;&lt;br /&gt;The REDEFINES clause cannot be used&lt;br /&gt;- at the 01 level in the FILE SECTION.&lt;br /&gt;- when the levels of data-name-1 and data-name-2 are different.&lt;br /&gt;- When the level number is 66 or 88.&lt;br /&gt;&lt;br /&gt;Eg 2.23:&lt;br /&gt;01 SAMPLE.&lt;br /&gt;02 RECEIVABLE.&lt;br /&gt;03 CUSTOMER-NUMBER PIC 9(8).&lt;br /&gt;03 CUSTOMER-NAME PIC X(11).&lt;br /&gt;03 AMOUNT PIC 9(4)V99.&lt;br /&gt;02 PAYABLE REDEFINES RECEIVABLE.&lt;br /&gt;03 VENDOR-NUMBER PIC 9(6).&lt;br /&gt;03 VENDOR-NAME PIC X(12).&lt;br /&gt;03 VENDOR-OWED-AMT PIC 9(5)V99.&lt;br /&gt;&lt;br /&gt;RENAMES Clause&lt;br /&gt;The RENAMES clause provides the programmer with the capability of regrouping elementary data items. It resembles the REDEFINES clause, except that it can form a new grouping of data items which combines several items. Use of the RENAMES clause is always signaled by the special 66 level number.&lt;br /&gt;&lt;br /&gt;Eg 2.24:&lt;br /&gt;01 TAX-RECORD.&lt;br /&gt;02 SOC-SEC-NUMBER PIC X(9).&lt;br /&gt;02 NAME.&lt;br /&gt;03 FIRST-NAME PIC X(10).&lt;br /&gt;03 LAST-NAME PIC X(15).&lt;br /&gt;02 TOTAL-YTD.&lt;br /&gt;03 GROSS-PAY PIC 9(8)V99.&lt;br /&gt;03 NET-PAY PIC 9(8)V99.&lt;br /&gt;03 TAX PIC 9(5)V99.&lt;br /&gt;66 LAST-GROSS RENAMES LAST-NAME THRU NET-PAY.&lt;br /&gt;&lt;br /&gt;Qualification of names&lt;br /&gt;A data name that is not unique must be qualified in COBOL verbs.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Eg 2.25:&lt;br /&gt;&lt;br /&gt;01 IN-REC&lt;br /&gt;05 NAME PIC X(10).&lt;br /&gt;05 AGE PIC 99.&lt;br /&gt;01 OUT-REC.&lt;br /&gt;05 NAME PIC X(10).&lt;br /&gt;05 B-DATE PIC 9(6).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MOVE NAME OF IN-REC TO NAME OF OUT-REC.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-3578703570899793276?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/S5HUdblyv8YZi3qmMkleIWzUuVE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/S5HUdblyv8YZi3qmMkleIWzUuVE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/S5HUdblyv8YZi3qmMkleIWzUuVE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/S5HUdblyv8YZi3qmMkleIWzUuVE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/gsu_gSITEBw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/3578703570899793276/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=3578703570899793276" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/3578703570899793276?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/3578703570899793276?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/gsu_gSITEBw/2-working-with-data.html" title="2. Working with data" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/2-working-with-data.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAHQXc5fip7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-1647421083696998273</id><published>2010-02-17T16:30:00.001-08:00</published><updated>2010-02-17T16:42:10.926-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:42:10.926-08:00</app:edited><title>3. ACCEPT/DISPLAY verbs</title><content type="html">The PROCEDURE DIVISION contains all the instructions required for processing. It is divided into various paragraphs or modules. Each module consists of sentences.&lt;br /&gt;&lt;br /&gt;The ACCEPT and DISPLAY verbs are used for input and output in conjunction with storage fields that are not part of any files.&lt;br /&gt;&lt;br /&gt;ACCEPT&lt;br /&gt;The instruction ACCEPT identifier enable the user to enter input data directly from a keyboard.&lt;br /&gt;&lt;br /&gt;Eg 3.1:&lt;br /&gt;ACCEPT MY-NAME.&lt;br /&gt;&lt;br /&gt;DISPLAY&lt;br /&gt;DISPLAY can reference a series of identifiers or literals.&lt;br /&gt;&lt;br /&gt;Eg 3.2:&lt;br /&gt;DISPLAY MY-NAME.&lt;br /&gt;DISPLAY “HELLO”.&lt;br /&gt;&lt;br /&gt;STOP RUN&lt;br /&gt;The verb STOP RUN terminates program execution. A program may contain more than one STOP RUN statement, depending on the logic of the program. STOP RUN signifies the logical end of the program.&lt;br /&gt;&lt;br /&gt;A program using DISPLAY and ACCEPT.&lt;br /&gt;Eg 3.3:&lt;br /&gt;IDENTIFICATION DIVISION.&lt;br /&gt;PROGRAM-ID. SAMPLE2.&lt;br /&gt;*This program accepts the user’s name and displays a message.&lt;br /&gt;AUTHOR. XYZ.&lt;br /&gt;DATE-WRITTEN. 1-JUN-2000.&lt;br /&gt;DATE-COMPILED.&lt;br /&gt;&lt;br /&gt;ENVIRONMENT DIVISION.&lt;br /&gt;CONFIGURATION SECTION.&lt;br /&gt;SOURCE-COMPUTER. IBM-PC.&lt;br /&gt;OBJECT-COMPUTER. IBM-PC.&lt;br /&gt;&lt;br /&gt;DATA DIVISION.&lt;br /&gt;WORKING-STORAGE SECTION.&lt;br /&gt;01 USER-NAME PIC X(15).&lt;br /&gt;PROCEDURE DIVISION.&lt;br /&gt;0000-MAIN.&lt;br /&gt;DISPLAY “Enter your name : “.&lt;br /&gt;ACCEPT USER-NAME.&lt;br /&gt;DISPLAY “HELLO “ USER-NAME.&lt;br /&gt;STOP RUN.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-1647421083696998273?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dmdwlCv1pV4Y6ZB3WyK_bwBz9bk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dmdwlCv1pV4Y6ZB3WyK_bwBz9bk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/dmdwlCv1pV4Y6ZB3WyK_bwBz9bk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dmdwlCv1pV4Y6ZB3WyK_bwBz9bk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/jR4ACDj0bUM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/1647421083696998273/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=1647421083696998273" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/1647421083696998273?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/1647421083696998273?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/jR4ACDj0bUM/3-acceptdisplay-verbs.html" title="3. ACCEPT/DISPLAY verbs" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/3-acceptdisplay-verbs.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAAQnczfip7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-6951525203663542579</id><published>2010-02-17T16:28:00.000-08:00</published><updated>2010-02-17T16:42:23.986-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:42:23.986-08:00</app:edited><title>4. MOVE statements</title><content type="html">A value can be moved from one storage location to another by the move statement. Contents of receiving field are changed after the operation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Verb&lt;br /&gt;&lt;br /&gt;Sending field&lt;br /&gt;Receiving field&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MOVE AMT-IN TO AMT-OUT.&lt;br /&gt;&lt;br /&gt;The contents of AMT-In will be copied to the second field, AMT-OUT, as a result of the MOVE operation.&lt;br /&gt;&lt;br /&gt;Eg 4.1:&lt;br /&gt;MOVE TOTAL TO PRINT-TOTAL&lt;br /&gt;MOVE ‘INVALID’ TO MESSAGE.&lt;br /&gt;MOVE ZEROS TO TOTAL&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Types of MOVE :&lt;br /&gt;The MOVE statement can be categorized based on the receiving field : numeric MOVEs and non-numeric MOVEs.&lt;br /&gt;&lt;br /&gt;Numeric MOVE&lt;br /&gt;A numeric move is one in which a numeric field or literal is moved to a numeric receiving field.&lt;br /&gt;&lt;br /&gt;When Sending and Receiving fields have the same PIC clauses&lt;br /&gt;If the PIC clauses of both fields are identical, the contents of identifier-2 will be replaced with the contents of identifier-1 and the sending field will be unchanged.&lt;br /&gt;&lt;br /&gt;When Sending and Receiving fields have different PIC clauses&lt;br /&gt;Rule 1 : Moving integer portions of numeric fields&lt;br /&gt;When moving an integer sending field or an integer portion of a numeric sending field to a numeric receiving field, move, movement is from right to left. All nonfilled high-order (leftmost) integer positions of the receiving field are replaced with zeros.&lt;br /&gt;&lt;br /&gt;Eg 4.2:&lt;br /&gt;05 AMT-IN PIC 999 VALUE 123.&lt;br /&gt;05 AMT-OUT PIC 9(4) VALUE 4567.&lt;br /&gt;MOVE AMT-IN TO AMT-OUT.&lt;br /&gt;Result :&lt;br /&gt;AMT-OUT = 0123&lt;br /&gt;&lt;br /&gt;Avoiding truncation&lt;br /&gt;In a numeric move, if the receiving field has fewer integer positions than the sending the field, the most significant digits will be truncated.&lt;br /&gt;&lt;br /&gt;Eg 4.3:&lt;br /&gt;05 AMT-IN PIC 999 VALUE 123.&lt;br /&gt;05 AMT-OUT PIC 9(2) VALUE 45.&lt;br /&gt;&lt;br /&gt;MOVE AMT-IN TO AMT-OUT.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;AMT-OUT = 23&lt;br /&gt;&lt;br /&gt;Rule 2: Moving decimal portions of numeric fields&lt;br /&gt;When moving a decimal portion of a numeric sending field to the decimal portion of a numeric receiving field, movement is from left to right, beginning at the implied decimal point. Low-order (rightmost) non-filled decimal portions of the receiving field are replaced with zeros.&lt;br /&gt;&lt;br /&gt;Eg 4.4:&lt;br /&gt;a. When receiving field has more decimal positions than the sending field&lt;br /&gt;05 AMT-IN PIC 99V99 VALUE 12.34.&lt;br /&gt;05 AMT-OUT PIC 99V999 VALUE 56.789.&lt;br /&gt;&lt;br /&gt;MOVE AMT-IN TO AMT-OUT.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;AMT-OUT = 12.340&lt;br /&gt;&lt;br /&gt;b. When receiving field has fewer decimal positions than the sending field&lt;br /&gt;05 AMT-IN PIC V99 VALUE.34.&lt;br /&gt;05 AMT-OUT PIC V9 VALUE .5.&lt;br /&gt;&lt;br /&gt;MOVE AMT-IN TO AMT-OUT.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;AMT-OUT = .3&lt;br /&gt;&lt;br /&gt;Note : The same rules apply to numeric literals moved to numeric fields&lt;br /&gt;&lt;br /&gt;Non-numeric MOVE&lt;br /&gt;A non-numeric MOVE operation occurs in the following cases :&lt;br /&gt;1. Moving an alphanumeric or alphabetic field, defined by a PICTURE of X’s or A’s, to another alphanumeric or alphabetic field.&lt;br /&gt;2. Moving a non-numeric literal to an alphanumeric or alphabetic field.&lt;br /&gt;3. Moving a numeric field or numeric literal to an alphanumeric field or to any group item.&lt;br /&gt;&lt;br /&gt;Rule :&lt;br /&gt;In a non-numeric move, data is transmitted from the sending field to the receiving field from left to right. Low-order or rightmost positions of the receiving field that are not replaced with sending field characters are filled with spaces.&lt;br /&gt;&lt;br /&gt;Eg 4.4:&lt;br /&gt;a. When receiving field is larger than the sending field&lt;br /&gt;&lt;br /&gt;05 NAME-IN PIC XXX VALUE “ABC”.&lt;br /&gt;05 NAME-OUT PIC X(5) VALUE “DEFGH”.&lt;br /&gt;&lt;br /&gt;MOVE NAME-IN TO NAME-OUT.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;NAME-OUT = ABCbb&lt;br /&gt;&lt;br /&gt;b. When receiving field is smaller than the sending field&lt;br /&gt;&lt;br /&gt;05 NAME-IN PIC XXX VALUE “ABC”.&lt;br /&gt;05 NAME-OUT PIC XX VALUE “PQ”.&lt;br /&gt;&lt;br /&gt;MOVE NAME-IN TO NAME-OUT.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;NAME-OUT = AB&lt;br /&gt;&lt;br /&gt;c. When the sending field is numeric integer and the receiving field is non-numeric&lt;br /&gt;&lt;br /&gt;05 NAME-IN PIC 999 VALUE 321&lt;br /&gt;05 NAME-OUT PIC X(5) VALUE “DEFGH”.&lt;br /&gt;&lt;br /&gt;MOVE NAME-IN TO NAME-OUT.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;NAME-OUT = 321bb&lt;br /&gt;&lt;br /&gt;d. When the sending field is a non-numeric literal&lt;br /&gt;&lt;br /&gt;05 NAME-OUT PIC X(5) VALUE “DEFGH”.&lt;br /&gt;&lt;br /&gt;MOVE “XYZ” TO NAME-OUT.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;NAME-OUT = XYZbb&lt;br /&gt;&lt;br /&gt;e. When the sending field is a figurative constant&lt;br /&gt;&lt;br /&gt;05 NAME-OUT PIC X(5) VALUE “DEFGH”.&lt;br /&gt;&lt;br /&gt;MOVE SPACES TO NAME-OUT.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;NAME-OUT = bbbbb&lt;br /&gt;&lt;br /&gt;A group move is considered a non-numeric move&lt;br /&gt;All group items, even those with numeric subfields, are treated as alphanumeric fields.&lt;br /&gt;&lt;br /&gt;Eg 4.5:&lt;br /&gt;05 DATE-OUT.&lt;br /&gt;10 MONTH-OUT PIC 99 .&lt;br /&gt;10 YEAR-OUT PIC 99.&lt;br /&gt;&lt;br /&gt;a. MOVE 1 TO MONTH-OUT.MOVE 99 TO YEAR-OUT.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;DATE-OUT = 0194&lt;br /&gt;&lt;br /&gt;b. MOVE 194 TO DATE-OUT.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;DATE-OUT = 194b&lt;br /&gt;&lt;br /&gt;Permissible MOVE operations&lt;br /&gt;&lt;br /&gt;Sending Field&lt;br /&gt;Receiving Field&lt;br /&gt;Numeric&lt;br /&gt;Alphabetic&lt;br /&gt;Alphanumeric&lt;br /&gt;Group item&lt;br /&gt;Numeric&lt;br /&gt;&lt;br /&gt;* Numeric integer fields can be moved to alphanumeric fields but numeric fields with a V in the PIC clause cannot be moved to alphanumeric fields.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The MOVE CORRESPONDING statement&lt;br /&gt;In the MOVE CORRESPONDING statement, all elementary items within the sending group-item that have the same names as corresponding elementary items in the receiving group-item will be moved. The same-named fields in the receiving group-item need not be in any specific order. Any fields of the sending record, that are not matched by the same-named fields in the receiving record are ignored.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-6951525203663542579?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PVqInrpiAkS9F2evLxXgg-t0gO8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PVqInrpiAkS9F2evLxXgg-t0gO8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PVqInrpiAkS9F2evLxXgg-t0gO8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PVqInrpiAkS9F2evLxXgg-t0gO8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/apHJtAYRZ8c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/6951525203663542579/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=6951525203663542579" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/6951525203663542579?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/6951525203663542579?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/apHJtAYRZ8c/4-move-statements.html" title="4. MOVE statements" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/4-move-statements.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUABRn0_cSp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-4517696885153056586</id><published>2010-02-17T16:27:00.000-08:00</published><updated>2010-02-17T16:42:37.349-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:42:37.349-08:00</app:edited><title>5. Arithmetic verbs</title><content type="html">All the basic arithmetic operations of ADD, SUBTRACT, MULTIPLY, and DIVIDE require that the fields operated on (1) have numeric PIC clauses and (2) actually have numeric data when the program is executed.&lt;br /&gt;In all cases, the resultant field must be an identifier or data-name, not a literal.&lt;br /&gt;&lt;br /&gt;ADD statement&lt;br /&gt;The result, or sum, of an ADD operation is always placed in the last field mentioned. The only field that is altered as a result of the ADD operation is this last field, which is the one directly following the word TO.&lt;br /&gt;When using the TO format in an ADD statement, all the data-names and literals are added together, and the result placed in the last field specified.&lt;br /&gt;When using the GIVING format, all fields and literals preceding the word GIVING are added together and the sum is placed in the field following the word GIVING.&lt;br /&gt;&lt;br /&gt;Eg 5.1:&lt;br /&gt;05 EMP-BASIC PIC 9(5) VALUE 4000.&lt;br /&gt;05 EMP-HRA PIC 9(3) VALUE 650.&lt;br /&gt;05 EMP-TOTAL PIC 9(6) VALUE 100.&lt;br /&gt;&lt;br /&gt;a. ADD EMP-BASIC TO EMP-TOTAL.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;EMP-TOTAL = 4100&lt;br /&gt;&lt;br /&gt;b. ADD EMP-BASIC EMP-HRA GIVING EMP-TOTAL.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;EMP-TOTAL = 4650&lt;br /&gt;&lt;br /&gt;SUBTRACT statement&lt;br /&gt;All fields and literals preceding the word FROM will be added together and the sum subtracted from the field following the word FROM. The result, or difference, will be placed in this same field if no GIVING option is used. All other fields will remain unchanged.&lt;br /&gt;&lt;br /&gt;Eg 5.2:&lt;br /&gt;05 EMP-GROSS PIC 9(5) VALUE 4250.&lt;br /&gt;05 EMP-PF PIC 9(3) VALUE 250.&lt;br /&gt;05 EMP-ITAX PIC 9(3) VALUE 100.&lt;br /&gt;05 EMP-NET PIC 9(6) VALUE 100.&lt;br /&gt;&lt;br /&gt;a. SUBTRACT EMP-PF FROM EMP-BASIC.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;EMP-BASIC = 4000&lt;br /&gt;&lt;br /&gt;b. SUBTRACT EMP-PF EMP-ITAX FROM EMP-GROSS.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;EMP-GROSS = 3900&lt;br /&gt;&lt;br /&gt;c. SUBTRACT EMP-PF EMP-ITAX FROM EMP-GROSS GIVING EMP-NET.&lt;br /&gt;&lt;br /&gt;Result :&lt;br /&gt;EMP-GROSS = 4250&lt;br /&gt;EMP-NET = 3900&lt;br /&gt;&lt;br /&gt;MULTIPLY and DIVIDE statements&lt;br /&gt;With each MULTIPLY or DIVIDE statement specified, only two operands can be multiplied or divided. Always make sure the receiving fields is large enough to store the result. The preposition used with the MULTIPLY verb is always BY. In the DIVIDE operation, the preposition is either BY or INTO.&lt;br /&gt;&lt;br /&gt;Eg 5.3:&lt;br /&gt;05 EMP-GROSS PIC 9(5) VALUE 4000.&lt;br /&gt;05 EMP-ANN-SAL PIC 9(5) VALUE ZERO.&lt;br /&gt;05 EMP-NEW-SAL PIC 9(5) .&lt;br /&gt;05 EMP-REM PIC 9(3).&lt;br /&gt;&lt;br /&gt;a. MULTIPLY 12 BY EMP-GROSS.&lt;br /&gt;Result :&lt;br /&gt;EMP-GROSS = 48000&lt;br /&gt;&lt;br /&gt;b. MULTIPLY EMP-GROSS BY 12 GIVING EMP-ANN-SAL.&lt;br /&gt;Result :&lt;br /&gt;EMP-GROSS = 4000&lt;br /&gt;EMP-ANN-SAL=48000&lt;br /&gt;&lt;br /&gt;c. DIVIDE 4 INTO EMP-GROSS.&lt;br /&gt;Result :&lt;br /&gt;EMP-GROSS = 1000&lt;br /&gt;&lt;br /&gt;d. DIVIDE 4 INTO EMP-GROSS GIVING EMP-NEW-SAL.&lt;br /&gt;Result :&lt;br /&gt;EMP-GROSS = 4000&lt;br /&gt;EMP-NEW-SAL = 1000&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;e. DIVIDE EMP-GROSS BY 4 GIVING EMP-NEW-SAL.&lt;br /&gt;Result :&lt;br /&gt;EMP-NEW-SAL = 1000&lt;br /&gt;&lt;br /&gt;Use of the REMAINDER clause in the DIVIDE operation&lt;br /&gt;When performing a division operation, the result will be placed in the receiving field according to the PIC specifications of that field.&lt;br /&gt;&lt;br /&gt;Eg 5.4:&lt;br /&gt;DIVIDE 130 BY 40 GIVING WS-TOTAL.&lt;br /&gt;&lt;br /&gt;After the operation is performed, 03 is placed in WS-TOTAL.&lt;br /&gt;It is sometimes useful to store the remainder of a division operation for additional processing. The DIVIDE can be used for this purpose by including a REMAINDER clause.&lt;br /&gt;&lt;br /&gt;ROUNDED Option&lt;br /&gt;A frequent need exists for rounding numeric values.&lt;br /&gt;&lt;br /&gt;Eg 5.5:&lt;br /&gt;05 AMT1 PIC 99V999 VALUE 12.857.&lt;br /&gt;05 AMT2 PIC 99V999 VALUE 25.142.&lt;br /&gt;05 AMT3 PIC 99V99 VALUE 37.99.&lt;br /&gt;&lt;br /&gt;ADD AMT1 AMT2 GIVING AMT3.&lt;br /&gt;&lt;br /&gt;In the code given above, the result 37.999 is placed in an accumulator. When this value is move to the field AMT3 , the low-order decimal position is truncated and 37.99 is stored in the field. A more desirable result would be 38.00 since 38 is closer to the sum of 37.999. We consider results more accurate if they are rounded to the nearest decimal position.&lt;br /&gt;To obtain rounded results, the ROUNDED option may be specified with any arithmetic statement. In all case, it directly follows the resultant data-name.&lt;br /&gt;&lt;br /&gt;Eg 5.6:&lt;br /&gt;ADD AMT1 AMT2 GIVING AMT3 ROUNDED.&lt;br /&gt;&lt;br /&gt;If the ROUNDED option is not specified, truncation of decimal positions will occur if the resultant field cannot accommodate all the decimal positions in the result. With the ROUNDED option, the computer will always round the result to the PICTURE specification of the receiving field.&lt;br /&gt;&lt;br /&gt;If ROUNDED and REMAINDER are to be used in the same DIVIDE statement, ROUNDED must appear first.&lt;br /&gt;&lt;br /&gt;ON SIZE ERROR&lt;br /&gt;Consider the following :&lt;br /&gt;&lt;br /&gt;Eg 5.7:&lt;br /&gt;05 AMT1 PIC 999 VALUE 800.&lt;br /&gt;05 AMT2 PIC 999 VALUE 150.&lt;br /&gt;05 AMT3 PIC 999 VALUE 050.&lt;br /&gt;&lt;br /&gt;ADD AMT1 AMT2 TO AMT3.&lt;br /&gt;&lt;br /&gt;The effect of the above statement would be the same as coding MOVE 1000 TO AMT3. In this case, the resultant field is not large enough to store the accumulated sum. In other words , an overflow or size error condition has occurred. This will produce erroneous results.&lt;br /&gt;&lt;br /&gt;Eg 5.8:&lt;br /&gt;ADD AMT1 AMT2 TO AMT3&lt;br /&gt;ON SIZE ERROR MOVE ZERO TO TOTAL-OUT.&lt;br /&gt;&lt;br /&gt;In a divide, the size error condition has additional significance. If an attempt is made to divide by zero, a size error condition will occur. This is because division by zero yields a result of infinity which makes it impossible to define a sufficiently large receiving field.&lt;br /&gt;If the ON SIZE ERROR option is employed along with the ROUNDED option, the word ROUNDED always precedes ON SIZE ERROR.&lt;br /&gt;&lt;br /&gt;COMPUTE statement&lt;br /&gt;If complex or extensive arithmetic operations are required in a program, the use of the four arithmetic verbs may prove cumbersome. The COMPUTE verb provides another method of performing arithmetic. The COMPUTE statement uses the following arithmetic symbols :&lt;br /&gt;+ Add&lt;br /&gt;- Subtract&lt;br /&gt;* Multiply&lt;br /&gt;/ Divide&lt;br /&gt;** exponentiation&lt;br /&gt;&lt;br /&gt;Eg 5.9:&lt;br /&gt;COMPUTE TOTAL = AMT1 + AMT2 – AMT3.&lt;br /&gt;&lt;br /&gt;To round the results in a COMPUTE statement to the specifications of the receiving field, use the ROUNDED option directly following the receiving field. If we need to test for a size error condition we may use the ON SIZE ERROR clause as the last one in the statement.&lt;br /&gt;&lt;br /&gt;The sequence in which operations are performed in a COMPUTE statement&lt;br /&gt;**&lt;br /&gt;* or / (whichever appears first from left to right)&lt;br /&gt;+ or - (whichever appears first from left to right)&lt;br /&gt;The use of parentheses overrides rules 1-3. That is, operations with parentheses are performed first.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-4517696885153056586?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rsxkmsrFdPoIiGwPihQBbhdX33g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rsxkmsrFdPoIiGwPihQBbhdX33g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rsxkmsrFdPoIiGwPihQBbhdX33g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rsxkmsrFdPoIiGwPihQBbhdX33g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/G-N8TNIRHQc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/4517696885153056586/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=4517696885153056586" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/4517696885153056586?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/4517696885153056586?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/G-N8TNIRHQc/5-arithmetic-verbs.html" title="5. Arithmetic verbs" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/5-arithmetic-verbs.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUACSXw9cCp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-5628312378279020631</id><published>2010-02-17T16:26:00.000-08:00</published><updated>2010-02-17T16:42:48.268-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:42:48.268-08:00</app:edited><title>6. Decision Making</title><content type="html">A conditional statement is one that performs operations depending on the existence of some condition. In COBOL, such statements generally begin with the word IF and are called IF-THEN-ELSE or selection structures.&lt;br /&gt;An imperative statement , as opposed to a conditional statement, is one that performs an operation regardless of any existing condition.&lt;br /&gt;A condition may test for a specific relation. A simple condition may be a single relational test of the following form :&lt;br /&gt;&lt;br /&gt;Eg 6.1:&lt;br /&gt;IF AMT1 IS EQUAL TO AMT2&lt;br /&gt;DIVIDE QTY INTO TOTAL&lt;br /&gt;ELSE&lt;br /&gt;ADD UNIT-PRICE TO FINAL-TOTAL.&lt;br /&gt;&lt;br /&gt;The following symbols for simple relational conditions are valid within a COBOL statement :&lt;br /&gt;&lt;&gt; IS GREATER THAN&lt;br /&gt;= IS EQUAL TO&lt;br /&gt;&lt;br /&gt;The NEXT SENTENCE or CONTINUE clause&lt;br /&gt;There are times when you might want to execute a series of steps only if a certain condition does not exist. The COBOL expression NEXT SENTENCE will enable you (1) to avoid performing any operation if a condition exists and (2) to execute instructions only if the ELSE condition is met.&lt;br /&gt;&lt;br /&gt;Eg 6.2:&lt;br /&gt;IF AMT1 = AMT2&lt;br /&gt;NEXT SENTENCE&lt;br /&gt;ELSE&lt;br /&gt;ADD 1 TO TOTAL.&lt;br /&gt;&lt;br /&gt;Compound conditional&lt;br /&gt;The compound conditional offers even greater flexibility for selection and enables the IF statement to be used for more complex problems. The compound conditionals are as follows :&lt;br /&gt;&lt;br /&gt;OR&lt;br /&gt;Performs an operation or a series of operations if any one of several conditions exists.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;AND&lt;br /&gt;If a statement or statements are to be executed only when all of several conditions are met.&lt;br /&gt;&lt;br /&gt;Negating conditionals&lt;br /&gt;NOT&lt;br /&gt;All simple relation, class or sign tests may be coded using a negated conditional (NOT).&lt;br /&gt;&lt;br /&gt;Eg 6.3:&lt;br /&gt;IF AMT1 IS NOT EQUAL TO AMT2&lt;br /&gt;PERFORM 200-NOT-EQUAL-RTN.&lt;br /&gt;&lt;br /&gt;Hierarchy rules for compound conditionals&lt;br /&gt;1. NOT is evaluated first.&lt;br /&gt;2. Conditions surrounding the word AND are evaluated first.&lt;br /&gt;3. Conditions surrounding the word OR are evaluated last.&lt;br /&gt;4. When there are several AND or OR connectors, the AND conditions are evaluated first, as they appear in the statement, from left to right. Then the OR conditions are evaluated, also from left to right.&lt;br /&gt;5. To override Rules 1-3, use parentheses around conditions you want to be evaluated first.&lt;br /&gt;&lt;br /&gt;Sign test&lt;br /&gt;We can test whether a field is POSITIVE, NEGATIVE, or ZERO with a sign test.&lt;br /&gt;If a numeric field contains an amount less than zero, it is considered negative. If it has an amount greater than zero, then it is considered positive.&lt;br /&gt;&lt;br /&gt;Eg 6.4:&lt;br /&gt;IF AMT IS POSITIVE&lt;br /&gt;PERFORM 200-CALC-RTN.&lt;br /&gt;&lt;br /&gt;Class test&lt;br /&gt;We can test for the type of data (ALPHABETIC or NUMERIC) using the class test.&lt;br /&gt;&lt;br /&gt;Eg 6.5:&lt;br /&gt;IF AMT-IN IS NUMERIC&lt;br /&gt;PERFORM 300-CALC-RTN.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Condition names&lt;br /&gt;A condition-name is a user-defined word established in the DATA DIVISION that gives a name to a specific value that an identifier can assume. An 88-level coded in the DATA DIVISION is a condition-name that denotes a possible value for an identifier. A condition-name is always coded on the 88 level and has only a VALUE clause associated with it. Since a condition-name is not the name of a field, it will not contain a PICTURE clause.&lt;br /&gt;&lt;br /&gt;Eg 6.6:&lt;br /&gt;05 MARITAL-STATUS PIC X.&lt;br /&gt;88 SINGLE VALUE “S”.&lt;br /&gt;&lt;br /&gt;Either of the following tests may be used in the PROCEDURE DIVISION .&lt;br /&gt;&lt;br /&gt;Eg 6.6a:&lt;br /&gt;IF MARITAL-STATUS = “S”&lt;br /&gt;PERFORM 1000-SINGLE-ROUTINE.&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;Eg 6.6b:&lt;br /&gt;IF SINGLE&lt;br /&gt;PERFORM 1000-SINGLE-ROUTINE.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-5628312378279020631?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/UPPsi0FJImZOif6cfxDtTr2-d_0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UPPsi0FJImZOif6cfxDtTr2-d_0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/UPPsi0FJImZOif6cfxDtTr2-d_0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UPPsi0FJImZOif6cfxDtTr2-d_0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/3_sSVpmmGaE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/5628312378279020631/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=5628312378279020631" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/5628312378279020631?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/5628312378279020631?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/3_sSVpmmGaE/6-decision-making.html" title="6. Decision Making" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/6-decision-making.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUADSHs-fSp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-3727754907170142205</id><published>2010-02-17T16:25:00.000-08:00</published><updated>2010-02-17T16:42:59.555-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:42:59.555-08:00</app:edited><title>7. Iterations</title><content type="html">PERFORM statement&lt;br /&gt;The simple PERFORM statement, is used to execute a specified routine from one or more points in a program.&lt;br /&gt;&lt;br /&gt;The PERFORM statement will :&lt;br /&gt;1. Execute all instructions in the named paragraph.&lt;br /&gt;2. Transfer control to the next instruction in sequence, after the PERFORM.&lt;br /&gt;&lt;br /&gt;Eg 7.1:&lt;br /&gt;PROCEDURE DIVISION.&lt;br /&gt;100-MAIN-MODULE.&lt;br /&gt;:&lt;br /&gt;PERFORM 400-HEADING-RTN.&lt;br /&gt;:&lt;br /&gt;200-CALC-RTN.&lt;br /&gt;:&lt;br /&gt;:&lt;br /&gt;400-HEADING-RTN.&lt;br /&gt;:&lt;br /&gt;:&lt;br /&gt;&lt;br /&gt;PERFORM..THRU&lt;br /&gt;The PERFORM executes all statement beginning at pargraph-name-1 until the end of paragraph-name-2 is reached. Control is then transferred to the statement directly following the PERFORM.&lt;br /&gt;&lt;br /&gt;Eg 7.2:&lt;br /&gt;100-MAIN.&lt;br /&gt;PERFORM 300-PARA THRU 500-PARA.&lt;br /&gt;:&lt;br /&gt;200-PARA.&lt;br /&gt;:&lt;br /&gt;300-PARA.&lt;br /&gt;:&lt;br /&gt;400-PARA.&lt;br /&gt;:&lt;br /&gt;500-PARA.&lt;br /&gt;EXIT.&lt;br /&gt;600-PARA.&lt;br /&gt;:&lt;br /&gt;&lt;br /&gt;The EXIT statement&lt;br /&gt;EXIT is a COBOL reserved word that performs no operation. It is used to allow execution to pass over other statements or to transfer control back to the statement following the original PERFORM. It is used, when necessary, as an end point in a paragraph.&lt;br /&gt;&lt;br /&gt;PERFORM..UNTIL&lt;br /&gt;Iteration may be performed in COBOL using a PERFORM..UNTIL statement. The contents of the identifiers used in the UNTIL clause should be changed within the paragraph(s) being performed. The condition in a PERFORM .. UNTIL is tested before the named paragraph is executed even once. If the condition indicated in the UNTIL clause is met at the time of execution, then the name paragraph(s) will not be executed.&lt;br /&gt;&lt;br /&gt;Procedure used in Looping&lt;br /&gt;Paragraph containing the PERFORM that “Loops”&lt;br /&gt;1. Initialize the field to be tested (e.g., MOVE 0 TO COUNTER1).&lt;br /&gt;2. Code a PERFORM..UNTIL using a separate paragraph. For example, PERFORM UNTIL COUNTER1 = 5.&lt;br /&gt;&lt;br /&gt;Loop to be performed&lt;br /&gt;1. Code the steps required in the loop as a separated paragraph.&lt;br /&gt;2. Increase or decrease the value in the field to be tested (e.g., ADD 1 TO COUNTER1).&lt;br /&gt;&lt;br /&gt;Eg 7.3:&lt;br /&gt;* This program displays Hello 3 times.&lt;br /&gt;MOVE 1 TO COUNTER1.&lt;br /&gt;PERFORM 200-DISP-RTN UNTIL COUNTER1 = 4.&lt;br /&gt;:&lt;br /&gt;STOP RUN.&lt;br /&gt;200-DISP-RTN.&lt;br /&gt;DISPLAY “HELLO”.&lt;br /&gt;ADD 1 TO COUNTER1.&lt;br /&gt;&lt;br /&gt;PERFORM..TIMES&lt;br /&gt;The PERFORM..TIMES construct is used to execute a sequence of steps a fixed number of times. It is not necessary to establish a counter that must be incremented each time through the loop. When using the TIMES format (PERFORM paragraph-name-1 identifier-1 TIMES) : (1) the identifier must be specified in the DATA DIVISION; (2) it must have a numeric PICTURE clause; and (3) it must contain only integers or zeros.&lt;br /&gt;&lt;br /&gt;Eg 7.4:&lt;br /&gt;* This program displays the Hello 3 times.&lt;br /&gt;MOVE 3 TO COUNTER1.&lt;br /&gt;PERFORM 200-DISP-RTN COUNTER1 TIMES.&lt;br /&gt;:&lt;br /&gt;STOP RUN.&lt;br /&gt;200-DISP-RTN.&lt;br /&gt;DISPLAY “HELLO”.&lt;br /&gt;&lt;br /&gt;GO TO&lt;br /&gt;A GO TO permanently transfers control to another paragraph. It does not return control to the paragraph from where it was issued.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-3727754907170142205?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/AgUtQ8E5wDHGSzDI50vVpjy4CYE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AgUtQ8E5wDHGSzDI50vVpjy4CYE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/AgUtQ8E5wDHGSzDI50vVpjy4CYE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AgUtQ8E5wDHGSzDI50vVpjy4CYE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/rkXmEi9t-II" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/3727754907170142205/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=3727754907170142205" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/3727754907170142205?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/3727754907170142205?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/rkXmEi9t-II/7-iterations.html" title="7. Iterations" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/7-iterations.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUANQnk_eSp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-568157697153329349</id><published>2010-02-17T16:24:00.000-08:00</published><updated>2010-02-17T16:43:13.741-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:43:13.741-08:00</app:edited><title>8. File Handling</title><content type="html">File Organization methods&lt;br /&gt;It is important that file be so organized that efficient processing can be accomplished by matching the file data characteristics, processing method and file organization. Basically, three methods of file organization are available on disk systems: sequential, indexed sequential, and relative file organization.&lt;br /&gt;&lt;br /&gt;Sequential file organization&lt;br /&gt;Sequential file organization indicates that the records in the file are positioned in a sequential order, such as according to part number.&lt;br /&gt;&lt;br /&gt;Indexed sequential file organization&lt;br /&gt;Indexed sequential file organization is one in which the records are filed sequentially, but a table (index is available which identifies the location of groups of records, thereby reducing access time.&lt;br /&gt;&lt;br /&gt;Relative file organization&lt;br /&gt;Relative file organization is such that the logical order and physical order of the records do not necessarily correspond with one another. For such a file, a technique, or rule, is required to determine the location of the record in the disk system.&lt;br /&gt;&lt;br /&gt;This chapter shows you how to process sequential files in COBOL.&lt;br /&gt;&lt;br /&gt;Any program that (1) reads data from input files or (2) produces output files, requires an INPUT-OUTPUT SECTION and a FILE SECTION to describe the input and output areas.&lt;br /&gt;&lt;br /&gt;INPUT-OUTPUT SECTION&lt;br /&gt;The INPUT-OUTPUT SECTION of the ENVIRONMENT DIVISION follows the CONFIGURATION SECTION and supplies information concerning the input and output devices used in the program. In the FILE-CONTROL paragraph, a file-name is selected for each file to be used in the program; in addition, each file-name selected is assigned to a device. The SELECT statement is coded in Area B.&lt;br /&gt;&lt;br /&gt;Eg 8.1:&lt;br /&gt;ENVIRONMENT DIVISION.&lt;br /&gt;:&lt;br /&gt;INPUT-OUTPUT SECTION.&lt;br /&gt;FILE-CONTROL.&lt;br /&gt;SELECT EMPLOYEE-FILE&lt;br /&gt;ASSIGN TO “EMP.DAT”&lt;br /&gt;ORGANIZATION IS LINE SEQUENTIAL.&lt;br /&gt;&lt;br /&gt;FILE SECTION.&lt;br /&gt;Each file is described in the FILE SECTION with an FD sentence that may consist of a series of clauses. After the clauses are specified, the FD sentence ends with a period. FD is an abbreviation for File Description. Each FD entry will describe a file defined in a SELECT statement in the ENVIRONMENT DIVISION.&lt;br /&gt;The two entries, DATA DIVISION and FILE SECTION, are coded in Area A. FD is also coded in Area A. The file-name, however, is typically coded in Area B.&lt;br /&gt;&lt;br /&gt;Eg 8.2:&lt;br /&gt;DATA DIVISION.&lt;br /&gt;FILE SECTION.&lt;br /&gt;FD EMPLOYEE-FILE&lt;br /&gt;LABEL RECORDS ARE STANDARD&lt;br /&gt;RECORD CONTAINS 70 CHARACTERS&lt;br /&gt;BLOCK CONTAINS 10 RECORDS.&lt;br /&gt;&lt;br /&gt;Label Records&lt;br /&gt;Label records are usually created as the first and last records of a disk or tape to provide identifying information about the file on disk or tape. Labels are created on output files so that, when the same file is later read as input, the labels may be checked to ensure that the file being accessed is the correct one. Labels are created on output files and checked on input files. The COBOL compiler will supply the routine for writing labels on output files or for checking labels on input file if the entry LABEL RECORDS ARE STANDARD is included.&lt;br /&gt;&lt;br /&gt;This LABEL RECORDS clause will result in the following :&lt;br /&gt;For output files, the first record on disk or tape file will be created as a standard 80-position header label identifying the file to the system; similarly, the last record on the disk or tape will be created as a trailer label.&lt;br /&gt;For input files, these labels will be computer-checked to ensure that the file being processed is the correct one.&lt;br /&gt;&lt;br /&gt;The clause LABEL RECORDS ARE STANDARD is permitted for disk and tape files only. Devices such as printers do not use label records, since identifying information is unnecessary where data is visible to the human eye. The clause LABEL RECORDS ARE OMITTED is used for such files.&lt;br /&gt;&lt;br /&gt;RECORD CONTAINS clause&lt;br /&gt;The RECORD CONTAINS clause indicates the size of each record. For printer files the RECORD CONTAINS clause may include one extra position that is used to control the spacing of the form (e.g., single spacing, double spacing). Thus, for 132 character printers, a record size is sometimes set as 133 characters. In such cases, the first or leftmost position in these 133-position print records is the form control position; it is not actually printed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;BLOCK CONTAINS clause&lt;br /&gt;The BLOCK CONTAINS clause is included in the File Description entry only for files in which disk or tape records have been blocked. Blocking is a technique that increases the speed of input/output operations and makes more effective use of storage space on disk and tape. A group of logical records is included within one block to maximize the efficient use of a disk or tape area. For example, reading in a block of 10 disk records, is more efficient than reading in each disk record separately. Even if blocking is used, the program processes records in the standard way, that is, one logical record at a time.&lt;br /&gt;&lt;br /&gt;Record Description entries&lt;br /&gt;A record is a unit of information consisting or related data items within a file. Most often, a file consists of records that all have the same length and format. These are called fixed-length records.&lt;br /&gt;For each file defined, we have one record format.&lt;br /&gt;&lt;br /&gt;Eg 8.3:&lt;br /&gt;01 EMPLOYEE-REC.&lt;br /&gt;05 EMP-NAME.&lt;br /&gt;10 EMP-FIRST-NAME PIC X(10).&lt;br /&gt;10 EMP-LAST-NAME PIC X(15).&lt;br /&gt;05 EMP-DEPT PIC X(4).&lt;br /&gt;05 EMP-SALARY PIC 9(5)V99.&lt;br /&gt;05 EMP-DOJ PIC 9(6).&lt;br /&gt;&lt;br /&gt;Input/output verbs&lt;br /&gt;There are 4 input/output verbs : OPEN, READ, WRITE, CLOSE.&lt;br /&gt;&lt;br /&gt;OPEN statement&lt;br /&gt;Before an input or an output file can be used by the program it must be opened. An OPEN statement, designates files as either input or output. It also accesses the specific devices, and makes the files available for processing. It performs header label routines if label records are STANDARD. The OPEN statement checks the header label to determine if the correct file has been accessed.&lt;br /&gt;&lt;br /&gt;Eg 8.4:&lt;br /&gt;OPEN INPUT EMPLOYEE-FILE.&lt;br /&gt;OPEN OUTPUT REPORT-FILE.&lt;br /&gt;&lt;br /&gt;The order in which files are opened is not significant. The only restriction is that a file must be opened before it may be read or written; a file must be accessed before it may be processed. Since the OPEN statement accesses the files, it is generally on of the first instructions coded in the PROCEDURE DIVISION.&lt;br /&gt;&lt;br /&gt;READ statement&lt;br /&gt;After an input file has been opened, it may be read. A READ statement transmits data from the input device, assigned in the ENVIRONMENT DIVISION, to the input storage area, defined in the FILE SECTION of the DATA DIVISION.&lt;br /&gt;The primary function of the READ statement is to transmit one data record to the input area reserved for that file. That is, each time a READ statement is executed, one record is read into primary storage.&lt;br /&gt;The READ statement has, however, several other functions. Like the OPEN statement, it performs certain checks. It checks the length of each input record to ensure that it corresponds to the length specified in a RECORD CONTAINS clause in the data DIVISION. If a discrepancy exists, an error message prints, and a program interrupt occurs.&lt;br /&gt;The READ statement will also use the BLOCK CONTAINS clause, if specified, to perform a check on the blocking factor.&lt;br /&gt;The AT END clause in the READ statement tests to determine if there is any more input. An AT END clause of the READ statement tells the computer what to do if there is no more data to be read.&lt;br /&gt;&lt;br /&gt;Eg 8.5:&lt;br /&gt;READ EMPLOYEE-FILE&lt;br /&gt;AT END&lt;br /&gt;MOVE “YES” TO END-OF-FILE.&lt;br /&gt;&lt;br /&gt;WRITE statement&lt;br /&gt;The WRITE instruction takes data in the output area defined in the DATA DIVISION and transmits it to the device specified in the ENVIRONMENT DIVISION.&lt;br /&gt;Note that although files are read, we write records. The record-name appear on the 01 level and is generally subdivided into fields. The record description specifies the format of the output.&lt;br /&gt;&lt;br /&gt;Eg 8.6:&lt;br /&gt;WRITE EMPLOYEE-REC.&lt;br /&gt;&lt;br /&gt;CLOSE statement&lt;br /&gt;A CLOSE statement is coded at the end of the job after all records have been processed to release these files and deactivate the devices. All files that have been opened at the beginning of the program are closed at the end of a program. The CLOSE statement, like the OPEN, will perform additional functions. When creating disk or tape records, for example, the CLOSE will create trailer labels; it will also rewind a tape.&lt;br /&gt;&lt;br /&gt;Eg 8.7:&lt;br /&gt;CLOSE EMPLOYEE-FILE.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;COPY statement&lt;br /&gt;A COPY statement is used to bring into a program a series of prewritten COBOL entries that have been stored in a library. Copying entries from a library, rather than coding them, has the following benefits : (1) it could save a programmer a considerable amount of coding and debugging time; (2) it promotes program standardization since all programs that copy entries from a library will be using common data-names and/or procedures; (3) it reduces the time it takes to make modifications and reduces duplication of effort; if a change needs to be made to a data entry, it can be made just once in the library without the need to alter individual programs; and (4) library entries are extensively annotated so that they are meaningful to all users; this annotation results in better-documented programs and systems.&lt;br /&gt;Most often, the COPY statement is used to copy FD and 01 entries that define and describe files and records. In addition, standard modules to be used in the PROCEDURE DIVISION of several programs may also be stored in a library and copied as needed.&lt;br /&gt;&lt;br /&gt;Contents of EMP.REC&lt;br /&gt;Eg 8.8a:&lt;br /&gt;01 EMPLOYEE-REC.&lt;br /&gt;05 EMP-NAME.&lt;br /&gt;10 EMP-FIRST-NAME PIC X(10).&lt;br /&gt;10 EMP-LAST-NAME PIC X(15).&lt;br /&gt;05 EMP-DEPT PIC X(4).&lt;br /&gt;05 EMP-SALARY PIC 9(5)V99.&lt;br /&gt;05 EMP-DOJ PIC 9(6).&lt;br /&gt;&lt;br /&gt;The DATA DIVISION entry using a COPY statement&lt;br /&gt;Eg 8.8b:&lt;br /&gt;DATA DIVISION.&lt;br /&gt;FILE SECTION.&lt;br /&gt;FD EMPLOYEE-FILE&lt;br /&gt;LABEL RECORDS ARE STANDARD&lt;br /&gt;RECORD CONTAINS 70 CHARACTERS&lt;br /&gt;BLOCK CONTAINS 10 RECORDS.&lt;br /&gt;COPY “EMP.REC”.&lt;br /&gt;&lt;br /&gt;A program to create the employee file.&lt;br /&gt;&lt;br /&gt;Eg 8.9:&lt;br /&gt;IDENTIFICATION DIVISION.&lt;br /&gt;PROGRAM-ID. FILE-CRT.&lt;br /&gt;* This program creates a sequential EMPLOYEE file.&lt;br /&gt;&lt;br /&gt;ENVIRONMENT DIVISION.&lt;br /&gt;INPUT-OUTPUT SECTION.&lt;br /&gt;FILE-CONTROL.&lt;br /&gt;SELECT EMPLOYEE-FILE ASSIGN TO "EMP.DAT"&lt;br /&gt;ORGANIZATION IS LINE SEQUENTIAL.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;DATA DIVISION.&lt;br /&gt;FILE SECTION.&lt;br /&gt;FD EMPLOYEE-FILE&lt;br /&gt;LABEL RECORDS STANDARD.&lt;br /&gt;01 EMPLOYEE-REC.&lt;br /&gt;05 EMP-NO PIC 9(4).&lt;br /&gt;05 EMP-NAME.&lt;br /&gt;10 EMP-FIRST-NAME PIC X(10).&lt;br /&gt;10 EMP-LAST-NAME PIC X(15).&lt;br /&gt;05 EMP-DEPT PIC X(4).&lt;br /&gt;05 EMP-SALARY PIC 9(5)V99.&lt;br /&gt;05 EMP-DOJ PIC 9(6).&lt;br /&gt;&lt;br /&gt;WORKING-STORAGE SECTION.&lt;br /&gt;01 WS-ANS PIC X(01) VALUE "Y".&lt;br /&gt;88 ANS-NO VALUE "N" "n".&lt;br /&gt;&lt;br /&gt;PROCEDURE DIVISION.&lt;br /&gt;0000-MAIN.&lt;br /&gt;OPEN OUTPUT EMPLOYEE-FILE.&lt;br /&gt;PERFORM 1000-ACPT-PARA UNTIL ANS-NO.&lt;br /&gt;CLOSE EMPLOYEE-FILE.&lt;br /&gt;STOP RUN.&lt;br /&gt;&lt;br /&gt;1000-ACPT-PARA.&lt;br /&gt;DISPLAY "ENTER YOUR EMP CODE : " WITH NO ADVANCING.&lt;br /&gt;ACCEPT EMP-NO.&lt;br /&gt;DISPLAY "ENTER YOUR FIRST NAME : " WITH NO ADVANCING.&lt;br /&gt;ACCEPT EMP-FIRST-NAME.&lt;br /&gt;DISPLAY "ENTER YOUR LAST NAME : " WITH NO ADVANCING.&lt;br /&gt;ACCEPT EMP-LAST-NAME.&lt;br /&gt;DISPLAY "ENTER YOUR DEPARTMENT : " WITH NO ADVANCING.&lt;br /&gt;ACCEPT EMP-DEPT.&lt;br /&gt;DISPLAY "ENTER YOUR SALARY : " WITH NO ADVANCING.&lt;br /&gt;ACCEPT EMP-SALARY.&lt;br /&gt;DISPLAY "ENTER YOUR DATE OF JOINING : " WITH NO ADVANCING.&lt;br /&gt;ACCEPT EMP-DOJ.&lt;br /&gt;WRITE EMPLOYEE-REC.&lt;br /&gt;DISPLAY "DO YOU WANT TO ADD MORE RECORDS : "&lt;br /&gt;WITH NO ADVANCING.&lt;br /&gt;ACCEPT WS-ANS.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-568157697153329349?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/kg14efRBBGyaEbH5L8GFGhsu6kQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kg14efRBBGyaEbH5L8GFGhsu6kQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/kg14efRBBGyaEbH5L8GFGhsu6kQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kg14efRBBGyaEbH5L8GFGhsu6kQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/W6BXGsBXvD0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/568157697153329349/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=568157697153329349" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/568157697153329349?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/568157697153329349?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/W6BXGsBXvD0/8-file-handling.html" title="8. File Handling" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/8-file-handling.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8ER386fip7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-4022647261715134965</id><published>2010-02-17T16:22:00.002-08:00</published><updated>2010-02-17T16:43:26.116-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:43:26.116-08:00</app:edited><title>9. Sorting and merging files</title><content type="html">Sorting&lt;br /&gt;Records in files frequently must be sorted into specific sequences for updating, answering inquiries, or generating reports. Sorting is a common procedure used for arranging records into a specific order so that sequential processing can be performed.&lt;br /&gt;COBOL has a SORT verb, which can make it very useful as part of a COBOL program.&lt;br /&gt;The programmer must specify whether the key field is to be an ASCENDING KEY or a DESCENDING KEY, depending on which sequence is required :&lt;br /&gt;ASCENDING : From lowest to highest&lt;br /&gt;DESCENDING : From highest to lowest&lt;br /&gt;The SORT verb may be used to sequence records with more than one key field. For example, to sort an employee file so that it is in alphabetic sequence by name within each department.&lt;br /&gt;&lt;br /&gt;Eg 9.1:&lt;br /&gt;SORT SORT-FILE&lt;br /&gt;ON ASCENDING KEY S-EMP-DEPT&lt;br /&gt;ON ASCENDING KEY S-EMP-NAME&lt;br /&gt;USING EMPLOYEE-FILE&lt;br /&gt;GIVING SORT-EMPLOYEE-FILE.&lt;br /&gt;&lt;br /&gt;There are three major files used in a sort :&lt;br /&gt;Input file : File of unsorted input records.&lt;br /&gt;Work or sort file : File used to store records temporarily during the sorting process.&lt;br /&gt;Output file: File of sorted output records.&lt;br /&gt;&lt;br /&gt;All these files would be defined in the ENVIRONMENT DIVISION using standard ASSIGN clauses, which are system dependent. The SORT-FILE is actually assigned to a temporary work area that is used during processing but not saved. Only the unsorted disk file and the sorted output disk file are assigned standard file-names so that they can be permanently stored.&lt;br /&gt;FDs are used in the DATA DIVISION to define and describe the input and output files in the usual way. The sort or work file is described with an SD (sort file description) entry. The only difference between SD and FD entries is that an SD must not have a LABEL RECORDS clause. Note, too, that the field(s) specified as the KEY field(s) for sorting purposes must be defined as part of the sort record format.&lt;br /&gt;&lt;br /&gt;Eg 9.2:&lt;br /&gt;ENVIRONMENT DIVISION.&lt;br /&gt;:&lt;br /&gt;INPUT-OUTPUT SECTION.&lt;br /&gt;FILE-CONTROL.&lt;br /&gt;SELECT SORT-FILE&lt;br /&gt;ASSIGN TO DISK.&lt;br /&gt;:&lt;br /&gt;DATA DIVISION.&lt;br /&gt;FILE SECTION.&lt;br /&gt;SD SORT-FILE.&lt;br /&gt;01 SORT-REC.&lt;br /&gt;05 S-EMP-NAME.&lt;br /&gt;10 S-EMP-FIRST-NAME PIC X(10).&lt;br /&gt;10 S-EMP-LAST-NAME PIC X(15).&lt;br /&gt;05 S-EMP-DEPT PIC X(4).&lt;br /&gt;05 FILLER PIC 9(13).&lt;br /&gt;&lt;br /&gt;The SORT statement can, however, be used in conjunction with procedures that process records just before they are sorted and/or process records after they are sorted.&lt;br /&gt;&lt;br /&gt;INPUT PROCEDURE&lt;br /&gt;The INPUT PROCEDURE processes data from the incoming file prior to sorting. An INPUT PROCEDURE may be used to perform the following operations prior to sorting : (1) validate data in the input records, (2) eliminate records with blank fields, (3) count input records.&lt;br /&gt;&lt;br /&gt;With COBOL 74, the procedure-name of an INPUT PROCEDURE must be a section-name and not a paragraph-name. A section is a series of PROCEDURE DIVISION paragraphs that is treated as a single entry or unit. Rule for forming section-names are the same as rules for forming paragraph-names. The word SECTION, however, follows a section-name (e.g., A000-ERROR SECTION). The end of a section is recognized when another section-name is encountered, or when the end of the program is reached.&lt;br /&gt;&lt;br /&gt;Code for an INPUT PROCEDURE&lt;br /&gt;Eg 9.3:&lt;br /&gt;SORT SORT-FILE&lt;br /&gt;ON ASCENDING KEY S-EMP-DEPT&lt;br /&gt;ON ASCENDING KEY S-EMP-NAME&lt;br /&gt;INPUT PROCEDURE A000-TEST-IT&lt;br /&gt;GIVING SORT-EMPLOYEE-FILE.&lt;br /&gt;STOP RUN&lt;br /&gt;A000-TEST-IT SECTION.&lt;br /&gt;A100-PARA-1.&lt;br /&gt;OPEN INPUT IN-FILE.&lt;br /&gt;READ IN-FILE&lt;br /&gt;AT END MOVE “NO” TO ARE-THERE-MORE RECORDS.&lt;br /&gt;PERFORM A200-TEST-RTN&lt;br /&gt;UNTIL THERE-ARE-NO-MORE-RECORDS.&lt;br /&gt;CLOSE IN-FILE.&lt;br /&gt;GO TO A300-TEST-IT-EXIT.&lt;br /&gt;A200-TEST-RTN.&lt;br /&gt;IF QTY = ZEROS&lt;br /&gt;NEXT SENTENCE&lt;br /&gt;ELSE&lt;br /&gt;MOVE IN-REC TO SORT-REC&lt;br /&gt;RELEASE SORT-REC.&lt;br /&gt;READ IN-FILE&lt;br /&gt;AT END MOVE “NO” TO ARE-THERE-MORE RECORDS.&lt;br /&gt;A300-TEST-IT-EXIT.&lt;br /&gt;EXIT.&lt;br /&gt;&lt;br /&gt;Explanation&lt;br /&gt;The first section in the PROCEDURE DIVISION contains the SORT instruction, any processing to be performed before or after the SORT verb is executed, and a STOP RUN.&lt;br /&gt;The second section begins with the main module of the INPUT PROCEDURE. It opens the input file, reads the first record, and then performs a process routine (in a separate paragraph within this second section) until there is no more data.&lt;br /&gt;After the separate paragraph is executed until ARE-THER-MORE-RECORDS = “NO”, control returns to the main module of the second section to be terminated, control must pass to the last statement within the section. This means that a GO TO is required. We code GO TO A300-TEST-IT-EXIT as the last sentence. Since no operations are required in this last paragraph, EXIT is coded, which passes control back to the SORT statement, where the file is then sorted.&lt;br /&gt;&lt;br /&gt;OUTPUT PROCEDURE&lt;br /&gt;The OUTPUT PROCEDURE is used to process the sorted records prior to, or perhaps even instead of, placing them in the output file. The OUTPUT PROCEDURE can be used instead of the GIVING option. The OUTPUT PROCEDURE is similar to the INPUT PROCEDURE. When the INPUT PROCEDURE is complete, the file is then sorted. An OUTPUT PROCEDURE processes all sorted records in the sort file and handles the transfer of these records to the output file.&lt;br /&gt;In an INPUT PROCEDURE we RELEASE records to a sort file rather than writing them. In an INPUT PROCEDURE we RETURN records from the sort file rather than reading them.&lt;br /&gt;&lt;br /&gt;Merging&lt;br /&gt;The MERGE statement combines two or more files into a single file. Its format is similar to the SORT. The file to be merged is a work file designated as an SD. At least two file-names must be included for a merge, but more than two are permitted. Unlike, the SORT, however, an INPUT PROCEDURE may not be specified with the MERGE statement. That is, using the MERGE statement, you may only process records after they have been merged, not before. The OUTPUT PROCEDURE has the same format as with the SORT.&lt;br /&gt;&lt;br /&gt;Eg 9.4:&lt;br /&gt;MERGE MERGE-FILE&lt;br /&gt;ON ASCENDING KEY M-EMP-DEPT&lt;br /&gt;USING OLD-PAYROLL&lt;br /&gt;NEW-PAYROLL&lt;br /&gt;GIVING EMPLOYEE-FILE.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-4022647261715134965?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/DRKYF0BV_uTo49iYSFhk2KBA9Xg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DRKYF0BV_uTo49iYSFhk2KBA9Xg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/DRKYF0BV_uTo49iYSFhk2KBA9Xg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DRKYF0BV_uTo49iYSFhk2KBA9Xg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/dBFDoOIHu_Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/4022647261715134965/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=4022647261715134965" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/4022647261715134965?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/4022647261715134965?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/dBFDoOIHu_Y/9-sorting-and-merging-files.html" title="9. Sorting and merging files" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/9-sorting-and-merging-files.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8FR3kyfCp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-8011274046176889339</id><published>2010-02-17T16:22:00.001-08:00</published><updated>2010-02-17T16:43:36.794-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:43:36.794-08:00</app:edited><title>10. Trapping Runtime errors</title><content type="html">The FILE clause&lt;br /&gt;The clause can be used with the SELECT statement to determine the exact type of input or output error that has occurred when either reading from or writing to a file. The SELECT statement could include FILE STATUS as its last clause. The data name specified with the FILE STATUS clause must appear in the WORKING-STORAGE as a two-position alphanumeric field.&lt;br /&gt;&lt;br /&gt;Eg 10.1:&lt;br /&gt;SELECT EMPLOYEE-FILE&lt;br /&gt;ASSIGN TO “EMP.DAT”&lt;br /&gt;ORGANIZATION IS LINE SEQUENTIAL&lt;br /&gt;FILE STATUS IS WS-STATUS.&lt;br /&gt;:&lt;br /&gt;WORKING-STORAGE SECTION.&lt;br /&gt;01 WS-STATUS PIC X(2).&lt;br /&gt;&lt;br /&gt;The possible values that may be placed in the FILE STATUS field when an input or output operation is performed are listed in Appendix – E.&lt;br /&gt;&lt;br /&gt;OPEN INPUT EMPLOYEE-FILE.&lt;br /&gt;IF WS-STATUS NOT = “00”&lt;br /&gt;DISPLAY “ERROR OPENING EMPLOYEE FILE”&lt;br /&gt;STOP RUN.&lt;br /&gt;READ EMPLOYEE-FILE ….&lt;br /&gt;:&lt;br /&gt;:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-8011274046176889339?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lP6VO6n6pPplZU4lG3VnQ_6nHdM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lP6VO6n6pPplZU4lG3VnQ_6nHdM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lP6VO6n6pPplZU4lG3VnQ_6nHdM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lP6VO6n6pPplZU4lG3VnQ_6nHdM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/EX-lrhvTWOg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/8011274046176889339/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=8011274046176889339" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/8011274046176889339?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/8011274046176889339?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/EX-lrhvTWOg/10-trapping-runtime-errors.html" title="10. Trapping Runtime errors" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/10-trapping-runtime-errors.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8GRnY9cCp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-7236792242527152071</id><published>2010-02-17T16:20:00.000-08:00</published><updated>2010-02-17T16:43:47.868-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:43:47.868-08:00</app:edited><title>11. CONTROL BREAK PROCESSING</title><content type="html">What is a control break procedure ?&lt;br /&gt;A control break procedure is used if records are in sequence by a control field and the number of records in each control field is variable.&lt;br /&gt;&lt;br /&gt;Steps for a Control Break&lt;br /&gt;1. Read the initial record.&lt;br /&gt;Move the control field to a hold area in WORKING-AREA.&lt;br /&gt;As long as the control field is equal to the hold area, execute the detail routine for the input record. This means : Add the appropriate amount to a control total, print the detail record and read the next record.&lt;br /&gt;If the control field is not equal to the hold area :&lt;br /&gt;Print the control total.&lt;br /&gt;Initialize the control total field to zero.&lt;br /&gt;Reinitialize the hold field with the new control field value if there are more records.&lt;br /&gt;Process the detail record as in step 3.&lt;br /&gt;Print headings on a new page if each control total is to appear on a separate page.&lt;br /&gt;If required, after all records have been processed perform a control break to print the last control group.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-7236792242527152071?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/zUXoAFfP3nIJa7yTEcL88cH2Hmo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zUXoAFfP3nIJa7yTEcL88cH2Hmo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/zUXoAFfP3nIJa7yTEcL88cH2Hmo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zUXoAFfP3nIJa7yTEcL88cH2Hmo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/MQBy2CrLcZo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/7236792242527152071/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=7236792242527152071" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7236792242527152071?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7236792242527152071?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/MQBy2CrLcZo/11-control-break-processing.html" title="11. CONTROL BREAK PROCESSING" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/11-control-break-processing.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8BQHgycCp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-4215646348722655862</id><published>2010-02-17T16:17:00.000-08:00</published><updated>2010-02-17T16:44:11.698-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:44:11.698-08:00</app:edited><title>12. Indexed Files</title><content type="html">An indexed file is really two files – the data file, which is created in sequence but can be accessed randomly, and the index file, which contains the value of each key field and the disk address of the record with that corresponding key field. To access an indexed record randomly, the key field is looked up in the index file to find the disk address of the record; then the record is accessed in the indexed data file directly.&lt;br /&gt;&lt;br /&gt;The index on a disk is similar to a book’s index, which has unique subjects (keys) and their corresponding page numbers (addresses). There would be two ways to find a topic in the book. You can read the book sequentially, from the beginning, until that topic is found, but this would be very time consuming and inefficient. The best method would be to look up the topic in the index, find the corresponding page number, and go directly to that page. This is precisely how records can be accessed on a disk file that has an index.&lt;br /&gt;&lt;br /&gt;With an indexed file, records can be accessed either sequentially or randomly, depending on the user’s needs. The term random access implies that records are to be processed or accessed in some order other than the one in which they were physically written on the disk.&lt;br /&gt;&lt;br /&gt;Creating an Indexed File&lt;br /&gt;Indexed files are created in sequence; that is, reading each record from an input file, in sequence by the key field, creates the indexed file and writing the output indexed disk records in the same sequence. Note, however, once the indexed file is created, it can be accessed randomly.&lt;br /&gt;&lt;br /&gt;The ORGANIZATION clause&lt;br /&gt;The clause ORGANIZATION IS INDEXED indicates that the file is to be created with an index.&lt;br /&gt;&lt;br /&gt;The ACCESS clause&lt;br /&gt;Since indexed files may be accessed either sequentially or randomly, the ACCESS clause is used to denote which method will be used in the specific program. If the ACCESS clause is omitted, the compiler will assume that the file is being processed in SEQUENTIAL mode.&lt;br /&gt;&lt;br /&gt;The RECORD KEY clause&lt;br /&gt;The RECORD KEY clause names the key field within the disk record that will be used to form the index. This field must be in the same physical location in each index record. Usually, it is the first field. It must have a unique value for each record.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Eg 12.1:&lt;br /&gt;ENVIRONMENT DIVISION.&lt;br /&gt;INPUT-OUTPUT SECTION.&lt;br /&gt;FILE-CONTROL.&lt;br /&gt;SELECT IND-EMP-FILE&lt;br /&gt;ASSIGN TO “INDEMP.DAT”&lt;br /&gt;ORGANIZATION IS INDEXED&lt;br /&gt;ACCESS IS SEQUENTIAL&lt;br /&gt;RECORD KEY IS I-EMP-NO.&lt;br /&gt;DATA DIVISION.&lt;br /&gt;FILE SECTION.&lt;br /&gt;FD IND-EMP-FILE&lt;br /&gt;LABEL RECORDS STANDARD.&lt;br /&gt;01 IND-EMP-REC.&lt;br /&gt;05 I-EMP-NO PIC 9(4).&lt;br /&gt;05 I-EMP-NAME PIC X(25).&lt;br /&gt;05 I-EMP-DEPT PIC X(4).&lt;br /&gt;05 I-EMP-SAL PIC 9(5)V99.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The INVALID KEY clause&lt;br /&gt;With WRITE&lt;br /&gt;The INVALID KEY clause is used with a WRITE instruction to test for two possible errors: (1) a key field that is not in sequence or (2) a key field that is the same as one already on the indexed file. If any of these conditions exist, we call this an INVALID KEY condition. The computer checks for an INVALID KEY prior to writing the record.&lt;br /&gt;Thus, if you use an INVALID KEY clause with the WRITE statement and a record has an erroneous key, the record is not written and the statement(s) following INVALID KEY would be executed.&lt;br /&gt;&lt;br /&gt;Eg 12.2:&lt;br /&gt;WRITE IND-EMP-REC&lt;br /&gt;INVALID KEY&lt;br /&gt;PERFORM 2000-ERROR-PARA.&lt;br /&gt;&lt;br /&gt;With READ&lt;br /&gt;When reading a disk file randomly, we do not test for an AT END condition because we are not reading the file in sequence; instead, we include an INVALID KEY test. If there is no record in the INDEXED-FILE with a RECORD KEY equal to T-EMP-NO, the INVALID KEY clause will be executed.&lt;br /&gt;&lt;br /&gt;Eg 12.3:&lt;br /&gt;DISPLAY “ENTER EMPLOYEE CODE :”&lt;br /&gt;ACCEPT T-EMP-EMP-NO.&lt;br /&gt;MOVE T-EMP-NO TO I-EMP-NO.&lt;br /&gt;READ IND-EMP-FILE&lt;br /&gt;INVALID KEY&lt;br /&gt;PERFORM 600-ERR-RTN.&lt;br /&gt;&lt;br /&gt;DELETE verb&lt;br /&gt;The DELETE verb can be used to delete records from indexed files. Note that we use the file-name with the DELETE verb, but the word RECORD can be specified as well. That is, both the statements DELETE INDEXED-FILE and DELETE INDEXED-FILE RECORD can be used to delete the record in the INDEXED-FILE storage area.&lt;br /&gt;To delete a record from an indexed file, you should first read the record into storage and then instruct the computer to delete it.&lt;br /&gt;&lt;br /&gt;Eg 12.4:&lt;br /&gt;MOVE “Y” TO WS-FOUND.&lt;br /&gt;MOVE 1001 TO I-EMP-NO.&lt;br /&gt;READ IND-EMP-FILE&lt;br /&gt;INVALID KEY&lt;br /&gt;MOVE “N” TO WS-FOUND.&lt;br /&gt;IF WS-FOUND = “Y”&lt;br /&gt;DELETE IND-EMP-FILE&lt;br /&gt;INVALID KEY&lt;br /&gt;DISPLAY “ERROR DELETING RECORD”.&lt;br /&gt;&lt;br /&gt;Using ALTERNATE RECORD KEYs&lt;br /&gt;Indexed files may be created with, and accessed by, more than one identifying key field. That is, we may want to access employee records using the name as the key field. To enable a file to be accessed randomly using more than one key field, we would need to establish an ALTERNATE RECORD KEY.&lt;br /&gt;To establish multiple key fields for indexing, we use an ALTERNATE RECORD KEY clause in the SELECT statement.&lt;br /&gt;&lt;br /&gt;Note:&lt;br /&gt;1. More than one ALTERNATE record key can be used.&lt;br /&gt;2. WITH DUPLICATES means than an ALTERNATE RECORD KEY need not be unique. Thus, fields like EMP-DEPT can be used as a key even though numerous records may have the same department no.&lt;br /&gt;3. A record can be accessed by its RECORD KEY or any of its ALTERNATE RECORD KEYs.&lt;br /&gt;&lt;br /&gt;Eg 12.5:&lt;br /&gt;SELECT IND-EMP-FILE&lt;br /&gt;ASSIGN TO “INDEMP.DAT”&lt;br /&gt;ORGANIZATION IS INDEXED&lt;br /&gt;ACCESS IS SEQUENTIAL&lt;br /&gt;RECORD KEY IS I-EMP-NO&lt;br /&gt;ALTERNATE RECORD KEY IS I-EMP-DEPT WITH DUPLICATES.&lt;br /&gt;&lt;br /&gt;Accessing records randomly by alternate record key&lt;br /&gt;The program that accesses the file by key field has the same SELECT clause except that ACCESS IS RANDOM rather than SEQUENTIAL. In the PROCEDURE DIVISION , we can access records by either I-EMP-NO , the record key, or I-EMP-DEPT, the alternate key.&lt;br /&gt;The KEY clause is used with the READ statement when an indexed file has ALTERNATE RECORD KEYs that we want to use to randomly access a record. If the KEY clause is omitted when accessing a file randomly, the RECORD KEY is assumed to be the KEY used for finding the record.&lt;br /&gt;Suppose ALTERNATE RECORD KEY WITH DUPLICATES was specified in the ENVIRONMENT DIVISION and there is more than one record with the same ALTERNATE RECORD KEY. The first one that was actually placed on the disk will be the one retrieved by the READ.&lt;br /&gt;&lt;br /&gt;The START statement&lt;br /&gt;The START statement enables a program to begin processing an indexed file sequentially but at a record location other than the first or next physical record in the file. The access of the file is to be in sequence (ACCESS IS SEQUENTIAL) if we use the RECORD KEY for finding a record, even though we want to start the access at some point other than the beginning. The ACCESS IS DYNAMIC clause is used if we want to begin the processing an indexed file based on the contents of the ALTERNATE RECORD KEY.&lt;br /&gt;When the record to be accessed has a key equal to the one placed in the RECORD KEY, the KEY clause in the START statement is not required. The INVALID clause is executed only if no such record is found.&lt;br /&gt;Note that the START locates the desired record but it does not READ it into storage. The record must always be brought into storage with a READ statement.&lt;br /&gt;&lt;br /&gt;Eg 12.6:&lt;br /&gt;MOVE “Y” TO WS-FOUND.&lt;br /&gt;MOVE 1001 TO I-EMP-NO.&lt;br /&gt;START IND-EMP-FILE&lt;br /&gt;KEY &gt; I-EMP-NO&lt;br /&gt;INVALID KEY DISPLAY “THERE IS NO EMP NO &gt; 1001”&lt;br /&gt;MOVE “N” TO WS-FOUND.&lt;br /&gt;IF WS-FOUND = “Y”&lt;br /&gt;READ IND-EMP-FILE&lt;br /&gt;AT END&lt;br /&gt;MOVE “Y” TO WS-EOF.&lt;br /&gt;&lt;br /&gt;Suppose we wish to begin processing with an I-EMP-NO greater than 006. We must include a KEY clause with the START because we wish to position the file at allocation greater than the value of a RECORD KEY. The KEY clause can be omitted only if the record to be located has a RECORD KEY equal to the one stored.&lt;br /&gt;&lt;br /&gt;The ACCESS IS DYNAMIC clause&lt;br /&gt;Sometimes we wish to access an indexed file both randomly and sequentially in a single program. For this, we say that ACCESS IS DYNAMIC.&lt;br /&gt;In addition to using ACCESS IS DYNAMIC for combining sequential and random access techniques in a single program, we can use this clause to access records by ALTERNATE RECORD KEY. Also, when records are to be accessed by both RECORD KEY and ALTERNATE RECORD KEY, use ACCESS IS DYNAMIC.&lt;br /&gt;&lt;br /&gt;Rules for using the START statement&lt;br /&gt;The file must be accessed with (a) ACCESS IS SEQUENTIAL for reading records in sequence by the RECORD KEY or (b) ACCESS IS DYNAMIC for reading records in sequence by an ALTERNATE RECORD KEY.&lt;br /&gt;The file must be opened as either input or I-O.&lt;br /&gt;If the KEY phrase is omitted, the relational operator “IS EQUAL TO” is implied and the primary record key is assumed to be the key of reference.&lt;br /&gt;We use KEY =, &gt;, NOT &lt;&gt;, NOT &lt;&gt;, NOT&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-4215646348722655862?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/fRQMWjxVYEKeooX1XSQIoIJwVTM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fRQMWjxVYEKeooX1XSQIoIJwVTM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/fRQMWjxVYEKeooX1XSQIoIJwVTM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fRQMWjxVYEKeooX1XSQIoIJwVTM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/jEP4ZIhX4g0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/4215646348722655862/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=4215646348722655862" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/4215646348722655862?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/4215646348722655862?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/jEP4ZIhX4g0/12-indexed-files.html" title="12. Indexed Files" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/12-indexed-files.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8CRXo7eCp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-4117280903547636576</id><published>2010-02-17T16:16:00.000-08:00</published><updated>2010-02-17T16:44:24.400-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:44:24.400-08:00</app:edited><title>13. Table Handling</title><content type="html">Use of OCCURS clause&lt;br /&gt;An OCCURS clause is used in COBOL to indicate the repeated occurrence of fields with the same format.&lt;br /&gt;Defining a series of totals in WORKING-STORAGE to which amounts are added; after all data is accumulated, the total can be printed.&lt;br /&gt;Defining a table in WORKING-STORAGE to be accessed by each input record. For example, using the contents of some input field to “look up” the required data in the table.&lt;br /&gt;&lt;br /&gt;Eg 13.1:&lt;br /&gt;01 TEMP-REC.&lt;br /&gt;05 TEMPERATURE OCCURS 24 TIMES PIC S9(3).&lt;br /&gt;&lt;br /&gt;Subscript&lt;br /&gt;A subscript is used in the PROCEDURE DIVISION to indicate which specific item within the array we wish to access.&lt;br /&gt;The subscript is used along with the identifier that is defined with an OCCURS, to refer to an item within an array.&lt;br /&gt;&lt;br /&gt;Eg 13.2:&lt;br /&gt;MOVE TEMPERATURE (2) TO TEMP-OUT.&lt;br /&gt;&lt;br /&gt;Rules for OCCURS and subscripts&lt;br /&gt;There must be at least one space between the identifier and the left parenthesis that precedes the subscript. Similarly, the subscript must be enclosed in parentheses with no spaces within the parentheses.&lt;br /&gt;A subscript may be a numeric literal or a data-name with a numeric PICTURE clause.&lt;br /&gt;An OCCURS clause may be used on levels 02-49 only, because 01 level is used for defining records not fields.&lt;br /&gt;COBOL 74 permits only upto three levels of OCCURS clauses&lt;br /&gt;&lt;br /&gt;Using OCCURS with VALUE and REDEFINES clauses&lt;br /&gt;Sometimes we want to initialize elements in a table or an array with specific values.&lt;br /&gt;With COBOL 74, we cannot use a VALUE clause with an entry defined by an OCCURS clause. Instead we can define the field with one value and then redefine that storage area into separate array elements. As a result, each array element will have a different value.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Eg 13.3:&lt;br /&gt;01 MONTH-NAMES.&lt;br /&gt;05 STRING-1 PIC X(36) VALUE&lt;br /&gt;‘JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC’.&lt;br /&gt;05 MONTH REDEFINES STRING-1 OCCURS 12 TIMES PIC XXX.&lt;br /&gt;&lt;br /&gt;The SEARCH statement&lt;br /&gt;The best method for searching a table is with the use of a SEARCH statement. The identifier used with the SEARCH verb is the table entry name specified on the OCCURS level, not on the 01 level. The WHEN clause indicates what action is to be taken when the condition specified is actually met. Additional comparisons between search and table arguments can be made using other WHEN clauses. The AT END clause specifies what should be done if the table has been completely searched and no match is found.&lt;br /&gt;To use a SEARCH statement, two additional entries are required : the INDEXED BY clause along with OCCURS, and the SET statement in the PROCEDURE DIVISION.&lt;br /&gt;Table entries must be specified with an index rather than a subscript. An index is similar to a subscript, but it is defined along with the table entries as part of the OCCURS description.&lt;br /&gt;&lt;br /&gt;Eg 13.4:&lt;br /&gt;01 SALES-TAX-TABLE,&lt;br /&gt;05 TABLE-ENTRIES OCCURS 1000 TIMES INDEXED BY X1.&lt;br /&gt;10 WS-ZIPCODE PIC 9(5).&lt;br /&gt;10 WS-TAX-RATE PIC V999.&lt;br /&gt;&lt;br /&gt;However, unlike a subscript, an index is not defined separately in WORKING-STORAGE. The compiler automatically provides an appropriate PICTURE clause. An index is processed more efficiently than a subscript, because the index contains the displacement from the start of the table.&lt;br /&gt;A SEARCH statement does not automatically initialize the index at 1 because sometimes we may want to begin searching a table at some point other than the beginning. Initializing an index at 1 must be performed by a SET statement prior to the SEARCH.&lt;br /&gt;&lt;br /&gt;Eg 13.5:&lt;br /&gt;SET X1 TO 1.&lt;br /&gt;SEARCH TABLE-ENTRIES&lt;br /&gt;AT END MOVE 0 TO WS-SALES-TAX&lt;br /&gt;WHEN ZIP-IN = WS-ZIPCODE (X1)&lt;br /&gt;COMPUTE ........&lt;br /&gt;&lt;br /&gt;An index can be used to reference an element only in the table or array for which it was defined.&lt;br /&gt;With 2 WHEN clauses, the computer begins by performing the first comparison. Only if the condition in the first WHEN is not met does it test the second WHEN.&lt;br /&gt;To search for multiple matches in a table, it is better to use a PERFORM rather than a SEARCH statement for processing the entire table.&lt;br /&gt;If you have parallel table with CUST-NO-TABLE storing 25 customer numbers and CUST-ARRAY storing the corresponding BAL-DUE for each. In such a case the SEARCH... VARYING can be used.&lt;br /&gt;&lt;br /&gt;Eg 13.6:&lt;br /&gt;SET X1, X2 TO 1.&lt;br /&gt;SEARCH EACH-CUST-NO VARYING X2&lt;br /&gt;AT END PERFORM 300-ERR-RTN&lt;br /&gt;WHEN CUST-NO-IN = EACH-CUST-NO (X1)&lt;br /&gt;ADD AMT-IN TO BAL-DUE (X2).&lt;br /&gt;&lt;br /&gt;Binary search&lt;br /&gt;When table entries are arranged in sequence by some field, such as T-CUSTOMER-NO, the most efficient type of look-up is a binary search. The SEARCH ALL verb is used to perform a binary search. A SET statement is not necessary with the SEARCH ALL, since the computer sets the index to the appropriate point initially when each binary search begins.&lt;br /&gt;&lt;br /&gt;Limitations of the SEARCH ALL&lt;br /&gt;The condition following the word WHEN can test only for equality.&lt;br /&gt;If the condition following the word WHEN is a compound conditional :&lt;br /&gt;Each part of the conditional can only consist of a relational test that involves an equal condition.&lt;br /&gt;The only compound condition permitted is with ANDs, not Ors.&lt;br /&gt;Only one WHEN clause can be used with a SEARCH ALL.&lt;br /&gt;The VARYING option may not be used with the SEARCH ALL.&lt;br /&gt;The OCCURS item and its index, which define the table argument, must appear to the left of the equal sign.&lt;br /&gt;&lt;br /&gt;Eg 13.7:&lt;br /&gt;WHEN S-AMT (X1) = AMT1 .....&lt;br /&gt;&lt;br /&gt;To use the SEARCH ALL statement, we must indicate which table entry will serve as the&lt;br /&gt;field. The identifier used in the ASCENDING KEY clause must be an entry within the table and it must appear before the INDEXED BY clause.&lt;br /&gt;&lt;br /&gt;Eg 13.8:&lt;br /&gt;01 TABLE-1.&lt;br /&gt;05 DISCOUNT-TABLE OCCURS 50 TIMES&lt;br /&gt;ASCENDING KEY T-CUSTOMER-NO&lt;br /&gt;INDEXED BY X1.&lt;br /&gt;10 T-CUSTOMER-NO PIC 9(4).&lt;br /&gt;10 T-DISCOUNT-PCT PIC V999.&lt;br /&gt;&lt;br /&gt;Eg 13.9:&lt;br /&gt;01 INVENTORY-TABLE.&lt;br /&gt;05 WAREHOUSE OCCURS 50 TIMES INDEXED BY X1.&lt;br /&gt;10 ITEM-X OCCURS 100 TIMES INDEXED BY X2.&lt;br /&gt;15 PART-NO PIC 9(4).&lt;br /&gt;15 UNIT-PRICE PIC 999V99.&lt;br /&gt;&lt;br /&gt;The identifier used with the SEARCH refers to the lowest-level OCCURS entry.&lt;br /&gt;e.g. SEARCH ITEM-X.&lt;br /&gt;Note that SEARCH ITEM-X increments the lowest-level index only. Hence if X1 is set to 1 initially, the SEARCH will perform a look-up on items in warehouse 1 only, that is (1,1) to (1,100).&lt;br /&gt;To search all warehouses, the major index X1 must be incremented.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-4117280903547636576?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0masQ28QEcMdeFCKFaf8M8UaDPc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0masQ28QEcMdeFCKFaf8M8UaDPc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0masQ28QEcMdeFCKFaf8M8UaDPc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0masQ28QEcMdeFCKFaf8M8UaDPc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/AUxIbjRr020" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/4117280903547636576/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=4117280903547636576" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/4117280903547636576?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/4117280903547636576?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/AUxIbjRr020/13-table-handling.html" title="13. Table Handling" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/13-table-handling.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8DSX06fCp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-7014565413852808739</id><published>2010-02-17T16:15:00.001-08:00</published><updated>2010-02-17T16:44:38.314-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:44:38.314-08:00</app:edited><title>14. Call statement</title><content type="html">Structured programs should consist of a series of independent modules that are executed from the main module.&lt;br /&gt;When programs are properly structured :&lt;br /&gt;1. Each module may be written, compiled, and perhaps even tested independently.&lt;br /&gt;2. The modules may be written in different stages, in atop-down manner. They may even be coded by different programmers.&lt;br /&gt;3. If a specific module needs to be modified, the entire logical flow should still function properly without the need for extensive revision to other parts of the program.&lt;br /&gt;&lt;br /&gt;Modules within a program can be viewed as subroutines that are called or executed from the main module. But a program may also CALL or reference independent subprograms stored in a library that are entirely separate from the main program itself. The main program that references or calls a subprogram is referred to as the calling program. The subprogram that is linked and executed within the main program is referred to as the called program.&lt;br /&gt;The called program would need to be compiled so that it may be called when needed.&lt;br /&gt;When the CALL is performed, data is passed from the calling to the called program (if the calling program has assigned values to fields used in the called program). The entire called program is executed, data is passed from the called program back to the calling program, and control return to the calling program.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Called Program Requirements&lt;br /&gt;PROGRAM-ID.&lt;br /&gt;The literal used in the CALL statement of the main program to extract a subprogram or routine from a library and execute it must be identical to the called program’s PROGRAM-ID. Note that the literal is enclosed in quotation marks when used in the CALL statement.&lt;br /&gt;&lt;br /&gt;LINKAGE SECTION&lt;br /&gt;A LINKAGE SECTION must be defined in the called program for identifying those items that (1) will be passed to the called program from the calling program and (2) passed back from the called program to the calling program. The LINKAGE SECTION of the called program, then, describes all items to be passed between the two programs.&lt;br /&gt;The LINKAGE SECTION, if used, is coded after the FILE and WORKING-STORAGE SECTIONs of the called program. This section is similar to WORKING-STORAGE except that VALUE clauses from initializing fields are not permitted in the LINKAGE SECTION.&lt;br /&gt;&lt;br /&gt;EXIT PROGRAM&lt;br /&gt;The last executed statement in the called program must be the EXIT PROGRAM. It signals the computer to return control back to the calling program. With COBOL 74, EXIT PROGRAM must be the only statement in the last paragraph.&lt;br /&gt;&lt;br /&gt;Calling Program Requirements&lt;br /&gt;PROCEDURE DIVISION USING&lt;br /&gt;The identifiers specified in the USING clause in the PROCEDURE DIVISION entry include all fields defined in the LINKAGE SECTION; these identifiers will be passed from one program to the other. They are passed to and from corresponding identifiers in the CALL … USING of the main program.&lt;br /&gt;The USING clause of the CALL statement is required if the subprogram performs any operations in which data is to be passed from one program to another. The CALL … USING identifies fields in the main or calling program that will be either passed to the called program before it is executed, or passed back to the calling program after the called program has been executed.&lt;br /&gt;&lt;br /&gt;Sample Program&lt;br /&gt;&lt;br /&gt;Calling Program : MAIN.CBL&lt;br /&gt;Eg 14.1a:&lt;br /&gt;IDENTIFICATION DIVISION.&lt;br /&gt;PROGRAM-ID. MAIN.&lt;br /&gt;ENVIRONMENT DIVISION.&lt;br /&gt;DATA DIVISION.&lt;br /&gt;WORKING-STORAGE SECTION.&lt;br /&gt;01 MY-NAME PIC X(20).&lt;br /&gt;PROCEDURE DIVISION.&lt;br /&gt;MAIN.&lt;br /&gt;DISPLAY "ENTER NAME ".&lt;br /&gt;ACCEPT MY-NAME.&lt;br /&gt;CALL "DISP" USING MY-NAME.&lt;br /&gt;STOP RUN.&lt;br /&gt;&lt;br /&gt;Called Program : DISP.CBL&lt;br /&gt;Eg 14.1b:&lt;br /&gt;IDENTIFICATION DIVISION.&lt;br /&gt;PROGRAM-ID. DISP.&lt;br /&gt;ENVIRONMENT DIVISION.&lt;br /&gt;DATA DIVISION.&lt;br /&gt;LINKAGE SECTION.&lt;br /&gt;01 NM PIC X(20).&lt;br /&gt;PROCEDURE DIVISION USING NM.&lt;br /&gt;MAIN.&lt;br /&gt;DISPLAY "HELLO " NM.&lt;br /&gt;EXIT PROGRAM.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-7014565413852808739?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/BnT3TKy012UvNxSi54Wu2TqKvm8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BnT3TKy012UvNxSi54Wu2TqKvm8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/BnT3TKy012UvNxSi54Wu2TqKvm8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BnT3TKy012UvNxSi54Wu2TqKvm8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/mDhO5_kdLQM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/7014565413852808739/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=7014565413852808739" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7014565413852808739?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7014565413852808739?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/mDhO5_kdLQM/14-call-statement.html" title="14. Call statement" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/14-call-statement.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8NQXs9fCp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-7953995256084322250</id><published>2010-02-17T16:12:00.000-08:00</published><updated>2010-02-17T16:44:50.564-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T16:44:50.564-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="cobol" /><category scheme="http://www.blogger.com/atom/ns#" term="cobol string handling" /><title>15. String Handling</title><content type="html">The STRING Statement&lt;br /&gt;A STRING statement may be used to combine several fields to form once concise field. This process is called concatenation.&lt;br /&gt;&lt;br /&gt;05 NAME.&lt;br /&gt;10 LAST-NAME PIC X(10) VALUE “EDISON”.&lt;br /&gt;10 FIRST-NAME PIC X(10) VALUE “THOMAS”.&lt;br /&gt;10 MIDDLE-NAME PIC X(10) VALUE “ALVA”.&lt;br /&gt;01 NAME-OUT PIC X(33).&lt;br /&gt;&lt;br /&gt;STRING&lt;br /&gt;FIRST-NAME DELIMITED BY ‘ ‘&lt;br /&gt;‘ ‘ DELIMITED BY SIZE&lt;br /&gt;MIDDLE-NAME DELIMITED BY ‘ ‘&lt;br /&gt;‘ ‘ DELIMITED BY SIZE&lt;br /&gt;LAST-NAME DELIMITED BY ‘ ‘&lt;br /&gt;‘ ‘ DELIMITED BY SIZE&lt;br /&gt;INTO NAME-OUT.&lt;br /&gt;&lt;br /&gt;Output&lt;br /&gt;&lt;br /&gt;NAME-OUT = THOMAS ALVA EDISON&lt;br /&gt;&lt;br /&gt;OVERFLOW Option&lt;br /&gt;The OVERFLOW option specifies the operation(s) to be performed if the receiving field is not large enough to accommodate the result.&lt;br /&gt;&lt;br /&gt;POINTER Option&lt;br /&gt;We may count the number of characters actually moved to the receiving field if it is initialized at zero.&lt;br /&gt;&lt;br /&gt;01 WS-COUNT PIC 99 VALUE 0.&lt;br /&gt;&lt;br /&gt;MOVE 1 TO WS-COUNT.&lt;br /&gt;STRING FIRST-NAME DELIMITED BY ‘ ‘&lt;br /&gt;INTO NAME-OUT&lt;br /&gt;WITH POINTER WS-COUNT.&lt;br /&gt;&lt;br /&gt;Output&lt;br /&gt;&lt;br /&gt;WS-COUNT = 6&lt;br /&gt;&lt;br /&gt;Rules for using the STRING statement&lt;br /&gt;1. The DELIMITED BY clause is required. It can indicate :&lt;br /&gt;SIZE : The entire sending field is transmitted.&lt;br /&gt;Literal : The transfer of data is terminated when the specified literal is encountered; the literal itself is not moved.&lt;br /&gt;Identifier : The transfer of data is terminated when the contents of the identifier is encountered.&lt;br /&gt;2. The receiving field must be an elementary data item with no editing symbols or JUSTIFIED RIGHT clause.&lt;br /&gt;3. All literals must be described as non-numeric.&lt;br /&gt;4. The identifier specified with the POINTER clause must be an elementary numeric item.&lt;br /&gt;5. The STRING statement move data from left to right just like alphanumeric fields are moved, but a STRING does not pad data from left to right just like alphanumeric fields are moved, but a STRING does not pad with low-order blanks, unlike an alphanumeric MOVE.&lt;br /&gt;&lt;br /&gt;The UNSTRING statement&lt;br /&gt;The UNSTRING statement may be used to convert keyed data to a more compact form for storing it on disk. For example, we can instruct the computer to separate the NAME-OUT into its components and store them without the commas.&lt;br /&gt;&lt;br /&gt;MOVE “THOMAS,ALVA,EDISON” TO NAME-OUT.&lt;br /&gt;UNSTRING NAME-OUT&lt;br /&gt;DELIMITED BY ‘,’&lt;br /&gt;INTO FIRST-NAME&lt;br /&gt;MIDDLE-NAME&lt;br /&gt;LAST-NAME.&lt;br /&gt;&lt;br /&gt;Output&lt;br /&gt;&lt;br /&gt;FIRST-NAME = THOMAS&lt;br /&gt;MIDDLE-NAME = ALVA&lt;br /&gt;LAST-NAME = EDISON&lt;br /&gt;&lt;br /&gt;Rules for using the UNSTRING statement&lt;br /&gt;1. The sending field must be non-numeric. The receiving fields may be numeric or non-numeric.&lt;br /&gt;2. Each literal must be non-numeric.&lt;br /&gt;3. The [WITH POINTER identifier] and [ON OVERFLOW imperative-statement] clauses may be used in the same way as with the STRING.&lt;br /&gt;&lt;br /&gt;The INSPECT statement&lt;br /&gt;The INSPECT statement may be used for replacing a specific character in a field with another character. It can also be used for counting the number of occurrences of a given character.&lt;br /&gt;&lt;br /&gt;01 CTR-1 PIC 9 VALUE 0.&lt;br /&gt;01 WS-NAME PIC X(10).&lt;br /&gt;&lt;br /&gt;ACCEPT WS-NAME.&lt;br /&gt;INSPECT WS-NAME TALLYING CTR-1 FOR ALL SPACES.&lt;br /&gt;&lt;br /&gt;This code will check for the number of spaces in the field WS-NAME and store the value in the field CTR-1.&lt;br /&gt;&lt;br /&gt;Applications of the INSPECT statement&lt;br /&gt;1. To count the number of occurrences of a given character in a field.&lt;br /&gt;2. To replace specific occurrences of a given character with another character.&lt;br /&gt;&lt;a name="_Toc486335121"&gt;&lt;/a&gt;&lt;a name="_Toc486335016"&gt;&lt;/a&gt;&lt;a name="_Toc486335124"&gt;&lt;/a&gt;&lt;a name="_Toc486335019"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2010/02/cobol-tutorial.html"&gt; Back to COBOL Index&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-7953995256084322250?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HdN1MnsezD1m-ID-4nqzQGyVTec/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HdN1MnsezD1m-ID-4nqzQGyVTec/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HdN1MnsezD1m-ID-4nqzQGyVTec/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HdN1MnsezD1m-ID-4nqzQGyVTec/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/LEqds1kR8I0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/7953995256084322250/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=7953995256084322250" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7953995256084322250?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7953995256084322250?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/LEqds1kR8I0/15-string-handling.html" title="15. String Handling" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2010/02/15-string-handling.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0ENSXg_fCp7ImA9WxJUE0w.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-7858546244948863739</id><published>2009-05-27T09:31:00.000-07:00</published><updated>2009-07-11T04:28:18.644-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-11T04:28:18.644-07:00</app:edited><title>1. INTRODUCTION TO VSAM</title><content type="html">VSAM stands for Virtual Storage Access Method, is IBM high performance access method which allows you to access files of different organization such as sequential, indexed, relative record and linear datasets.Features of VSAM&lt;br /&gt;VSAM is one coherent file storage system used to store and retrieve data. It is not a database management system like IDMS or DB2. It does not provide for relationships among the data. The existing databases like IMS or DB2 may be implemented using VSAM.&lt;br /&gt;VSAM is not a programming language. But you can access VSAM dataset through programming languages like COBOL or PL/I. It is not a communication system like VTAM or CICS. It has no equivalent for a ‘PDS’ type of file organization.Advantages of VSAM&lt;br /&gt;Provides protection of Data against unauthorized access through password facility.&lt;br /&gt;Cross-system (MVS &amp;amp; VSE) Cmpatibility. VSAM datasets can be imported and imported in MVS and VSE systems.&lt;br /&gt;Device Independence (Access Via Catalog). The application programmer need not be concerned with Block size ,volume and other control information, as access to VSAM dataset it always through the Catalog and all control information are stored in the catalog entry of the dataset.&lt;br /&gt;IDCAMS commands can be included in JCL to handle VSAM datasetsTypes of VSAM DatasetsClusters&lt;br /&gt;VSAM files are often called clusters. A cluster is the set of catalog entries that represent a file. A cluster consists of one or two components. All VSAM datasets consist of a data component in which data records are placed . For KSDS , there is an additional index component, which contains the indexes used to access records in the data component. ESDS RRDS and LDS have data component only and no index component&lt;br /&gt;VSAM clusters are categorized into 4 types based on the way we store and access the records:&lt;br /&gt;ESDS Entry Sequenced dataset.&lt;br /&gt;These are sequential datasets that can be read in the sequence in which they were created. Records can be added only to the end of the dataset.&lt;br /&gt;KSDS Key Sequenced dataset.&lt;br /&gt;These datasets are stored in sequence of some key field in the record. The data component and index component are separated. The keys are stored in a separate index and records are accessed through the index. Individual records can be accessed randomly on the basis of the record key. Locating the record is a two stage process.&lt;br /&gt;• First search for the key in the index• Use the information in the index to locate the record.&lt;br /&gt;RRDS Relative record dataset.&lt;br /&gt;These datasets associate a number to each record. There is no key field but records are accessed by deriving the relative position of the record in the dataset.&lt;br /&gt;LDS Linear dataset. These datasets consist of a stream of bytes which are accessed and written as 4k blocks accessed by Relative Byte Address&lt;br /&gt;VSAM history&lt;br /&gt;VSAM was introducted in 1973. This version had only Entry Sequence Datasets and Key Sequenced Datasets. In 1975 Relative Record Datasets and alternate indexes for KSDS was added. In 1979 DF/EF VSAM was introduced with Integrated Catalog Facility (ICF).&lt;br /&gt;DFP/VSAM Ver 1 was introduced in 1987 to run under the MVS/XA architecture. DFP/VSAM version 2 introduced Linear Datasets (LDS)&lt;br /&gt;DFP/VSAM version 3 was introduced to run under MVS/ESA architecture.In 1991 version 3.3 supported variable-length records for RRDS.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2009/05/vsam-index.html"&gt;Back to VSAM index &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");&lt;br /&gt;document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;try {&lt;br /&gt;var pageTracker = _gat._getTracker("UA-9729282-2");&lt;br /&gt;pageTracker._trackPageview();&lt;br /&gt;} catch(err) {}&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-7858546244948863739?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/SikxQWs8X4_IGCCxxeKrIZWCA9U/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SikxQWs8X4_IGCCxxeKrIZWCA9U/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/SikxQWs8X4_IGCCxxeKrIZWCA9U/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SikxQWs8X4_IGCCxxeKrIZWCA9U/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/t8KDMdQv_Ko" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/7858546244948863739/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=7858546244948863739" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7858546244948863739?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/7858546244948863739?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/t8KDMdQv_Ko/1-introduction-to-vsam_27.html" title="1. INTRODUCTION TO VSAM" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2009/05/1-introduction-to-vsam_27.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08EQngyeCp7ImA9WxJQFEk.&quot;"><id>tag:blogger.com,1999:blog-105641855853467970.post-6811837238006641599</id><published>2009-05-27T09:29:00.001-07:00</published><updated>2009-05-27T09:30:03.690-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-27T09:30:03.690-07:00</app:edited><title>2. VSAM Catalogs</title><content type="html">VSAM is totally catalog-driven. Catalogs are special purpose files residing on DASD (Direct Access Storage Device) serving as a central repository for information about all datasets under its control. There are two types of catalogs used • Master catalog • User catalog There’s only one Master catalog per system. The entries in the master catalog may point to VSAM or non-VSAM dataset, user catalogs, system datasets or other objects. User catalogs contain same type of information as master catalog. All user catalogs must be cataloged into master catalog. Access to a dataset can only be made through a master or user catalog. Therefore all VSAM datasets have to be cataloged. Non-VSAM datasets can also be cataloged. Catalogs are protected by RACF. Figure 2.1 VSAM Catalog Vsam catalog Catalogs maintain the following information • Name and physical location of datasets • password information required to access protected datasets • Statistics about datasets Example No. of records added, read, deleted or no. of Control Interval/Control Area splits • Information about dataset itself Example ESDS, KSDS, RRDS, CSIZE, KEYLENGTH • Location of catalog recovery area Vsam records VSAM records can be fixed or variable length. Records can also be spanned Vsam space allocation VSAM space allocation depends on whether the dataset is cataloged in an ICF or the older VSAM type catalog. For VSAM datasets cataloged in the newer ICF-type catalogs, dedicated space is allocated dynamically when the cluster is created with the DEFINE CLUSTER command Each VSAM dataset cataloged in an ICF catalog has its own VTOC entry. These VSAM datasets can have 1 primary and 122 secondary allocation unlike OS dataset which can have only 1 primary and 15 secondary extends on a volume. Vsam space management VSAM maintains detailed information in its catalogs about DASD space allocated to VSAM files. This allocation information stored in the catalog is more comprehensive and flexible than the equivalent information stored for a non-VSAM file in VTOC. Sub Allocation Once the space has been allocated, VSAM has complete control over subsequent allocations within that space. Within that space, VSAM can create suballocated files. Whenever a suballocated files need to be created, extended or deleted, VSAM uses it own space management facilities. Unique Allocation Alternatively an entire VSAM space can be allocated to single VSAM file. In that case allocation for the file called UNIQUE file, is managed by DADSM rather than by VSAM. Allocation information for the unique files is maintained in two places : the VSAM catalog entry for the file and the VTOC entry for the space that contains unique file. The figure below shows two DASD volumes. The first volume has a VSAM dataspace contains two sub-allocated files. Notice that there’s unused space within the dataspace too. However, that space is not available to non-VSAM files because it’s already under VSAM’s control. The second DASD volume contains two unique VSAM datasets. All of the unused space on the volume is available to both VSAM and Non-VSAM datasets. Under VSE/VSAM &amp;amp; OS/VS VSAM most VSAM datasets are sub-allocated. Under ICF, there is no VSAM space. All VSAM files are Unique Figure 2.2 Space Allocation&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mftuto.blogspot.com/2009/05/vsam-index.html"&gt;Back to VSAM index &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/105641855853467970-6811837238006641599?l=mftuto.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vnRZ0vQ7RIaZsLlnAf17OsZOT2k/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vnRZ0vQ7RIaZsLlnAf17OsZOT2k/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/vnRZ0vQ7RIaZsLlnAf17OsZOT2k/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vnRZ0vQ7RIaZsLlnAf17OsZOT2k/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframeTutorials/~4/rUe6wti7FPM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mftuto.blogspot.com/feeds/6811837238006641599/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=105641855853467970&amp;postID=6811837238006641599" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/6811837238006641599?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/105641855853467970/posts/default/6811837238006641599?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframeTutorials/~3/rUe6wti7FPM/2-vsam-catalogs_27.html" title="2. VSAM Catalogs" /><author><name>Gayatri</name><uri>http://www.blogger.com/profile/14444526320421943985</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mftuto.blogspot.com/2009/05/2-vsam-catalogs_27.html</feedburner:origLink></entry></feed>

