I have a requirement in my current project and looking to solve it without using a program.
I have two files, Say File1 and File2.
Requirement is:- Take 1st record from File1 and scan the File2 one by one record and Fetch the matching record from File2 and write it into a output file File3. Do not stop if we found the match in file2. Scan the complete file2 and write all the matching records from File2.
Please note- We would be having duplicates or SPACES on all the below mentioned fields. We should not consider match on Spaces and keep moving till the end of File2.
Match Conditions are--
IF Field-1A = Field-2A OR Field-1B = Field-2B OR Field-1C = Field-2C OR Field-1A = Field-2D OR Field-1B = Field-2E
-------------------------------------------------------------------
File1 has LRECL=150, I have mentioned THREE specific fields which we used for matching creteria as below.....
Field-1A==> Position=(13~21), Length=9
Field-1B==> Position=(22~33), Length=12
Field-1C==> Position=(39~45), Length=7
File2 has LRECL=550, Here, I have mentioned FIVE specific fields which we used for matching creteria as below.....
Field-2A==> Position=(1~9), Length=9
Field-2B==> Position=(10~21), Length=12
Field-2C==> Position=(22~28), Length=7
Field-2D==> Position=(29~37), Length=9
Field-2E==> Position=(38~49), Length=12
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Please show an example of the records in each input file (relevant fields only) and what you expect for output. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
Also, run this job and show the //SYSOUT messages you receive, so I can see what level you're at:
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
How many records in each file?
"We should not consider match on Spaces " so If a field in file 1 is spaces and the field in file 2 it is to matched against is spaces that would not be considered as a match?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Deepak,
Quote:
Should i run this job as it is
Yes. Just run the job as is and show me the //SYSOUT messages. The job just copies one record, but that doesn't matter - it's just a way to print out the DFSORT messages so I can see what level you're at.
Quote:
Please show an example of the records in each input file (relevant fields only) and what you expect for output.
I want you to show me the expected output records for a sample of input records. That will help me understand what you're trying to do. It would be best if you showed input records and expected output that illustrate the various situations you need to deal with.
Just a FYI... I am trying to extract all the security records from security file(FILE2) related to the Positions we recived in Position file(FILE1).. And All the security records would be fetched if..
=> Position file record's CUSIP(Field-1A) is equal to Security file record's CUSIP(Field-2A) or UNDERLYING CUSIP(Field-2D)
=> Position file record's ISIN(Field-1B) is equal to Security file record's ISIN(Field-2B) or UNDERLYING ISIN(Field-2E)
=> Position file record's SEDOL(Field-1C) is equal to Security file record's SEDOL(Field-2C)