Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need to search in 3 files and write output - Syncsort v1.2.3

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Mar 24, 2009 9:35 pm    Post subject: Need to search in 3 files and write output - Syncsort v1.2.3
Reply with quote

Hi,

We are using SYNCSORT FOR Z/OS 1.2.3.1R. My requirement is as explained at the bottom after these files.

Input File-1:
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7
XXX012 ACCAF8AYCCV4DT4GARJ67LXVMH8NE9QQ5T3XUDBVK8VOEVOHVORVZA 201
XXX012 W1SZ23AB1AB2AB3AB4AB5AB6AB7AB8AB9BA1BA2BA3BA4BA5ZSDX1U 202
XXX012 W1YY231SD91U                                           203
YYY013 ACCAF8AYCCV4DT4GARJ67LXVMH8NE9QQ5T3XUDBVK8VOEVOHVORVZA 201
YYY013 W1YY231SA51U                                           202


Input File-2:
Code:

ACC
AF8
J67


Input File-3:
Code:

1SA
1SB
1SD


Input File-4:
Code:

51U
91U
71U


Requirement: Read the "Input File-1" from 18th column for each 3 bytes upto 61st column and search those 3 byte string in"Input File-2", "Input File-3" & "Input File-4". If found, should write to three different output files. Means, say "ACC" & "AF8" are found in "Input File-2" then the should go to "Output File-2". If "1SA" is found in "Input File-3" then it should go to "Output File-3" and if "91U" is found in "Input File-4" then it should go to "Output File-4".

Output File-2:
Code:

XXX012 ACC AF8
YYY013 ACC AF8


Output File-3:
Code:

XXX012 1SD
YYY013 1SA


Output File-4:
Code:

XXX012 91U
YYY013 51U


Please let me know if I have explained my requirement clearly.

Thanks for all your help.
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2180
Location: @my desk

PostPosted: Wed Mar 25, 2009 9:22 am    Post subject:
Reply with quote

Quote:
Read the "Input File-1" from 18th column
Is this 18th or 8th?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2180
Location: @my desk

PostPosted: Wed Mar 25, 2009 9:29 am    Post subject:
Reply with quote

Ramsri,

If you have only a few values to be checked as shown above, I think it would be much easier to go for a cobol solution.
Code:
Read the file-record into a structure with an array

Evaluate each element in the array
             When 'a' or 'b' or 'c'
                      Write Output1
             When 'd' or 'e' or 'f'
                      Write Output2
............
............
............
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Mar 25, 2009 11:55 am    Post subject: Reply to: Need to search in 3 files and write output - Syncs
Reply with quote

Arun, sorry.......it is 8th column only. They are not few values they are going to be 99 unique values we get. Is it possible to achieve using Syncsort?

Thanks.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2180
Location: @my desk

PostPosted: Wed Mar 25, 2009 12:07 pm    Post subject:
Reply with quote

Still I believe this is a good candidate to do some coding.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Mar 25, 2009 2:46 pm    Post subject: Reply to: Need to search in 3 files and write output - Syncs
Reply with quote

Arun, would you please post some pseudo code kind of thing so that I can try to come up with some COBOL for the same...........

I thought SORT is the best and fast to achieve it icon_sad.gif

Thanks.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2180
Location: @my desk

PostPosted: Wed Mar 25, 2009 3:57 pm    Post subject:
Reply with quote

Ramsri,

From whatever I understood so far,

1.Load all the key values into a ws-array along with an additional field to indicate which file it belongs to.
2.Read the input file.
3.For each key from the input, do a search in the ws-array.
4.If found, Populate the output record arrays based on the indicator.
5.Write the output record for each output file only if the respective output array has at least only entry.

Let me know if I missed something.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Mar 25, 2009 4:22 pm    Post subject: Reply to: Need to search in 3 files and write output - Syncs
Reply with quote

Arun, is it possible to do a file to file comparision if I have to do look-up in only one file. I am going to combine all the three files into one file because they come from three different tables and unique values are assured.

Please suggest.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2180
Location: @my desk

PostPosted: Wed Mar 25, 2009 11:41 pm    Post subject:
Reply with quote

Quote:
is it possible to do a file to file comparision
Nothing that I can think of now. icon_rolleyes.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Mar 25, 2009 11:48 pm    Post subject:
Reply with quote

Hello,

Suggest you have spent much more time trying to not write the code than it would have taken to have simply written the code. . .

Keep in mind that if you write proper code, it can be easily maintained and enhanced while some "tricky" non-code solution may not work when the requirement changes. . .
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1239
Location: Richfield, MN, USA

PostPosted: Thu Mar 26, 2009 1:50 am    Post subject:
Reply with quote

You left out at least one "rule". Can input file-2, input file-3, and input file-4 share any values? If so, are records written to ALL of the matching output files or only some of them or only the 1st found? You've been given good pseudo code already. I'd also opt for a COBOL solution.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Mar 26, 2009 9:57 am    Post subject: Reply to: Need to search in 3 files and write output - Syncs
Reply with quote

Yes. Finally, I got it worked with COBOL solution only. Thanks.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2180
Location: @my desk

PostPosted: Thu Mar 26, 2009 10:01 am    Post subject:
Reply with quote

Good to hear it's working. icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 5 Sat Jan 21, 2017 4:02 am
No new posts Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us