I am trying to create a DFSORT job to parse the following data example:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6
XXXX..JAMES SNOW..1234 OCEAN AVE..CHICAGO IL
EEEE01DCDCE4EDDE02FFFF4DCCCD4CEC13CCCCCCD444444444444444CD
7777A11145202566E11234063515015581389317600000000000000093
The length of field one (NAME) is a S9(4) COMP field always stored in the same position (5 in the data example). The X'11' in position 6 indicates the NAME field follows.
The remaining field lengths & field indicators will be in variable locations, depending on the length of the preceding fields. In my data example:
My goal is to take the variable length records and build fixed length records, with each of the 3 fields being 25 bytes in length (LRECL=75). The output file will contain the data only (lengths and field indicators will be omitted).
I believe I have a grasp on the parsing concept, but the variable length and positioning is my struggle. I also realize that this can be achieved with a simple, small COBOL program, but am limited to DFSORT. Thank you!
Joined: 15 Aug 2015 Posts: 1329 Location: Bamberg, Germany
Glad to hear, thanks for the feedback. If your fields are longer than 64 bytes, you need a different technique to trim the fields. However it's not a big issue at all.
The length of field one (NAME) is a S9(4) COMP field always stored in the same position (5 in the data example). The X'11' in position 6 indicates the NAME field follows.
The remaining field lengths & field indicators will be in variable locations, depending on the length of the preceding fields. In my data example:
The length of field one (NAME) is a S9(4) COMP field always stored in the same position (5 in the data example). The X'11' in position 6 indicates the NAME field follows.
The remaining field lengths & field indicators will be in variable locations, depending on the length of the preceding fields. In my data example:
Looks strange that the variable length fields do include both:
- field length prefix, and
- field type indicator byte.
Usually those are mutually exclusive...
Understood - definitely not my design. There are fields, though, that are optional (name line 2, address line 2, etc.) that require different field type indicators.