View previous topic :: View next topic |
Author |
Message |
nadh Intermediate
Joined: 08 Oct 2004 Posts: 192 Topics: 89
|
Posted: Thu Mar 18, 2010 11:15 am Post subject: Corresponding values from two files into one file. |
|
|
Hi.
I've a requirement as below.
I've one file. Its format is as below.
[code:1:f727a0e074]
Company 01 |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Mar 18, 2010 11:26 am Post subject: |
|
|
nadh,
I don't see a single matching record. what are you matching? what is the LRECL and RECFM of both files? _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
nadh Intermediate
Joined: 08 Oct 2004 Posts: 192 Topics: 89
|
Posted: Thu Mar 18, 2010 11:41 am Post subject: |
|
|
Kolusu,
LRECL of First file is 50 and for second file is 53. The final file LRECL is 27.
I need to consider only records that have a Y in position 41 in first file and I should take the BAN Number from the second file and write into new file having only
Customer Number Pos 01 - 13
Filler Pos 14
BAN Nunber Pos 15 - 27
these 3 fields. orgnl_sys_acct_id is customer number in second file.
If any record in first file is having 'y' at 41 position i should take it and check for matching record in second file and take the ban number and write into new file.
Thanks & Regards
Nadh |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Mar 18, 2010 12:15 pm Post subject: |
|
|
nadh,
nadh wrote: | If any record in first file is having 'y' at 41 position i should take it and check for matching record in second file and take the ban number and write into new file. |
ok once again what is the field that you matching in both files?
Is that a cobol layout/file structure and not the actual data you are showing me in the first post? :
Show us a sample Input and desired output and save us from the misery of decrypting your requirements. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
nadh Intermediate
Joined: 08 Oct 2004 Posts: 192 Topics: 89
|
Posted: Thu Mar 18, 2010 12:27 pm Post subject: |
|
|
Sorry Kolusu,
The first file input will be as below and the layout I mentioned above initially
11OH118885023300861000338NNU111003111003N
11OH118885023300861001155NNU062705062705Y
11OH118885023300861002774NNU102604010605Y
11OH118885023300861008662NNU060304060304N
From this first file I need to filter the records that have 'Y' in last column(position 41) CRB BILL is this field in the layout mentioned above.
In this file Customer Number is from position 13 |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Mar 18, 2010 1:14 pm Post subject: |
|
|
nadh,
I wonder what it would take to get a glimpse of file 2 data. You really really need to learn how to explain your requirements. Please provide detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.
In future take this post as reference and post the questions
<requirement begin>
I have 2 files and I need to match them and create an output file and here is my matching rules and info.
1. FIle 1 LRECL=50 RECFM=FB
2. FIle 2 LRECL=53 RECFM=FB
3. I need to include records with a 'y' in position 41 of file 1
4. Match all such records from file1 with key (pos 13 for 13 bytes ) with file 2 key pos 40 for 13 bytes.
5. When match found I need to pick the value from position 9 for 13 bytes from file2 and write it out to the output along with the key
Sample input1
Code: |
----+----1----+----2----+----3----+----4----+----5
3300861000338 N
3300861001155 Y
3300861002774 Y
3300861008662 N
|
Sample input2
Code: |
----+----1----+----2----+----3----+----4----+----5---
1234567890103 3300861000338
1234567890203 3300861001155
1234567890303 3300861002774
1234567890403 3300861008662
|
Desired output (RECFM=FB LRECL = 27)
The 2 and 3 records from file 1 have 'y' and have a match in file 2 , so they are included in output
Code: |
3300861001155 1234567890203
3300861002774 1234567890303
|
<requirement end>
That is how you define your requirements.
With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009), DFSORT now supports the JOINKEYS function which will give you the desired results as shown below
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=Your input FB50 file,DISP=SHR
//SORTJNF2 DD DSN=Your input FB53 file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(13,13,A),INCLUDE=(41,1,CH,EQ,C'Y')
JOINKEYS FILES=F2,FIELDS=(40,13,A)
REFORMAT FIELDS=(F1:13,13,F2:9,13)
SORT FIELDS=COPY
OUTREC BUILD=(1,13,X,14,13)
//* |
For complete details on JOINKEYS and the other new functions available with the Nov, 2009 DFSORT PTF, see:
http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174 _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
nadh Intermediate
Joined: 08 Oct 2004 Posts: 192 Topics: 89
|
Posted: Thu Mar 18, 2010 6:01 pm Post subject: |
|
|
Kolusu,
Super and thank you.
I tested with it working fine. But one correction. as second file (F2) is having duplicate records in output it is writing the duplicates too. What needs to be done to eliminate duplicates into output file.
In output I'm getting like this
Code: |
2520222370288 307880729
2520224912058 308407383
2520225100237 307216551
2520225100237 307216551
2520225100237 307216551
2520225100237 307216551
2520225100237 307216551
|
The desired one should be like
Code: |
2520222370288 307880729
2520224912058 308407383
2520225100237 307216551
|
I'm not aware that duplicates will be there in second file only after testing I came to know sorry for that.
Please suggest how to eliminate duplicates from second file and wrting into output file without duplicates.
Thanks & Regards
Nadh |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Mar 18, 2010 6:28 pm Post subject: |
|
|
nadh,
Add the following 2 lines after OUTREC
Code: |
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,13,HEADER3=(1,27))
|
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
nadh Intermediate
Joined: 08 Oct 2004 Posts: 192 Topics: 89
|
Posted: Thu Mar 18, 2010 7:02 pm Post subject: |
|
|
Kolusu,
Super. Its working fine.
Thankyou somuch.
Thanks & Regards
Nadh |
|
Back to top |
|
|
nadh Intermediate
Joined: 08 Oct 2004 Posts: 192 Topics: 89
|
Posted: Fri Mar 19, 2010 9:21 am Post subject: |
|
|
Kolusu,
Can I know what the below statements mean in sort cards.
Code: |
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,13,HEADER3=(1,27))
|
Thanks & Regards
Nadh |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Fri Mar 19, 2010 10:39 am Post subject: |
|
|
nadh wrote: | Kolusu,
Can I know what the below statements mean in sort cards.
|
nadh,
1. Click on "Quick Manuals" on top of this page
2. Scroll down to "Utilities"
3. Click on "Getting Started with DFSORT"
4. Read chapter 2.6.8 _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
nadh Intermediate
Joined: 08 Oct 2004 Posts: 192 Topics: 89
|
Posted: Fri Mar 19, 2010 12:07 pm Post subject: |
|
|
Thank you Kolusu.
Good Material.
Thanks & Regards
Nadh |
|
Back to top |
|
|
|
|