I have a requirement like I need to write out records from file B when there is match of fields in fileA.
The fields in FILE A start from 18 and length is 3 and RECFM=FB
The fields in FILE B start from 2 and length is 3 and RECFM=VB.for this VB file I didnt include RDW.If you inlcude it then it will be from 6 and length is 3.
So when we geta match then we need to include all the records from FILEB. So the output file should also be VB.FILEB may contain duplicate keys. But I need to include those duplicate records also from FILEB so I used withall.
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
You fixed the OUTFIL while I was off looking up the error......
I'm confused too, after the match (?) in the splice, how can you tell which record is from which original file? Don't you need add an identifier in the CTL1 & 2 and then test for in in CTL3?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Frank says:
Start over and show a good example of the records in each input file (relevant fields only) and what you expect for output. Give the RECFM and LRECL of each input file and the RECFM and LRECL you want for the output file. Give the starting position, length and format of each relevant field (for the VB file include the RDW when you give the starting positions). If input file1 can have duplicates within it, show that in your example. If input file2 can have duplicates within it, show that in your example.
My requirement is to write out records from file B when there is match of particular fields against fileA.
File A---> RECFM=FB and LRECL=200 contains the following records
Code:
----+----1----+----2----+----3----+----4----+----5----+----
M 6F3 32010F4208 DOM .. #
M 6F3 32010F4209 DOM .. #
M EO2 10101B10G1 DOM .. #
M KH1 10001EL01A DOM .. #
M 8H1 10001EL01A DOM .. #
File B-----> RECFM=VB and LRECL=4191 contains the following records
So now when in File A position (18,3,CH) and File B position (6,3,CH) matches then I need to write the FILEB record to output file.One more thing is I need the output order of the records should be as same as they exist in FILEB.Here in file B is 6 is relative position actually in the file it exists in 2nd position.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You're getting closer but what about this:
Quote:
If input file1 can have duplicates within it, show that in your example. If input file2 can have duplicates within it, show that in your example.
You said previously that fileB can have duplicate keys but your example seems to have duplicates in fileA but not in fileB. Which file or files can really have duplicates?
Quote:
what you expect for output
You didn't show what you expect for output.
I don't have time for guessing games so please give me all of the information I asked for. Show an example with duplicates in one or both input files as appropriate and show the expected output.