mainframejcldfsort

Update the trailer counts using JCL


I have a input file having different types of Record. Different types of records are identified by column 1. For example for header records column1 is having value 0, for trailer records column1 is having value 9. For other records column1 is having value from 1 to 5. Trailer of the file is having count of each types of records. Trailer is like below:

Column 1 is having value 9 so that it will be identified as trailer record
Column 2-10 is having count of record type1
Column 11-19 is having count of record type2
Column 20-28 is having count of record type3
Column 29-37 is having count of record type4
Column 38-46 is having count of record type5

So, after doing some sort include data has been updated in output file. So how to update the count of the trailer record using JCL.


Solution

  • From a comment:

    My input file is VB file having 4700 record length

    Here is an UNTESTED solution which would meet your requirements. In this case I assumed that we can generate a new Trailer record with the updated counts as you only have the counts on it.

    //SYSIN    DD *                                         
      OPTION COPY,VLSCMP                                    
      OMIT COND=(05,1,CH,EQ,C'9',OR,                        
                 15,4,CH,EQ,C'DROP')                        
                                                            
      INREC IFTHEN=(WHEN=INIT,                              
             BUILD=(1,4,C'00000',5)),                       
            IFTHEN=(WHEN=INIT,                              
           OVERLAY=(05:10,01,CHANGE=(5,C'1',C'10000',       
                                       C'2',C'01000',       
                                       C'3',C'00100',       
                                       C'4',C'00010',       
                                       C'5',C'00001'),      
                             NOMATCH=(5,5)))                
                                                            
      OUTFIL BUILD=(1,4,10),                                
      REMOVECC,                                             
      TRAILER1=('9',                                        
                TOT=(5,1,ZD,M11,LENGTH=9),                  
                TOT=(6,1,ZD,M11,LENGTH=9),                  
                TOT=(7,1,ZD,M11,LENGTH=9),                  
                TOT=(8,1,ZD,M11,LENGTH=9),                  
                TOT=(9,1,ZD,M11,LENGTH=9))                  
    /*