OK. Did you try anything or just seeking for ready solutions? This task looks very basic for JOINKEYs and you can try by learning form JOINKEYS application examples. If you don't like this link then there are plenty on this website that you can go thru.
If you still face any issues then post back with the details and we will assist your further.
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
It is not fully clear to me if the second dataset is single line with seqno or multi line. At first however it looks like a big mess..
Assuming seqno is always the last value in a line you could try the following:
- On INREC temporary extend the record by LRECL using OVERLAY/BUILD
- At Position LRECL+1 use 1,LRECL,JFY=(SHIFT=RIGHT))
- You now have fixed columns for the seqno at the very right
- Do some preps for keeping the right sequence of records as well
- Joinkeys as desired
- Postprocessing
Joinkeys are padding the records adjacent to it like,
1-250(first record with seq no as 00001)1-250(second record with seq no as 00001) - This happens when I give the LRECL to 500. If I give it as 250 I do not get the record from second file at all.
But I would need,
1-250 (first record) - assuming seq no is 00001
1-250(second record) - assuming seq no is 00001
1-250(second record) - assuming seq no is 00001
1-250 (first record) - assuming seq no is 00002
1-250(second record) - assuming seq no is 00002
1-250(second record) - assuming seq no is 00002
1-250(second record) - assuming seq no is 00002
I tried to use the same logic for my code and i modified it as follows based on the LRECL I need, but I got duplicates getting fetched. I did not get the correct output. I did not understand why 162 was chosen to add sequence. I believe its a imaginary position chosen to add seq no. I explored to find the options for BUILD but could not get what I need.
This is what I modified,
From 246, 6 bytes is the key 000001. I added seq numbers from 251, 3 bytes. The increment is coming correctly. Now I assume my record will be like,
1 - 244 (File 1) | 245 - 250 (seq no 6 bytes) | 251 - 253 (seq no 3 bytes via PUSH) | 1- 250 (File 2). The I gave the build to split and write the record,
Code:
BUILD=(/,254,250,/,01,250)),
I got many duplicate records. So need your help to confirm if my understanding is correct ?.
This statement creates intermediate records of 250+1+250=501 bytes long each.
The '?' stands for "matching indicator byte"; in fact it's not used in this particular case (but you might need it in further adjustments for new requirements, so leave it in place for not to re-calculate byte offsets in the future). That's why the second part of combined record begins not in position 251, but 252!
Please, re-consider the new offsets you have updated in your sample of code.
The parameter
Code:
BUILD=(/,N1,L1,/,N2,L2)
creates TWO output records from ONE combined record (plus empty record before each group, if needed).
As said before, another option is: using parameters SECTIONS=, and HEADER3=. It may be more obvious in some cases.
If this is not clear, then:
1) RTFM
2) Switch to the Beginner's Forum.