Sikkandhar
New User
Joined: 03 Dec 2007 Posts: 61 Location: Bangalore
|
|
|
|
Hi All,
I have a file delimited with ;. The position of each values in the file is not fixed. There is a particular string that needs to be completely removed, if a match is found in file
File 1
The String REPLACEME1 or REPLACEME2 when found a hit on file 2, it needs to be removed
Code: |
123456789;"B";"ABC012345 ";98745;2;"1";1.23;"REPLACEME";23.12345;
223456789;"B";"ABC012345 ";98;2;"1";1.23;"REPLACEME2";23.12345;
823456789;"B";"ABC012345 ";98745;2;"1";1.23;;23.12345;
923456789;"B";"ABC012345 ";98;2;"1";1.23;"AMGOOD";23.12345;
|
File 2
Code: |
123456789;"B";"REPLACEME"
223456789;"B";"REPLACEME2"
|
File 1 and File 2 is joined on 1st 9 bytes. If a match is found between File 1 and File 2, then the string found in file 2 (REPLACEME or REPLACEME2) needs to be removed from File1
Output should look like
Code: |
123456789;"B";"ABC012345 ";98745;2;"1";1.23;;23.12345;
223456789;"B";"ABC012345 ";98;2;"1";1.23;;23.12345;
823456789;"B";"ABC012345 ";98745;2;"1";1.23;;23.12345;
923456789;"B";"ABC012345 ";98;2;"1";1.23;"AMGOOD";23.12345;
|
The String that needs to be replaced in File is Not of fixed length and the value can vary. if found in File1, then it needs to be removed.
Appreciate any help on this
Thanks
Sikkandhar |
|
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2173 Location: USA
|
|
|
|
Issue #1:
There are no “files” in mainframe architecture.
“Files” (on most of other platforms) consist of long sequence of bytes. Optionally, text “files” may contain virtual “lines” separated by special bytes CR and/or LF, but it is not a requirement.
In mainframes, the “datasets” mandatory consist of “records”, which consist of bytes, either equal or different amount of them in each record. For text data, each “record” is usually considered also as a “line”, without any additional special byte used to separate the “text lines”.
When data are transferred from Windows/Unix/Apple/etc. to mainframe, one needs to know exactly: how logical strings between CR/LF are converted to physical records on mainframe? Depending on the used conversion method different ways of dataset parsing may be needed.
There is also a good chance that the initial “file” did not include any CR/LF, and hence, on mainframe it can be divided into physical records at random positions! It happens in real life, depending on the qualification of the System Architect. |
|