View previous topic :: View next topic
|
Author |
Message |
vickey_dw
New User
Joined: 10 Jun 2015 Posts: 51 Location: India
|
|
|
|
Hi All
My input data set 1 example
Input data set 2
Code: |
1234
4567
7890
&&&££££
Xxxxxxxx |
Output data set should be
Code: |
AAA
1234
4567
7890
BBB
&&&££££
CCC
Xxxxxxxx
DDD |
Basically after a occurrence of input dat set 1 I want to add records of input data set 2.
It will be a great help if you can give some hint to achieve this.
Sorry I am unable to use code tags here. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
You can easily use the code tags - either hand-craft them or use the full editor and the facilities that it provides.
I do not understand the logic - after the first record from data set 1 you add 3 record from data set 2, after the second record from data set 1 you have indicated oe record from data set 2 and ditto for the third record. Why 3 - 1- 1? What rules?
I will code your original post for you. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Why would you be unable to use the code tags?
There has to be some condition under which you'd know what records go where. I can't discern the condition from the data sample, other an "numbers only" after A, "not letters or numbers" after B and "letters only" after C.
Even if that is what you want, is your data "regular" within that (no other mixtures possible) and is your data "in order" within that?
Or some completely different conditions? |
|
Back to top |
|
|
vickey_dw
New User
Joined: 10 Jun 2015 Posts: 51 Location: India
|
|
|
|
Thanks for the reply!!!
My requirement is to add records first 10 from data set 2 once it finds AAA in data set 1.Then add next 10 record a from data set 2 once it finds BBB in data set 2.
So out will like
Code: |
AAA
1st 10 record of data set 2
BBB
Next 10 record of data set 2
|
For sake of simplicity I have given the above data in post1 but unfortunately I ended up in confusing you.
Hope I am clear now |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
I have corrected your code tags - end tags are denoted by a '/' between the '[' and the 'code'. Using the full editor buttons this will be done automatically for you. Use the 'Preview' button to check your post before submitting it. I have also changed your 'file' to 'data set' as you are dealing with data sets on the mainframe - not files. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
vickey_dw wrote: |
Hope I am clear now |
There are more questions.
How many such records ('AAA', 'BBB'....) do you have in data set-1? Is that a fixed number?. Can the values change during each run?
What about the attributes (RECFM,LRECL..) for data set-1 and data set-2?
Does anything exist in your actual data that helps identify the first record of either input data set? |
|
Back to top |
|
|
vickey_dw
New User
Joined: 10 Jun 2015 Posts: 51 Location: India
|
|
|
|
only two AAA and BBB records are there in the dataset 1.
Dataset two has 20 records out of which first 10 i need to copy after AAA and next 10 after BBB.
These values wont change in run time also.
Dataset1,Dataset 2 and outfile all have LRECL 80 and RECFM is FB |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Thanks. Can you try answering the questions you skipped? |
|
Back to top |
|
|
vickey_dw
New User
Joined: 10 Jun 2015 Posts: 51 Location: India
|
|
|
|
I think i missed below question
Quote: |
Does anything exist in your actual data that helps identify the first record of either input data set? |
Dataset 1 can be identified with first record as AAA
Dataset 2 can have anything not sure how to identify here as it can have any random value. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
JOINKEYS.
Use JNF1CNTL, INREC, WHEN=INIT to assign a sequence number to each (of the two) record.
Use JNF2CNTL, INREC, WHEN=GROUP, RECORDS=10 to assign ID for each group.
The key is the sequence and ID.
SORTED,NOSEQCK
REFORMAT contains all original data for F1 and F2.
In the main task, INREC, WHEN=GROUP, RECORDS=10, append a SEQ.
OUTFIL, IFTHEN=(WHEN=(logical expression to test for one in the SEQ-field appended, BUILD with the slash-operator (/) to output two records (from the F1 and the F2 parts of the REFORMAT record). WHEN=NONE to just BUILD from from the F2 part of the REFORMAT record. |
|
Back to top |
|
|
|