|
View previous topic :: View next topic
|
| Author |
Message |
itmanand
New User
Joined: 18 Dec 2008 Posts: 24 Location: Newyork
|
|
|
|
I have two files in this format
1. File 1
01101 XXXXX
01102 YYYYY
01103 BBBB
2. File 2
01102 ....................
01103 ....................
In file 2, the first 6 chars are hexadecimal.
My requirement is if that if the first 6 chars in file 1 match with file 2,
then I need to add an indicator at the last position.
Output
01101 XXXXX N
01102 YYYYY Y
01103 BBBB Y
Can someone help me on this? |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
| My requirement is if that if the first 6 chars in file 1 match with file 2, then I need to add an indicator at the last position. |
It actually looks like you're adding an indicator in either case (N for no match and Y for a match) - right?
| Quote: |
| In file 2, the first 6 chars are hexadecimal. |
So in file2, are those first 6 chars are in 3 bytes (X'011101')?
In file1, are the first 6 characters actually characters (C'011101') or are they also hex?
What is the RECFM and LRECL of each input file?
What is the starting position, length and format of each field?
Can file1 have duplicates within it?
Can file2 have duplicates within it?
Can file 1 have a match value that is not in file2?
Can file2 have a match value that is not in file1?
Please show a better example of the records in each input file and what you expect for output with all possible variations. |
|
| Back to top |
|
 |
itmanand
New User
Joined: 18 Dec 2008 Posts: 24 Location: Newyork
|
|
|
|
The length of both files is 80 bytes, FB.
1. Both file 1 and file 2 can have duplicates.
2. It's basically like this. Write file 1 to output. If the first 6 bytes in file 1 are available in file 2, then put indicator as Y, else N.
3. In file 1, the first 6 chars are decimal. In file 2, it's hexadecimal. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
1. Both file 1 and file 2 can have duplicates.
2. It's basically like this. Write file 1 to output. If the first 6 bytes in file 1 are available in file 2, then put indicator as Y, else N. |
Just to be sure we are on the same page, I need to see an example of input and output where both files have duplicates and nonduplicates in various combinations. For example, if the input files had these records:
| Code: |
File 1
01101 XXXXX
01101 QQQQQ
01102 YYYYY
01103 BBBB
01104 CCCC
01104 DDDD
01105 EEEE
01108 FFFF
01108 GGGG
01108 HHHH
File 2
01102 ....................
01103 ....................
01103 ....................
01104 ....................
01104 ....................
01106 ....................
01107 ....................
01107 ....................
01108 ....................
01108 ....................
|
What would the expected output be? |
|
| Back to top |
|
 |
itmanand
New User
Joined: 18 Dec 2008 Posts: 24 Location: Newyork
|
|
|
|
The output should be file 1 with Y or N at the end.
Y - If the first 6 bytes(decimal) in file 1 matches with first 6 bytes(hexadecimal) in file 2.
N - If the first 6 bytes(decimal) in file 1 not found in file 2. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Post the actual output using the sample data provided. . . |
|
| Back to top |
|
 |
|
|