Monday, January 24, 2011

To copy few fields from input file to output using Sort

//STEP030  EXEC  PGM=SORT                                              
//SYSOUT   DD  SYSOUT=*                                                
//SORTIN   DD  DSN=PCCUL.DC69.OFFLINE.ARCHIVE(0),                      
//             DISP=SHR                                                
//SORTOUT  DD  DSN=TCCPU.DC69.OFFLINE.SORTED.NEW,                      
//             DISP=(,CATLG,DELETE),                                   
//             UNIT=SYSDA,                                             
//             SPACE=(CYL,(300,150),RLSE)                              
//SYSIN    DD  *                                                       
  SORT FIELDS=(2,10,CH,A,12,3,PD,A,15,2,PD,A,17,4,CH,A)                
  INCLUDE COND=(2,10,CH,EQ,C'ELELA01158',OR,2,10,CH,EQ,C'ELELA01167',  
               OR,2,10,CH,EQ,C'ELELA01169',OR,2,10,CH,EQ,C'ELELA01271',
               OR,2,10,CH,EQ,C'ELELA01272',OR,2,10,CH,EQ,C'ELELA01274',
               OR,2,10,CH,EQ,C'ELELA01275',OR,2,10,CH,EQ,C'ELELA01281',
               OR,2,10,CH,EQ,C'ELELA01293',OR,2,10,CH,EQ,C'ELELA01368',
               OR,2,10,CH,EQ,C'ELELA01370',OR,2,10,CH,EQ,C'ELELA01390')
  OUTREC FIELDS=(2,19,50,1)                                            
//*


This sorts the input file based on the condition
and copies the data to output if the criteria is met in position 2,10 and copies only 19 characters starting from position 2 and 1 character from position 50. So output length will be 20characters
              
 

No comments:

Post a Comment