|
View previous topic :: View next topic
|
| Author |
Message |
Arunkumar Chandrasekaran
New User

Joined: 01 Jun 2010 Posts: 63 Location: India
|
|
|
|
Hi,
I am having 2 input files.
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).
Input file-1
---------------
| Code: |
AAAAAAAA 12
AAAAAAAA 15
AAAAAAAA 10
BBBBBBBB 78
BBBBBBBB 66
CCCCCCC 34
CCCCCCC 56 |
input file-2
------------
| Code: |
AAAAAAAA
BBBBBBBB
CCCCCCC |
OUTPUT:
----------
| Code: |
AAAAAAAA 10
BBBBBBBB 66
CCCCCCC 56 |
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.
Code'd |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
What have tried so far?
Show us input and output with the control cards used in code tags please |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Arunkumar Chandrasekaran,
Do you have numbers in varying positions in your input OR is this an just an issue with the way your data was "Code'd"?
Regardless,
| Quote: |
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 ... |
This is still one step process. Unless you coded different cards for each of this.
Thanks, |
|
| Back to top |
|
 |
Arunkumar Chandrasekaran
New User

Joined: 01 Jun 2010 Posts: 63 Location: India
|
|
|
|
Hi,
No i am not having varying positions.its the issue with "Code'd". |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
If yes please provide your input with code tags ??
or confirm if this is how your input File 1 looks like
| Code: |
AAAAAAAA 12
AAAAAAAA 15
AAAAAAAA 10
BBBBBBBB 78
BBBBBBBB 66
CCCCCCC 34
CCCCCCC 56 |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
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. |
|
| Back to top |
|
 |
Arunkumar Chandrasekaran
New User

Joined: 01 Jun 2010 Posts: 63 Location: India
|
|
|
|
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???? |
|
| Back to top |
|
 |
Pandora-Box
Global Moderator
.jpg)
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
| Why did you use INREC BUILD 5,9 here |
|
| Back to top |
|
 |
Arunkumar Chandrasekaran
New User

Joined: 01 Jun 2010 Posts: 63 Location: India
|
|
|
|
Hi I wanted to copy the first 9 data bytes of my VSAM file as it is.Thats why I did it.Is it wrong??
Now I modified my SYSIN and now I can get the BI in displayable format.
| Code: |
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(01,08,A)
JOINKEYS FILE=F2,FIELDS=(01,08,A)
REFORMAT FIELDS=(F2:01,8,F1:10,02)
OUTREC FIELDS=(1,8,9,2,BI,TO=FS,LENGTH=5)
OPTION COPY
|
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 |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
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. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Arunkumar Chandrasekaran,
use the following control cards.
| Code: |
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(1,8,A),TYPE=F
JOINKEYS F2=INB,FIELDS=(1,8,A)
REFORMAT FIELDS=(F2:1,8,F1:10,2)
INREC OVERLAY=(9:9,2,BI,TO=FS,LENGTH=5)
OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,8,TRAILER3=(1,13))
//* |
|
|
| Back to top |
|
 |
Arunkumar Chandrasekaran
New User

Joined: 01 Jun 2010 Posts: 63 Location: India
|
|
|
|
@Skolusu
Hi I tried this and working perfect!!!!!!!!!!!
Thanks a lot for all !!!! |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|