SORT JCL to put SPACES end of record using INREC or OUTREC

 

SORT JCL to put SPACES end of record using INREC or OUTREC
 
 
Consider the following 
 
The following sort card will take data from 8th pos (3 bytes) and put at 1st pos (3bytes) and take data from 60th pos(8bytes) 
and put at 10th position. The data from pos 4th position to 9th position will have spaces (Hex value '40') and the data 
from 19th position to end of file will have low values (hex value '00')
 
 
SORT FIELDS=COPY,STOPAFT=100 
INREC FIELDS=(1:8,3,10:60,8) 
; ; ; ;
 
 
The following image shows that there are spaces between the fields selected by INREC but has low values at the end of the record
 
 
Hex view of the above file
 
 
If you wish to have spaces at the end of each record instead of low values then use either of the sort cards
 
SORT FIELDS=COPY,STOPAFT=100     
INREC FIELDS=(1:8,3,10:60,8,69X) 
 
or
 
SORT FIELDS=COPY,STOPAFT=100       
INREC FIELDS=(1:8,3,10:60,8,69C' ')
 
 
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=100     
INREC FIELDS=(1:8,3,10:60,8,69X) 
/*                                                   
//*