Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Compare 2 files based on keys and replace data in 2nd file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Kunal Surpurkar

New User


Joined: 15 Nov 2012
Posts: 47
Location: India

PostPosted: Mon Jan 27, 2014 10:01 pm    Post subject: Compare 2 files based on keys and replace data in 2nd file
Reply with quote

Dear Team,

I have a requirement wherein, I need to sort 2 files each of RECFM=VB, LRECL=300 based on 2 key fields. These two files have different structures.

Key fields in both the files are IPAIPRO and CONTMES.

First file :

IPAIPRO starts at 1st position and its length is 7
CONTMES starts at 194 position and its length is 4.

Second file :

IPAIPRO starts at 1st position and its length is 7
CONTMES starts at 218 position and its length is 4.

I have used the join keys concept here to get the matching records.

Code:
JOINKEYS FILE=F1,FIELDS=(5,7,A,222,4,A),SORTED,NOSEQCK   
JOINKEYS FILE=F2,FIELDS=(5,7,A,198,4,A),SORTED,NOSEQCK   
OPTION COPY                                               
REFORMAT FIELDS=(F1:5,261)                               
OUTFIL FNAMES=COMMON



Apart from getting the matching records, I need to replace the data from 202 column to 216 (length=15) of second file to 192 position of first file.
Also, replace the data from 217 column (15 length) of second file to 207 position of first file.
And also, replace the data from 232 column (15 length) of second file to 177 position of first file in the matched common output file.


It would be really great if someone can provide me with the JCL which does the above functionality.

Kindly let me know incase more information is needed.

Thanks a lot in advance.
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Mon Jan 27, 2014 10:36 pm    Post subject: Reply to: Compare 2 files based on keys and replace data in
Reply with quote

As you have posted in the JCL section of the forum I presume you want the SYNCSORT JCL. This is described in the SYNCSORT manual or you could simply look at the JCL used by other sort executions in your shop.

But...JCL cannot do what you are wanting - it will only tell the OS what program you want run and what resources it needs.

To get Syncsort to do what you want you have to give it control 'cards' which you should find in the Syncsort manual. You will also find examples throughout the JCL part of the forum and you may find that the DFSort equivalent will also work.
Back to top
View user's profile Send private message
Kunal Surpurkar

New User


Joined: 15 Nov 2012
Posts: 47
Location: India

PostPosted: Mon Jan 27, 2014 11:01 pm    Post subject:
Reply with quote

Dear Nic,

Thanks for the reply.

Yes, I am speaking about JOIN KEYS in SORT utility. I could get the matching records based on the keys as mentioned above. This, I could do using the example posted in the forum.

However, I could not find any example related to replacing the data from the 2nd file into 1st file based on the fields of the matched file which is obtained from JOIN KEYS SORT.

If you can let me know the syntax to include these conditions(Replacing the data) in JOIN KEYS, It would be really helpful to me.

Thanks a lot !
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Tue Jan 28, 2014 1:55 pm    Post subject:
Reply with quote

Kunal,

Why not write another output file with required fields from both files.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Tue Feb 04, 2014 6:25 am    Post subject:
Reply with quote

Kunal,

Welcome to the forum, a little search could give you close to what is expected, please have a look at the below link and see if that helps to you.. icon_smile.gif

http://ibmmainframes.com/about58979-0.html
Back to top
View user's profile Send private message
Kunal Surpurkar

New User


Joined: 15 Nov 2012
Posts: 47
Location: India

PostPosted: Fri Feb 07, 2014 6:57 pm    Post subject:
Reply with quote

Dear Team,

Thanks for the help provided. I got what I wanted using the below sort card.

Code:
JOINKEYS F1=IN1,FIELDS=(5,7,A,222,4,A),SORTED,NOSEQCK     
JOINKEYS F2=IN2,FIELDS=(5,7,A,198,4,A),SORTED,NOSEQCK     
REFORMAT FIELDS=(F1:5,172,F2:232,15,F1:192,109)           
SORT FIELDS=COPY


Thanks a lot for your time :-)
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Tue Feb 11, 2014 1:30 pm    Post subject:
Reply with quote

Glad you have got it, but you said they are VB files also did you check the above link?
Back to top
View user's profile Send private message
Kunal Surpurkar

New User


Joined: 15 Nov 2012
Posts: 47
Location: India

PostPosted: Tue Feb 11, 2014 3:47 pm    Post subject:
Reply with quote

Dear Rohit,

Yes, they are VB files. Hence, I used position 5 in JOINKEYS and REFORMAT FIELDS.

And yes, I did go through the link posted by you. It was helpful too :-)

Once again, Thanks for your time !!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us