Endevor

  • 1.  file master batch

    Posted Aug 11, 2017 03:35 PM

    how do use copybooks in batch.  I know I need DD LAYOUT

     

    //JOBCARD INFORMATION                                      
    //FM41BAT EXEC PGM=CAWABATC,REGION=2M                      
    //**********************************************************
    //* COPY SYSUT1 to SYSUT1O. If positions 25 and 26 equal * 
    //* CT then change it to MA *                              
    //**********************************************************
    //STEPLIB DD DSN=cai.CAILIB,DISP=SHR                       
    //SYSPRINT DD SYSOUT=*                                     
    //SYSLIST DD SYSOUT=*                                      
    //SYSTOTAL DD SYSOUT=*                                     
    //SYSUT1 DD DSN=MY.INPUT,FILE,DISP=SHR                     
    //SYSUT1O DD DSN=MY.OUTPUT,FILE,DISP=SHR                   
    //LAYOUT DD DSN=MY.LAYOUTS(MEMBER)DISP=SHR                 
    //SYSIN DD *                                               



  • 2.  Re: file master batch

    Broadcom Employee
    Posted Aug 14, 2017 02:57 AM

    Hello jbh_goodyear,

     

    Thank you for your question. To use a copybook in batch, simply define a DD name that points to the copybook and specify the DD name in the LAYOUTFILE keyword. Note that DD name LAYOUT is the default, so if you use that one (as in your sample JCL), the LAYOUTFILE keyword can be omitted. Now you can use the field names in the keywords that apply to the task that you want to accomplish.

     

    As an example, assume that the copybook pointed to by DD name LAYOUT contains the fields that describe the records in your file. Field STATE-ABBREV is the field that holds the 2-character state abbreviation at positions 25-26. This input will change all occurrences of 'CT' to 'MA':

    COPY,

       INFILE(SYSUT1),OUTFILE(SYSUT1O),

       CHANGE(STATE-ABBREV,EQ,C'CT',C'MA')

     

    FYI, in this case, you can also work without a copybook, by specifying an absolute position and length:

    COPY,

       INFILE(SYSUT1),OUTFILE(SYSUT1O),

       CHANGE(25,2,EQ,C'CT',C'MA')

     

    Hope this helps,

    Guy