Pages

Thursday 8 May 2014

DFSORT OMIT, SUM AND OUTREC FIELDS - Best Tips

The below best example shows important key words of OMIT, SUM and OUTREC FIELDS.

//EXAMP    JOB B200,PROGRAMMER                                  
//STEP1    EXEC PGM=SORT                                        
//SYSOUT   DD SYSOUT=H                                          
//SORTIN   DD DSN=INP1,DISP=SHR,UNIT=3380,VOL=SER=SCR001        
//         DD DSN=INP2,DISP=SHR,UNIT=3390,VOL=SER=SYS351        
//SORTOUT  DD DSN=&&OUTPUT,DISP=(,PASS),UNIT=3390,              
//   SPACE=(CYL,(5,1)),DCB=(LRECL=22)                           
//SYSIN    DD *                                                 
  OMIT COND=(5,1,CH,EQ,C'M')                                    
  SORT FIELDS=(20,8,CH,A,10,3,FI,D)                             
  SUM FIELDS=(16,4,ZD)                                          
  OPTION DYNALLOC,ZDPRINT                                       
  OUTREC FIELDS=(10,3,20,8,16,4,2Z,5,1,C' SUM')
/*  


SUM : Whenever two fields of same encounterd, the SUM filed add the two fields and make it as one record

OMIT : It simply omits records in the o/p file

OUTREC FIELDS:  It reformat the o/p record

No comments:

Post a Comment

Thank for comment.