SORT JCL to Mask output data

 

SORT JCL to Mask output data  
 
 
If you wish to format the data then  you can specify the edit mask by using the following sort card. In this card
The date in the 60th position in the input file is in the format YYYYMMDD and in the output file it will be formatted
as YYYY-MM-DD. You can even tweak with this card and have the format as MM-DD-YYYY, try it out.
 
SORT FIELDS=COPY,STOPAFT=10                       
OUTREC FIELDS=(1:60,8,ZD,EDIT=(TTTT-TT-TT))
 
Example JCL is provided below.
; ; ; ;
 
//SETP001  EXEC PGM=SORT                                         
//SYSPRINT DD SYSOUT=*                                           
//SYSOUT   DD SYSOUT=*                                           
//SYSUDUMP DD SYSOUT=*                                           
//REPORT1  DD SYSOUT=*                                           
//SORTIN   DD DISP=SHR,DSN=USERID.ABC.INPFILE,
//SORTOUT  DD DSN=USERID.ABC.OUTFILE,
//      DISP=(,CATLG),                                           
//      SPACE=(TRK,(30,10),RLSE),                                
//      UNIT=SYSDA,                                              
//      DCB=(RECFM=FB,LRECL=80,BLKSIZE=0,DSORG=PS)               
//SORTWK01 DD  UNIT=DISK,SPACE=(CYL,(20,5),RLSE)                 
//SORTWK02 DD  UNIT=DISK,SPACE=(CYL,(20,5),RLSE)     
//SORTWK03 DD  UNIT=DISK,SPACE=(CYL,(20,5),RLSE)     
//SYSIN    DD *                                      
SORT FIELDS=COPY,STOPAFT=10                       
OUTREC FIELDS=(1:60,8,ZD,EDIT=(TTTT-TT-TT))
/*                                                   
//*  
 
 
Note:- OUTREC works the same way as INREC. However INREC is more efficient than OUTREC as INREC first filters the records and then 
sorts the output records, while in case of OUTREC the sorting happens on the input file prior to filtering the records.
 
In the following sort card the OUTREC statement will take the sorted data from 7th pos (3 bytes) and put at positions 1st(3bytes) in the
output file and take data from 56th position (4 bytes) and put at position 4th (4bytes)
 
SORT FIELDS=(1,3,CH,A)
OUTREC FIELDS=(1:7,3,4:56,4)

Comments

Ch in outrec for the field to be masked

Can't we use CH in the Outrec statement for the field for which we are doing masking.

I am getting abend when I use CH instead of ZD. With ZD it is working fine.   

 

 SORT FIELDS=(34,8,CH,A)                                   
 OUTREC FIELDS=(1:6,8,CH,EDIT=(TTTT-TT-TT),12:34,8,80C' ')