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 : column1 is having value 9 so that it will be identified as trailer record Coulmn2-10 is having count of record type1 Column11-19 is having count of record type2 Cilumn20-28 is having count of record type3 Coulmn29-37 is having count of record type4 column38-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

  • Thanks Kolusu for your answer. My input file is VB file having 4700 record length

    Azhar,

    It would have been nice if you had mentioned that upfront so that we don't have to work on multiple solutions. Also you could have tried to change the above posted solution to your requirement, however you simply came back with the requirement hoping for a hand down solution. Please try to understand the solution and then if you run into an issue, you can comeback which shows that you have put some effort.

    Either way 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))                  
    /*