Skip to Content
Custom Search

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

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?

Post new comment

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Click the +1 button  below to share it with your friends and colleagues

 

Share this if you liked it!

 

Disclaimer



Who's online

There are currently 2 users and 32 guests online.

Online users

  • siteadmin
  • abhilasha
Dr. Radut | page