Posted: Thu Mar 19, 2009 12:42 pm Post subject: Matching two input files as generic and loading output files
Hi,
I have two input files
INFILE1
INKEY1 2 9 A
INFILE2
INKEY2 1 9 A
Job infile1(inkey1) infile2(inkey2)
OUTFILE FORMAT IS INFILE1(1,12) INFILE2(2,10) INFILE1(22 13) INFILE2(15,6)....
INFILE (1,12) = FROM 1 POSITION TO 12 BYTES
I will match the two input file through keys and want to write into output file for 5 fields ( 2 fields form infile1, 3 fields from outfile2).
For other requirement i will write 6fields in output file. the field position will varies some time from input file1 2 , and inputfile2 from 3.
For other requirement i will write 10fields in output file.
I want to pass through fields size ( from position, length of the field).. any no of fields, and need to write in output file. The fields will varies , some requirement the fields from file1 is 5 , fields from file2 is 6.
I want to pass fields position through parm. generically it can right into output file
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Fri Mar 20, 2009 10:42 am Post subject:
vinothenator_1782 wrote:
Hi, I didn't get any response. Please advise whether my question is understandble or or not?
Vinothenator_1782,
Reasons for no response
1. You are a syncsort customer
2. You would later ask the moderator to delete the topic
3. You haven't provided enough details (LRECL , RECFM ,Sample data ...)
Just an Fyi , I have a solution for FB files but since you are syncsort customer I would let the syncsort folks help you. _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 14 Jan 2009 Posts: 37 Topics: 0 Location: USA
Posted: Fri Mar 20, 2009 3:10 pm Post subject:
- Thank you, Mr. Kolusu, for the helpful clarification that vinothenator_1782 is a SyncSort user, as this was not mentioned in his post -
vinothenator_1782: I do not understand enough of your description to provide you with an assessment as to whether what you are trying to accomplish is possible using SyncSort, but I will give it a try.
My understanding of the situation, so far, is as follows:
1) You have 2 input files. Some field in File1 contains a 'key' that will correspond to a similar field in File2 (it is unclear from your description where these 'key' fields are located in the respective input files).
2) You want to write the output from the following fields from File1 and File2 whenever the 'key' matches:
File1:
position 1 for a length of 12
position 22 for a length of 13
File2:
position 2 for a length of 10
position 15 for a length of 6
If this is correct, and (for purposes of this coding example) the field containing the common 'key' is located in each file at (for example) the end of each record immediately following the field(s) you have described, then you could use JOIN processing, as in the following example (assuming fixed-length data):
For the File1 'key' field I am assuming a two-byte field starting in position 35, and I am assuming Ascending order.
For the File2 'key field I am assuming a two-byte field starting in position 21, and I am assuming Ascending order.
I have specified SORT FIELDS=COPY since I do not know if you have any requirement to SORT the data.
If you are a SyncSort user, I assume that you have access to the SyncSort for z/OS Programmer's Guide and the supplemental 'Exploiting JOIN' documentation, and I assume that you will be familiar with the appropriate JCL needed for such processing.
The above coding example is meant just to illustrate how JOIN processing can be used to combine fields from two input files based upon matching data contained in a common 'key' field. I have not tested the above syntax, but just wanted to provide a quick example. What you would need to do is specifically define the 'key' field(s), and then whatever fields you need to extract from the two input files in order to create the desired output.
Does this help? If you requre further assistance, please provde more detail (LRECL, RECFM, sample data, etc.), and I will try to help you further. I admit that I do not understand your use of the word "generic" in the context of your post. The type of JOIN processing I envision using requires a specific understanding of the positions and lengths of each field you would need to specify. _________________ Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Fri Mar 20, 2009 8:07 pm Post subject:
kalatur wrote:
I understand why YOU didn't respond, since you are an IBM guy. Are you saying that nobody answers syncsort questions here? Sounds a bit odd.
Kalatur,
I am not sure as to how you interpreted my statement as nobody answering syncsort questions on this board. There are handful of people who answer syncsort questions apart from the syncsort reps on this board. But none of them responded to the question.
1. The question was unanswered for almost 24 hours
2. I do answer most of the questions on this board with exception of questions related to by IBM's Competitive product questions.
3. Last but not least I Own this board and I felt it is my responsibility to give OP a reason as to why his question is left unanswered even though the question is related to a sort product.
For another request
INFILE1 200
INFILE2 500
OUTFILE 150
(35,2,A)
(21,2,A)
F1,FIELDS=(35,2,A)
F2,FIELDS=(21,2,A)
(F1:1,12,F2:2,10,F1:22,13,F2:15,6,F1:200,5,F2:20,2)
I will give only above these details. It should create JCL and has to submite. Please advise is there any tool to generate.
Kolosu , I want to generate as utility , i know we cand do it SYNCSORT or EASTRIEVE PROGRAM as manully. But i will give my details as above mentioned to dynamically, then it should generate JCL.
For above question if moderator having coding, please send me.
Previously do to some reason i asked delete my question in moderator. if moderator feels bad , i am sorry.
Joined: 14 Jan 2009 Posts: 37 Topics: 0 Location: USA
Posted: Mon Mar 23, 2009 3:38 pm Post subject:
vinothenator:
I first ran a step that created the template for my basic control statements. Note the reference to INKEY1, INKEY2 and OUTFILE (I simply used the names you had mentioned):
Using this process you would need to 1) change the name of the output file that would contain the new control statements, and 2) modify the contents of the $ORTPARM DD to reflect the desired values for INKEY1, INKEY2 and OUTFILE.
You would then need to run a third SORT step using the new control statements as the SYSIN DD.
This is simply an example on how to use SyncSort to build control statements. Perhaps this will be of some help to you. _________________ Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Joined: 14 Jan 2009 Posts: 37 Topics: 0 Location: USA
Posted: Tue Mar 24, 2009 5:04 pm Post subject:
vinothenator:
By "pass multiple keys for INFILE1 & INFILE2", do you mean can JOIN processing have multiple key fields? The answer to that is yes. JOIN would require that there be common key field(s) that exist in both files, although they could be at different positions. The common key field can have multiple keys. Example: File1 could have what you refer to as "INKEY1" at position 2 for a length of 9, ascending, and another key at position 50 for a length of 2, descending. "INKEY2" could potentially be at 1 for a length of 9, ascending, and position 201 for a length of 2.
You can use the method I described to provide overrides for whatever values you want to use for the JOINKEYS statements or for the REFORMAT statement, since this is what was designed into the original "template".
Please understand, however, that the coding example I have provided is limited to bulding the control statements for your SYSIN. Have you thought about designing a PROC using symbolics to provide the values you want for your JCL (such as the SORTOUT RECFM)? _________________ Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
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