RECORD Statement


The RECORD statement defines a record group with editing information. A record group consists of records that are to be processed identically.

Syntax -

//SYSIN DD *
  RECORD [{IDENT|IDENTG}=(length,'name',input-location)]
  [,FIELD=([length],[{input-location|'literal'}],
          [conversion],[output-location])]
  [,FIELD=...][,LABELS=n]
/*

Parameters -

KeywordDescription
IDENT|IDENTG}= (length,'name',
input-location)
Identifies the last record the input data set from group of records.
  • length - Specifies the length of field name and the length should not be greater than 8.
  • 'name' - Specifies the literal used to identify the last input record from the group of records.
  • input-location - Specifies the field starting position in the input records.
FIELD=([length], [{input-location| 'literal'}], [conversion], [output-location]) Specifies field processing and editing information.
  • length - Specifies the input field or literal length (in bytes) that is to be processed. If it is not coded, a length of 80 is assumed.
  • input-location - specifies the field starting position. The default value is 1 if it is not coded.
  • 'literal' - Specifies a literal (max length is 40 bytes) that is to be placed in the specified output location.
  • conversion - Specifies a type of conversion (code) that is to be performed on this field.
  • output-location - Specifies the field starting position in the output records. If output-location is not coded, it defaults to 1.
LABELS=nIt is an optional parameter that specifies the number of records in the SYSIN data set to be treated as user labels.

Practical Example -


Scenario - Split sequential file records into three PDS members along with PDS creation. The newly created members are merged into an existing partitioned data set.

Input PS File - MATEPK.IEBGENER.INPUTPS

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
E0001    EMPLOYEE1           DIR                 LOC1      0000100000    
E0002    EMPLOYEE2           MGR       DEPT1     LOC1      0000080000    
E0003    EMPLOYEE3           MGR       DEPT2     LOC2      0000075000    
E0004    EMPLOYEE4           TL        DEPT1     LOC1      0000050000    
E0005    EMPLOYEE5           SSE       DEPT1     LOC1      0000045000    
E0006    EMPLOYEE6           SE        DEPT1     LOC1      0000034000    
E0007    EMPLOYEE7           SSE       DEPT2     LOC2      0000046000    
******************************** Bottom of Data ********************************

Code -

----+----1----+----2----+----3----+----4----+----5----+----6
//MATEPKR  JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID
//************************************************************
//* ADD '=====' BEFORE AND AFTER THE DATA
//************************************************************
//STEP10   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=MATEPK.IEBGENER.INPUTPS,DISP=SHR
//SYSUT2   DD DSN=MATEPK.IEBGENER.OUTPUTPS,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(10,10),RLSE),
//            UNIT=3390,VOL=SER=DEVHD4,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN    DD  *
  GENERATE MAXFLDS=3,MAXLITS=10
    RECORD FIELD=(5,'=====',,1),
           FIELD=(70,1,,6),
           FIELD=(5,'=====',,76)
/*

JOB Status (in SPOOL) -

 COMMAND INPUT ===>                                            SCROLL ===> CSR  
********************************* TOP OF DATA **********************************
DATA SET UTILITY - GENERATE
  GENERATE MAXFLDS=3,MAXLITS=10
    RECORD FIELD=(5,'=====',,1),
           FIELD=(70,1,,6),
           FIELD=(5,'=====',,76)
   
PROCESSING ENDED AT EOD
******************************** BOTTOM OF DATA ********************************

Output - MATEPK.IEBGENER.OUTPUTPS

 BROWSE    MATEPK.IEBGENER.OUTPUTPS                   Line 00000000 Col 001 080 
 Command ===>                                                  Scroll ===> CSR  
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
=====E0001    EMPLOYEE1           DIR                 LOC1      0000100000 =====
=====E0002    EMPLOYEE2           MGR       DEPT1     LOC1      0000080000 =====
=====E0003    EMPLOYEE3           MGR       DEPT2     LOC2      0000075000 =====
=====E0004    EMPLOYEE4           TL        DEPT1     LOC1      0000050000 =====
=====E0005    EMPLOYEE5           SSE       DEPT1     LOC1      0000045000 =====
=====E0006    EMPLOYEE6           SE        DEPT1     LOC1      0000034000 =====
=====E0007    EMPLOYEE7           SSE       DEPT2     LOC2      0000046000 =====
******************************** Bottom of Data ********************************

Explaining Example -

  • SYSUT1 DD maps the input data set (MATEPK.IEBGENER.INPUTPS).
  • SYSUT2 DD defines the output partitioned data set (MATEPK.IEBGENER.OUTPDS).
  • SYSIN DD defines the control data set.
  • GENERATE MAXFLDS=3,MAXLITS=10 indicates a maximum of three fields and 10 literals are included in RECORD statements.
  • RECORD FIELD=(5,'=====',,1) specifies the '=====' should filled in the output file from 1-5 positions.
  • FIELD=(70,1,,6) specifies the input data (1-70 positions in input file) filled from 6th column(in output file).
  • FIELD=(5,'=====',,76) specifies the '=====' should filled in the output file from 76-80 positions.