MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Looking up multiple files using SORT

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Fri Dec 05, 2008 12:11 pm    Post subject: Looking up multiple files using SORT Reply with quote

Hi,

Is it possible to do multiple file look up using SORT? File01 has some records and these should be searched in 4 other files and if found should be written to four different output files - using SORT.

Please suggest.

Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Dec 05, 2008 1:47 pm    Post subject: Reply with quote

Please show an example of the records in each input file and what you want for output. Give the RECFM and LRECL of the input files. Give the starting position, length and format of all relevant fields. If there can be duplicates within any of the input files, show that in the example.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Mon Dec 08, 2008 2:52 pm    Post subject: Reply with quote

Also, is there a field in each record to identify which file the record is from?
_________________
Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Tue Dec 09, 2008 8:57 am    Post subject: Data Reply with quote

All the files are LRECL=80 and RECFM=FB. Duplicates are certainly possible. The look up should happen based on 1st column with a length of 3 and 20th column with a length of 6. All the matching records should be written to respective output files else an empty file.

This is how data appears......

File01:

Code:

---------1---------2---------3---------4---------5---------6---------7---------8
T0N                XMDT0N     73             CHRI35        2039         TS1     
TJQ                TCDTJQ     73             MAJORS        2039         TS2     


Data in File02:

Code:

T0N                XMDT0N     73             CHRI35        2039         TS1     
TJQ                TCDTJQ     73             MAJORS        2039         TS2     
T0N                XMDT0N     73             CHRI35        2039         TS1     
TJQ                TCDTJQ     73             MAJORS        2039         TS2     
T0N                XMDT0N     73             CHRI35        2039         TS1     
TJQ                TCDTJQ     73             MAJORS        2039         TS2     


Data in File03:

Code:

T0N                XMDT0N     73             CHRI35        2039         TS1     
FJQ                TCDFJQ     73             MAJORS        2039         TS2     
F0X                XMDF0X     73             CHRI35        2039         TS1     
TJQ                TCDTJQ     73             MAJORS        2039         TS2     


Data in File04:

Code:

FJQ                TCDFJQ     73             MAJORS        2039         TS2     
F0X                XMDF0X     73             CHRI35        2039         TS1     
TJQ                TCDTJQ     73             MAJORS        2039         TS2     


Data in File05:

Code:

TJQ                TCDTJQ     73             MAJORS        2039         TS2     


Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Dec 09, 2008 11:41 am    Post subject: Reply with quote

ranga_subham,

Does file 1 contains duplicates ? Do you expect FILE 1 to be huge? It is just a look up file how many records does it have now? what is the expected output ?

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Wed Dec 10, 2008 1:14 am    Post subject: Reply with quote

Kolusu, the File01 possibly will have 1000 records which are put by end-user. It cannot have duplicates. Each individual output file should have all those matching records (including duplicates too) from File01.

Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Thu Dec 11, 2008 6:23 am    Post subject: Required Output: Reply with quote

The expected output should be this.....

Output-File02:
Code:

T0N                XMDT0N     73             CHRI35        2039         TS1     
TJQ                TCDTJQ     73             MAJORS        2039         TS2     
T0N                XMDT0N     73             CHRI35        2039         TS1     
TJQ                TCDTJQ     73             MAJORS        2039         TS2     
T0N                XMDT0N     73             CHRI35        2039         TS1     
TJQ                TCDTJQ     73             MAJORS        2039         TS2     


Output-File03:
Code:

T0N                XMDT0N     73             CHRI35        2039         TS1
TJQ                TCDTJQ     73             MAJORS        2039         TS2


Output-File04:
Code:

TJQ                TCDTJQ     73             MAJORS        2039         TS2


Output-File05:
Code:

TJQ                TCDTJQ     73             MAJORS        2039         TS2


Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
samlwho
Beginner


Joined: 08 Feb 2007
Posts: 21
Topics: 2

PostPosted: Fri Dec 12, 2008 2:56 pm    Post subject: Reply with quote

If I understand your dilemma correctly, the SYNCSORT JOIN below will produce what you desire. In the example below, the F1 is File01 and F2 is DataFile02.

Syncsort Parameters :
JOINKEYS = Matching position 1,3 and 20,6 is the same as matching on 1,25. As such, the key for both files are positions 1,25.

JOIN UNPAIRED = Results in Syncsort writing an output file that contains records with matching keys as well as unmatched records from both files.

REFORMAT FIELDS = Defines the output file. Here, the total record is written from both files. By doing this the Include verb can be used to create three different files.
1. Records that match
2. Records that are on F1 only
3. Records that are on F2 only

Note: The step below would need to be replicated four times for each input file and each step will result in listed output files.

I hope this helps
Back to top
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Mon Dec 15, 2008 4:39 am    Post subject: Reply with quote

I will try it and let you know.

Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Mon Dec 15, 2008 8:55 am    Post subject: Reply with quote

SAMLWHO, what will happen to File03, File04 & File05 ? Where are they referred?

Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group