Question

I've used the below jcl:

//STEP1    EXEC PGM=IEBGENER                            
//SYSUT1   DD   DUMMY,RECFM=FB,LRECL=80                  
//SYSUT2   DD   DSN=RK.MYDIR.FILES(NEW1),DISP=(SHR)      
//SYSPRINT DD   SYSOUT=*                                
//SYSIN    DD   DUMMY

I was able to create it. But i can't understand the code here. Is there any possibility to create using IEFBR14. If not this is the nly way. Please kindly explain me the code. Thank you

OTHER TIPS

If you're interested in the reason why, understand that IEFBR14 doesn't actually open any of the DD statements you code in your JCL. Rather, it's just a shorthand way to drive the system allocation (and deallocation) routines. Indeed, if you were to look at an assembler listing of iEFBR14, you'd find it's only two instructions: set the R15 return code to zero, and exit.

With batch processing, the idea is that the system (JES plus the batch initiator) should do a lot of the work before an application even starts. Thus, if you allocate a new dataset, or reference (say) a tape device that takes time for the operator to mount, the system does all this for you before your program even starts. IEFBR14 is a convenient way to use the system allocation routines to allocate files using these capabilities of JCL.

But there's a catch when it comes to accessing PDS datasets in JCL, like you're trying to do.

When you specify DSN(MEMBER) syntax in JCL, the allocation routines don't particularly care about the MEMBER part - turns out, this isn't a function of the initiator, but is instead implemented in OPEN/CLOSE. In your example, allocation verifies that the dataset exists (since you coded DISP=SHR), and when a program OPENs the DD statement, the OPEN routines automatically issue BPAM FIND/POINT/STOW to get you to the PDS member you specified. This is how your PDS member gets created, and so you need to use a program that actually OPENs the file (IEBGENR, IEBUPDTE, IEBCOPY, IDCAMS, etc would all work).

One small unrelated comment is that you might want to be careful about updating datasets (especially PDS) using DISP=SHR. If you manage to get the timing wrong, two of these jobs could in theory run at exactly the same time, and this would likely cause corruption to your dataset. Unless you're certain you're the only task accessing the PDS, it's safer to use DISP=OLD in this case.

If you'd like to create multiple members at once, I suggest IEBUPDTE.

From IBM:

This basic example uses IEBUPDTE to add two JCL procedures to the data set named MY.PROCLIB:

//ADDPROC1 JOB 1,SMCHUGH,MSGCLASS=X
//         EXEC PGM=IEBUPDTE
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DISP=OLD,DSN=MY.PROCLIB
//SYSUT2   DD DISP=OLD,DSN=MY.PROCLIB
//SYSIN    DD DATA
./ ADD LIST=ALL,NAME=MYJOB1
//STEP1 EXEC=SUZNX1
//PRINT DD SYSOUT=A
// (more JCL for MYJOB1)
//SYSUDUMP DD SYSOUT=* (last JCL for MYJOB1)
./ REPL LIST=ALL,NAME=LASTJOB
//LIST EXEC PGM=SUZNLIST
// (more JCL for this procedure)
//* LAST JCL STATEMENT FOR LASTJOB
./ ENDUP
/*

This creates one new member, MYJOB1, but you can see that it can also replace members (LASTJOB).

http://publib.boulder.ibm.com/infocenter/zos/basics/topic/com.ibm.zos.zdatamgmt/zsysprogc_utilities_IEBUPDTE.htm

If you are copying the contents of a DSN into the new member, use IEBGENER.

To set the attributes of the new DSN dynamically use the LIKE parameter.

For example (using Mikes example above)

//STEP1    EXEC PGM=IEBGENER                            
//SYSUT1   DD   DISP=SHR,DSN=your.input.dataset                  
//SYSUT2   DD   DISP=(,CATLG,DELETE),DSN=your.output.dataset,
//              LIKE=your.input.dataset      
//SYSPRINT DD   SYSOUT=*                                
//SYSIN    DD   DUMMY   <-- no CONTROL statements

The LIKE attribute lets you easily create a new dataset, using the attributes of the dataset you specify, I also changed the disposition to reflect what a new DSN should be set to.

Warning! -- in re using IEBGENER with SYSUT2 DD DSN=PDS(MEMBER): Don't forget to specify the MEMBER name -- if you do, IEBGENER will overwrite your PDS from the beginning with whatever it finds in SYSUT1, starting with ruining your PDS directory!

The IEBGENER utility is used to copy a single file.

The SYSUT1 DD name is used to supply the INPUT or file to be copied from.

The SYSUT2 DD name is the OUTPUT file.

The SYSIN DD provides the CONTROL statements (if any).

//STEP1    EXEC PGM=IEBGENER                            
//SYSUT1   DD   DISP=SHR,DSN=your.input.dataset                  
//SYSUT2   DD   DISP=SHR,DSN=your.output.dataset      
//SYSPRINT DD   SYSOUT=*                                
//SYSIN    DD   DUMMY   <-- no CONTROL statements

Note that the file/dataset can be a sequential dataset or a member of a partitioned dataset.

//SYSUT1   DD   DISP=SHR,DSN=your.input.dataset(member)                  
//SYSUT2   DD   DISP=SHR,DSN=your.output.dataset(member) 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top