MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Copy value from one file to another

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
arvibala
Beginner


Joined: 12 Feb 2008
Posts: 142
Topics: 67

PostPosted: Wed Oct 13, 2010 10:57 am    Post subject: Copy value from one file to another Reply with quote

Below are the 2 input files

File 1 : MSGID (col 1 - 36) - 200 length file

File 2 : has header detailed and trailer records - 200 length file

01 - Header
02 - Detailed
02 - Detailed
02 - Detailed
02 - Detailed
03 - Trailer

I need to insert the MSGID from File 1 to header (01) record in file 2 at position 30.

Can anyone help with a SORT Jcl for this?
_________________
Arvind
"You can make a difference with your smile. Have that with you always"
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Oct 13, 2010 12:47 pm    Post subject: Reply with quote

arvibala,

The following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//INA      DD DSN=Your File with header detailed and trailer records,DISP=SHR
//INB      DD DSN=Your MSGID file,DISP=SHR                         
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  OPTION COPY                                           
  JOINKEYS F1=INA,FIELDS=(201,08,A),SORTED,NOSEQCK     
  JOINKEYS F2=INB,FIELDS=(201,08,A),SORTED,NOSEQCK     
  JOIN UNPAIRED                                         
  REFORMAT FIELDS=(F1:1,200,?,F2:1,36)                 
  OUTFIL IFOUTLEN=200,                                 
  IFTHEN=(WHEN=(201,1,CH,EQ,C'B'),OVERLAY=(30:202,36)) 
//JNF1CNTL DD *                                         
  INREC OVERLAY=(201:SEQNUM,8,ZD)                       
//JNF2CNTL DD *                                         
  OPTION STOPAFT=1                                     
  INREC OVERLAY=(201:SEQNUM,8,ZD)                       
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group