View previous topic :: View next topic
|
Author |
Message |
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
I do have a requirement like the one below,
input file1:
Code: |
============
123456789 23456 1976 225 50
123456789 23456 1977 125 50
123456789 23456 1978 425 50
123456789 23456 1979 625 50
123456789 23456 1980 25 50
765878699 12344 1981 245 45
230494729 09097 1982 56 78 |
input file2:
Code: |
============
439879870
123456789
098097868 |
The output needs to be based upon comparing the input
files like the one below:
output file:
Code: |
============
123456789 23456 1976 225 50
123456789 23456 1977 125 50
123456789 23456 1978 425 50
123456789 23456 1979 625 50
123456789 23456 1980 25 50 |
To accomplish this i used joinkeys in jcl, but it dint workout.
Please help me if you have any suggestions. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
To accomplish this i used joinkeys in jcl, but it dint workout.
Please help me if you have any suggestions. |
Do not post "it didn't work". This just wastes everyone's time. . .
You need to post the jcl and sort control statements used as will as the "rules" for getting fro the sample input to the sample output. Mention the recfm and lrecl of all files. Post all of the informational messages generated by the run along with their messag ids. |
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
This is the jcl I have used.
Code: |
//T3849ARS JOB ('SORT'),MSGCLASS=Y,NOTIFY=T3849AR
//STEP01 EXEC PGM=SYNCSORT
//SORTJNF1 DD DISP=SHR,DSN=T3849AR.INPUT2
//SORTJNF2 DD DISP=SHR,DSN=T3849AR.OUTPUT.REPORT
//*** THIS WILL GIVE UNMATCHED RECORDS ***
//SORTOUT DD DSN=T3849AR.OUTPUT,DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,9,A)
JOINKEYS FILE=F2,FIELDS=(21,9,A)
JOIN UNPAIRED,F1,ONLY
SORT FIELDS=COPY
/* |
the lrecl for T3849AR.INPUT2 is 255. record format is VB
the lrecl for T3849AR.OUTPUT.REPORT is 118. record format is VB
the lrecl for T3849AR.OUTPUT is 118. record format is VB
After execution I am getting all the data available in input1, ie) from T3849AR.INPUT2.
I am unable to get what i expected. :-( plz help me |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Code: |
//*** THIS WILL GIVE UNMATCHED RECORDS *** |
Does n't this explain why it's "not working"?
From the sample input and expected output provided, it seems like you need only matched records from file-1 into output.
For this you need to omit the JOIN statement and include the the REFORMAT FIELDS statement to select fields from file-1. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Also since the input is VB, the starting positions of the key fields in JOINKEYS need to be incremented by 4 to take the RDW also into consideration. |
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Hi,
I got the output. This is the jcl. Thought just to share it. Thanks.
Code: |
//T3849ARS JOB ('SORT'),MSGCLASS=Y,NOTIFY=T3849AR
//STEP01 EXEC PGM=SYNCSORT
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SORTJNF1 DD DISP=SHR,DSN=T3849AR.INPUT2
//SORTJNF2 DD DISP=SHR,DSN=T3849AR.INPUT.REPORT
//SORTOUT DD DSN=T3849AR.OUTPUT.REPORT,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS FILE=F1,FIELDS=(5,9,A)
JOINKEYS FILE=F2,FIELDS=(25,9,A)
REFORMAT FIELDS=(F2:1,4,5)
/*
// |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for letting us know
d |
|
Back to top |
|
|
|