LABELS Statement


The LABELS statement is used to decide whether the labels are to copied or not to the output data set. All statements except the last statements are ignored if more than one valid LABELS statement is coded.

The LABELS statement is used when -

  • no user labels are to be copied.
  • user labels are to be copied from the SYSIN data set.
  • user labels are to be copied after the user's label processing routines modify them.

Syntax -

//SYSIN DD *
  LABELS [DATA={YES|NO|ALL|ONLY|INPUT}]
/*

Parameters -

KeywordDescription
DATA=YES
  • Specifies any user labels are required to treat as data.
  • YES is the default.
DATA=NOSpecifies user labels are not required to treat as data.
DATA=ALLSpecifies that all user labels in the current processing group are required to treat as data.
DATA=ONLYSpecifies only user header labels are required to treat as data.
DATA=INPUTSpecifies user labels for the output data set are coded as 80-byte input records in the data portion of SYSIN.

Practical Example -


Scenario - Edit and Copy a Sequential Input Data Set with Labels

Input PS File - MATEPK.IEBGENER.INPUTPS1

 BROWSE    MATEPK.IEBGENER.INPUTPS1                   Line 00000000 Col 001 080 
 Command ===>                                                  Scroll ===> CSR  
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
.A                       EMPLOYEE DETAILS                               
.B EMPNO   EMPNAME             DESGN     DEPTNAME  LOCATION  SALARY     
.C******************************************************************************
   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 
.D******************************************************************************
.E TOTAL EMPLOYEES: 7                                                   
******************************** Bottom of Data ********************************

Code -

----+----1----+----2----+----3----+----4----+----5----+----6
//MATEPKL  JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID
//***********************************************************
//* EDIT AND COPY A SEQUENTIAL INPUT DATA SET WITH LABELS
//***********************************************************
//STEP10   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=MATEPK.IEBGENER.INPUTPS1,DISP=SHR
//SYSUT2   DD DSN=MATEPK.IEBGENER.OUTPUTL,
//            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)
    LABELS DATA=INPUT
    RECORD LABELS=3
    .A .B .C
    RECORD LABELS=2
    .D .E
/* 

JOB Status -

 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)                                                
    LABELS DATA=INPUT                                                           
    RECORD LABELS=3                                                             
    .A .B .C                                                                    
    RECORD LABELS=2                                                             
    .D .E                                                                       
 
PROCESSING ENDED AT EOD                                                         
******************************** BOTTOM OF DATA ********************************

Output - MATEPK.IEBGENER.OUTPUTL

 BROWSE    MATEPK.IEBGENER.OUTPUTL                    Line 00000000 Col 001 080 
 Command ===>                                                  Scroll ===> CSR  
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
=====.A                       EMPLOYEE DETAILS                             =====
=====.B EMPNO   EMPNAME             DESGN     DEPTNAME  LOCATION  SALARY   =====
=====.C********************************************************************=====
=====   E0001   EMPLOYEE1           DIR                 LOC1      000010000=====
=====   E0002   EMPLOYEE2           MGR       DEPT1     LOC1      000008000=====
=====   E0003   EMPLOYEE3           MGR       DEPT2     LOC2      000007500=====
=====   E0004   EMPLOYEE4           TL        DEPT1     LOC1      000005000=====
=====   E0005   EMPLOYEE5           SSE       DEPT1     LOC1      000004500=====
=====   E0006   EMPLOYEE6           SE        DEPT1     LOC1      000003400=====
=====   E0007   EMPLOYEE7           SSE       DEPT2     LOC2      000004600=====
=====.D********************************************************************=====
=====.E TOTAL EMPLOYEES: 7                                                 =====
******************************** 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.
  • LABELS DATA=INPUT specifies that the labels are included in the input.
  • RECORD LABELS=3 specifies that 3 header lables should copy to output.
  • .A .B .C specifies the header lables that should copy to output.
  • RECORD LABELS=2 specifies that 2 footer lables should copy to output.
  • .D .E specifies the footer lables that should copy to output.