Re: COBOL is dynamic (depends)
- From: "HeyBub" <heybubNOSPAM@xxxxxxxxx>
- Date: Thu, 26 Oct 2006 17:42:50 -0500
Frank Swarbrick wrote:
Years ago for a project I had to deal with some messages that were
something like the following:
Field 1 - 4 alphanumeric characters
Field 2 - 2 numeric characters
Field 3 - either 16, or 33 or 49 characters in length, where if the
first character is a 'U' the length is 33, if the first character is
a 'T' the length is 49, otherwise the length is 16
Field 4 - 4 numeric characters
Field 5 - zero to 49 characters with the length being specified by
field 4. Field 6 - 1 character end of message delimiter ('!')
I ended up with a solution that, while it didn't make me happy, works
and isn't *too* complicated and ugly.
I saw this code again yesterday and thought that I should be able to
make it simpler, more flexible, and easier to understand.
Your solution is simple, compact, and easy to understand.
You're lucky to have a compiler that permits field names after an ODO. For
those of us with conforming compilers, your solution can't be used. If faced
with the same problem, I'd have to march an index down the input record
moving individual bytes to their prescribed destinations.
.
- Follow-Ups:
- Re: COBOL is dynamic (depends)
- From: Richard
- Re: COBOL is dynamic (depends)
- References:
- COBOL is dynamic (depends)
- From: Frank Swarbrick
- COBOL is dynamic (depends)
- Prev by Date: Re: COBOL is dynamic (depends)
- Next by Date: Re: COBOL is dynamic (depends)
- Previous by thread: Re: COBOL is dynamic (depends)
- Next by thread: Re: COBOL is dynamic (depends)
- Index(es):
Relevant Pages
|