Tuesday, February 1, 2011

Sort - To count the number of records in input file

//STEP2    EXEC PGM=SORT                                               
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DISP=SHR,DSN=TCCPU.DLAKS1.CANPHLBD.BC                    
//SORTOF2  DD DISP=MOD,DSN=TCCPU.DLAKS1.CANPHLBD.COUNT                 
//SYSIN    DD *                                                        
  SORT FIELDS=(1,1,CH,A)                                               
  OUTFIL FILES=1,NODETAIL,                                             
  REMOVECC,TRAILER1=(C'NUMBER OF RECORDS IN BC: ',COUNT)               
/*                                                                     

NODETAIL - will copy all the records from input and the count is displayed in the last row

Note: If only count has to be displayed in output without the actual records, the need not give NODETAIL

No comments:

Post a Comment