Re: COBOL is dynamic (depends)
- From: "Frank Swarbrick" <Frank.Swarbrick@xxxxxxxxxxxxxx>
- Date: Fri, 27 Oct 2006 09:12:32 -0600
Richard<riplin@xxxxxxxxxxxx> 10/26/06 5:32 PM >>>
For
HeyBub wrote:
Your solution is simple, compact, and easy to understand.
You're lucky to have a compiler that permits field names after an ODO.
facedthose of us with conforming compilers, your solution can't be used. If
with the same problem, I'd have to march an index down the input record
moving individual bytes to their prescribed destinations.
Or use reference notation, perhaps table driven:
01 Tspec PIC X(36) VALUE
"001004005002007049056004060049109001".
01 Uspec PIC X(36) VALUE
"001004005002007033040004044033077001".
etc
01 FieldSpec.
03 AStart PIC 999.
03 ALen PIC 999.
03 BStart PIC 999.
03 BLen PIC 999.
etc
MOVE TSpec TO FieldSpec
EVALUATE Data-In(CStart:1)
WHEN "U"
MOVE Uspec TO FieldSpec
WHEN OTHER
etc
MOVE Data-In(AStart:ALen) TO A
MOVE Data-In(BStart:BLen) TO B
etc
I think you'll have to admit that you can't just glance at that and see what
it is actually doing, while my original example is probably readible even by
a non-programmer.
What I like about my original example is that it does what computers are
made to do; the hard stuff. It leaves the programmer to do his job rather
that trying to figure out how to get the computer to do the computer's job.
Frank
---
Frank Swarbrick
Senior Developer/Analyst - Mainframe Applications
FirstBank Data Corporation - Lakewood, CO USA
.
- Follow-Ups:
- Re: COBOL is dynamic (depends)
- From: Richard
- Re: COBOL is dynamic (depends)
- From: Richard
- Re: COBOL is dynamic (depends)
- From: HeyBub
- Re: COBOL is dynamic (depends)
- References:
- COBOL is dynamic (depends)
- From: Frank Swarbrick
- Re: COBOL is dynamic (depends)
- From: HeyBub
- Re: COBOL is dynamic (depends)
- From: Richard
- COBOL is dynamic (depends)
- Prev by Date: Re: INSPECT BEFORE/AFTER phrase 2002/2008
- Next by Date: Domestic Alternative To Offshore Outsourcing
- Previous by thread: Re: COBOL is dynamic (depends)
- Next by thread: Re: COBOL is dynamic (depends)
- Index(es):