Tuesday, July 5, 2011

Utilities

IEFBR14
This utility mainly used for allocation and deallocation of dataset. Most of the time mainframe developers encountered to some errors when submitting the jobs. The most common error is “FILE IS ALREADY CATLOGUED”. Even it is a warning message in some cases; it might be the reason for unsuccessful execution of our job. So resolve this problem we need to delete the files which are already catalogued.  
The below mentioned code should be included in our job as initial step,

//**********************************************
//*  IEFBR14
//**********************************************
//DD1      EXEC  PGM=IEFBR14
//DELDD    DD DSN=<< input file name >>,
//         DISP=(MOD,DELETE,DELETE),UNIT=SYSDA,
//         SPACE=(TRK,(1,1))
//**********************************************

Utility IEFBR14 also used to delete the temporary files which are created during job run and also files on Tape.

IEBGENER
This basic uses of this utility are:
  • Create a backup copy of a sequential data set, a member of a partitioned dataset
  • Produce a partitioned data set, or a member of a partitioned dataset, from a sequential dataset
  • Expand an existing partitioned dataset by creating partitioned members and merging them into the existing dataset
  • Produce an edited sequential or partitioned dataset
  • Manipulate datasets containing double-byte character set data
  • Print sequential datasets, members of partitioned datasets  
Below we can see some example code here.
Copy 
//*---------------------------------------------
//step01   EXEC  PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSUT1    DD  DSN=&TEST1.DDQ.NN1.DEFGGH0(+1),
//                  DISP=SHR
//SYSUT2   DD  DSN=&=&TEST1.DDQ.NN1.DEFGGH0.FTP,
//                  DISP=MOD
//SYSIN    DD  DUMMY
//*----------------------------------------------
   
Concatenation
//*----------------------------------------------
//step01   EXEC  PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSUT1   DD  DSN=&TEST1.DDQ.NN1.DEFGGH0(+1),
//                 DISP=SHR
//         DD  DSN=&TEST1.DDQ.NN1.DEFGGH0 (+1),
//                 DISP=SHR
//SYSUT2   DD  DSN=& TEST1.DDQ.NN1.DEFGGH0.FTP,
//                 DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
//                       SPACE=(CYL,(20,10),RLSE) 
      
Empty Existing Data
//*-------------------------------------------
//step01   EXEC  PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSUT1   DD DUMMY,DCB=(LRECL=80,RECFM=FB,BLKSIZE=800)
//SYSUT2   DD  DSN=&TEST1.DDQ.NN1.DEFGGH0.FTP,             
//             DISP=SHR
//SYSIN    DD  DUMMY
//*-------------------------------------------
 

SUBMIT a JOB WITHIN JOB using IEBGENER
Main advantage of IEBGENER utility is we can submit one job from another one job. When the first task of our JCL has completed processing then we can add IEBGENER step to submit the next job form our current job.

For this we need to direct the IEBGENER output to the “Internal Reader”. So it will take our input and send it to JES2/JES3 and it will process to submit the next job.

The DDNAME SYSUT1 will point to the input, i.e., the JCL job which we want to submit next. This could either be in a dataset (PDS or PS) or JCL in stream.
The DDNAME SYSUT2 (output) will point to the internal reader.

Example
//*
//STEP040 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=SYSPDD.JCLLIB(JCL2),DISP=SHR
//SYSUT2 DD SYSOUT=(A,INTRDR)
//SYSIN DD DUMMY