SORT JCL to append data in a record using INREC or OUTREC

 

SORT JCL to append data in a record using INREC or OUTREC
 
 
There may be instances when you wish to append some data at the end or
between a record. The following SORT parm will come handy in such situations
 
The following sort card will add char 'LITERAL' in the output file at 5th position.
 
SORT FIELDS=COPY
INREC FIELDS=(1:7,3,4:56,4,5:C'LITERAL')
 
 
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
INREC FIELDS=(1:7,3,4:56,4,5:C'LITERAL')
/*                                                   
//*  

Comments

INREC FIELDS=(1:7,3,4:56,4,5:C'LITERAL')
is this right?
because
1:7,3 occupies a length of 3
4:56,4 occupies alength of 4
5:C'LITERAL'

I guess instead of 5 it should be 8, Is this right?