Page 1 of 1

Create new data set and member using JCL statement.

PostPosted: Tue Aug 03, 2010 7:37 am
by danielnguyen
Sorry for the noob question but I'm starting to learn about JCL statements and it is completely confusing me. Can anyone please give me an example of that?
Thanks in advance.

Re: Create new data set and member using JCL statement.

PostPosted: Tue Aug 03, 2010 8:03 am
by Robert Sample
//DDNAME DD DISP=(,CATLG,CATLG),
//       DSN=HLQ.MLQ.WHATEVER(MEMBER),
//       UNIT=SYSDA,
//       SPACE=(CYL,(1,1,10)),
//       DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=0
I'm not sure what questions this can answer -- and this could not be run at any given site without customizing it (for the UNIT, the high level qualifier, and possibly SMS parameters).

Re: Create new data set and member using JCL statement.

PostPosted: Tue Aug 03, 2010 9:53 am
by NicC
Your best bet is to look at someone else's JCL and go from there. You would see that although there are a great many parameters you actually only need very few.

Re: Create new data set and member using JCL statement.

PostPosted: Tue Aug 03, 2010 11:08 am
by steve-myers
I think Mr. Nuyen is confused by the whole concept, so I will review Mr Sample's JCL in detail.

DDNAME -- A DD name (or dd name) is how a program connects to a DD statement. A DD name is just a 1 to 8 byte character string that contains Roman letters, numbers, or "national characters." A "national character" varys from location to location. In the United States they are $, #, and @. The first character of a DD name is a Roman letter or a "national character."

DISP=(option1,option2,option3) -- The DISP parameter describes the data set disposition. There are standard defaults, which can be confusing.

option1 can be NEW, OLD, SHR or MOD. The default, which was used here is NEW. NEW is what it says. OLD says the data set already exists and that your program has exclusive use of the data set. SHR says the data set already exists, and its use can be shared by several jobs. MOD is very confusing. If the data set does not exist, it's the same as NEW. If the data set does exist anything your program writes to the data set will be added to the end of the data set. Some shops will not allow MOD for data sets on tape.

option2 can be KEEP, PASS, CATLG, UNCATLG, or DELETE. The default depends on option1; if it is NEW (or MOD treated as NEW) the default is DELETE, KEEP is what it says. CATLG directs the system to catalog the data set, UNCATLG is rarely used. DELETE directs the system to delete the dataset when the step ends. PASS is confusing, but the general idea to to retain information about the data set is a sort of job based catalog so the data set can be used in a later step. The final option2 is the same as the default option2 in the first step that specified the data set.

option3 is the same as option2, except you can't specify PASS, and is used if your step abnormally terminates.

DSN -- A data set name is a character string from 1 to 44 bytes, divided into one or more "index levels." The naming rule for an index level is the same as for a DD name. Mr. Sample showed HLQ, which is a short hand for high level qualifier, MLQ, which I presume is short hand for middle level qualifier, and so on.

Unlike the file systems on what I call toy machines (something like a PC) or baby machines (typically running Unix or some variation of Unix) the z/OS file systems define data sets that are quite well structured. The most common data set is sequential, which is just a "flat" file. A very common data set type is a "partitioned" data set, which has a directory similar to the directories in toy or baby machines, A directory contains member entries that point to "members," which are basically flat files. Technically that's not quite true, but there are some advanced capabilities that are only used for load modules. The naming convention for a member is the same as a DD name. Mr. Sample is calling his member MEMBER.

UNIT describes the type of device where a new data set will reside. SYSDA is almost universal, and describes some sort of direct access storage.

SPACE. Unlike toy and baby machines, you have to describe the amount of space you want. There are many complex variations that I won't try to discuss here. CYL says you want to allocate a collection of tracks, (1,1,10) says you want 1 cylinder of initial space, 1 additional cylinder if you fill up the first cylinder, and 10 directory blocks.

The last line describes the attributes of the data set. For a long time you had to code it as DCB=(the attributes), but that is no longer true, though old dinosaurs like me still do it that way.

DSORG=PS is incorrect. It should be DSORG=PO, but it does not have to be specified here since directory blocks are specified in the SPACE parameter.

RECFM specifies the record attributes. A z/OS data set is not quite a string of bytes as is true in toy and baby machines; all data sets have some sort of structure. There are three record types: fixed length records, variable length records, where each record has a length attribute associated with the record, and "undefined" length records, where the program is responsible for a format that may not conform to a "standard" record format.

LRECL specifies the length of a logical record. For data sets with fixed length records, the LRECL is the length of each record. When you are writing data sets with variable length records, LRECL specifies the maximum length of a logical record.

BLKSIZE specifies the length of each physical record. As used here the system selects an appropriate BLKSIZE, and it actually does a pretty good job of it. There are some rules you should follow if you want to do it yourself, but I won't try to ennumerate them here.

Re: Create new data set and member using JCL statement.

PostPosted: Wed Aug 04, 2010 8:19 am
by danielnguyen
Thanks Steve-myers for a very detailed explaination, I sort of get the idea now but I think I still need more time to be able to understand this. Anyway, Thank everyone for your help ! :) :) :) :)