Re: COBOL is dynamic (depends)



Richard<riplin@xxxxxxxxxxxx> 10/26/06 5:32 PM >>>

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.
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.

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
.