INPUTfile:1
-------------
VSAMfile,KEY=(1,8,CH)
field1=(10,2,BI)
Have duplicate keys in file
Inputfile-2
--------------
PDS member,key =(1,8,CH)
NO duplicate keys in file.
I need to match these 2 files in SORT (joinkeys) and have to append the field1 for the matched records present in inputfile-2.the field-1 should be appended from the last matched record in input file-1.while appending the field-1 we should covert into displayable format(FS).
I can do it in sort in multiple steps(using joinkeys,outrec fields,remove cc,no detail) and i tried.
but I need to do it in one step.I believe
it is feasible.please help.
also let me know if you are not clear with my requirement.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
No, it is an issue with you not Code'ing and Preview'ing in the first place, so that you can ensure that we see your data how you should want us to see - like you see it, and with all the spacing you put into it. We don't want to spend our time making your information usable, we want you to do that in the first place. We absolutely do not want to guess what your data looks like if you are so unconcerned as to not bother with it much yourself.
And show your sort cards. As Pandora-Box and Sqlcode1 are alluding, what you say does not make sense.
Hi Sorry for the confusion.Yes its like what Pandora-Box mentioned.
Here is my SYSIN
Code:
//JNF1CNTL DD *
INREC BUILD=(5,09,10:14,2,BI,TO=ZD,LENGTH=5) - convering BI to ZD in VSAM file
/*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(01,08,A)
JOINKEYS FILE=F2,FIELDS=(01,08,A)
REFORMAT FIELDS=(F2:01,8,F1:10,05)
OPTION COPY
/*
Here I could get all the matched records as expected.but I couldnt get the field1 in diaplayable format it is coming in same binary format even i converted it in INREC BUILD.
Please advise me where I am wrong??
also I have to get only the last matched record for each key.Can I use REMOVE CC,NO DETAIL in JOINkeys????
Now all I need is I want to just keep my last matched record for each key.I dont want all matched records.Can i do it here??? USing REMOVE CC ,NODETAIL .
I have used REMOVE CC,NO DETAIL to get last record of PS but here I want to get the last record for every matched KEY.Please advise
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
A JOINKEYS application is in two parts. The JOINKEYS task (actually there are two of them) and the maintask.
In the maintask you can do your OUTFIL with REMOVECC,NODETAIL etc. Try it and post your results, please, as it may help someone else in the future.
If you are successfully using 5,9, that is OK as it means you are using the VSAM as a variable-length record file, and a pseudo-RDW is generated, which you then ignore by starting at position 5.