|
View previous topic :: View next topic
|
| Author |
Message |
Kunal Surpurkar
New User
Joined: 15 Nov 2012 Posts: 47 Location: India
|
|
|
|
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 |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
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 |
|
 |
Kunal Surpurkar
New User
Joined: 15 Nov 2012 Posts: 47 Location: India
|
|
|
|
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 |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Kunal,
Why not write another output file with required fields from both files. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
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..
ibmmainframes.com/about58979-0.html |
|
| Back to top |
|
 |
Kunal Surpurkar
New User
Joined: 15 Nov 2012 Posts: 47 Location: India
|
|
|
|
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 |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
| Glad you have got it, but you said they are VB files also did you check the above link? |
|
| Back to top |
|
 |
Kunal Surpurkar
New User
Joined: 15 Nov 2012 Posts: 47 Location: India
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|