There is a file where (see attachment) a field in all records needs to have leading zeros suppressed, for example:
004102109 needs to be 4102109. I am able to make this work as long as the fields are located in the same position. Unfortunately in my file the data is delimited and not always in the same location, although it is always right after the 6th delimiter (|~|). Do you know how to position the sort to the location based on the number of delimiters and then do the suppression?
Code below will work if the exact position is known for a particular record (see attachment for record details):
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 1 2 3
2930078510~00001|~|R|~|00001|~|20111127010101|~|CHBRX|~||~|3192431|~|CHBRX~02220 <<<<<<< I was able to suppress the zeros because I new the exact column for this record
2844321610~00001|~|P|~|00001|~|20111127010101|~|HANRX|~|66638|~|004158481|~|HANR <<<<<< this needs to be suppressed as well but it begins in another column
Code that works based on looking at a fixed column is below. Note that the variable length of the record was taken into account by adding 4 bytes to the position. 'CHBRX' starts in column 49 on the layout but 4 was addded to make the location 53 as used in the code:
Your post has been Code'd and the attachment inlined.
Please use the Code tags to preserve spacing where necessary and post file examples in the Code tags, not as attachments.