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. ; ; ; ; //SORTIN   DD DISP=SHR,DSN=USERID.ABC.INPFILE, //SORTOUT  DD DSN=USERID.ABC.OUTFILE, //      SPACE=(TRK,(30,10),RLSE),                                 //      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)      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) OUTREC FIELDS=(1:7,3,4:56,4)