Sunday, 4 August 2013

IEBGENER Utility || IEBGENER Utility Examples || IEBGENER Utility in Mainframe.

iebgener jcl examples
IEBGENER Utility


The IEBGENER utility can be used to copy non-VSAM sequential data sets to or from tape or DASD. As a result, this utility can be used to back up and restore sequential data sets.

  • You can also use this utility to print a non-VSAM sequential data set by copying it to a SYSOUT data set. Although the printed output isn’t formatted, this is a quick way to list the contents of the records in a data set.
  • You can use the SYSIN data set to provide control statements that can rearrange fields and convert their data formats.
  • SYSIN DD statement is required with DUMMY data set is required in-case you skip control statements. 
The DD statements required by the IEBGENER utility.

DD Name
Description
SYSPRINT
Output messages or printed output.
SYSUT1
The input file.
SYSUT2
The output file.
SYSIN
The control statement file.

Example 1: A job step that uses IEBGENER to copy a sequential file.

//RXTRX2T JOB ... (JOB CARD)
//STEP020  EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSNAME=RC01.PAYMAST,DISP=SHR
//SYSUT2   DD DSNAME=RC01.PAYTMAST.BACKUP,
//            DISP=(NEW,CATLG,DEL),UNIT=SYSDA,
//            SPACE=(CYL,(1,1))
//SYSIN    DD DUMMY

Example 2:  A job step that uses IEBGENER to print a sequential file.

//RXTT02T JOB ... (JOB CARD)
//STEP30   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSNAME=RC01.CUST.DETS.FILE,DISP=SHR
//SYSUT2   DD SYSOUT=*
//SYSIN    DD DUMMY    

If you want to rearrange or convert data formats as you copy a data set, you can use the GENERATE and RECORD control statements.

If you increase or decrease the size of the output record, you should code the DCB parameter in the DD statement for the output file with the new length in the LRECL sub parameter.

The syntax of the GENERATE control statement

                GENERATE MAXFLDS=n,
                                     [ ,MAXLITS=n ] 

Parameter
Description
MAXFLDS
The number of field parameters in RECORD statements.
MAXLITS
The number of bytes of literal data included in the field parameters in RECORD statements.

The syntax of the RECORD control statement

                   RECORD   FIELD=(length, in-loc | 'literal', conv, out-loc])
                   [,FIELD=(length, in-loc |'literal', conv, out-loc) ]…

Parameter
Description
 length
The length of the field in the input record.
 in-loc
The input record start with default position i.e. 1st position.
 literal
Used instead of in-loc to supply a literal value to the output field.
 conv
The conversion operation to be performed on the field. Specify XE to  convert to hexadecimal, PZ to convert from packed-decimal to zoned-decimal, and ZP to convert from zoned-decimal to packed-decimal. If omitted, no conversion is done.
 out-loc
The starting position of the field in the output record. The default is 1.


Example : 2 IEBGENER to copy a sequential file with reformatting.

//RXT002T JOB ... (JOB CARD)
//STEP01   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSNAME=RC01.CUST.MAST.FILE,DISP=SHR
//SYSUT2   DD DSNAME=RC01.CUST.MAST.TEST.FILE,
//            DISP=(NEW,CATLG,DEL),
//            UNIT=SYSDA,SPACE=(CYL,(1,1)),
//            DCB=(RECFM=FB,LRECL=40,BLKSIZE=800)
//SYSIN DD *
  GENERATE MAXFLDS=5,MAXLITS=4
  RECORD FIELD=(5,1,,1),FIELD=(20,21,,6), -
  FIELD=(9,61,ZP,26),                     -
  FIELD=(9,70,ZP,31),                     -
  FIELD=(4,'TEST',,36)
/*


Please share and subscribe to my blog for more such post and don't forget to share your feedback. 

Created with Artisteer

1 comment:

New In-feed ads