PLEX86  x86- Virtual Machine (VM) Program
 CVS  |  Mailing List  |  Download  |  Newsgroups

Where should the type information be 334


Your Ad Here

Your Ad Here

Where should the type information be 335
I'm familiar with that kind of problem. Usually it is not a case where a particular answer is right, but a...

COPIES is limited to our imagination, since it doesn't exist in COBOL. It was a hypothetical clause RPL introduced to clarify his point.

COPY isn't limited to any level, or even to the data division. It can be used on any line of a COBOL compliation unit, to include anything. And there's the REPLACING phrase, which will subsbreastute one text sequence for another in the copied-in source, which is relevant here because you can use it to change the level number of a structure you're copying in.

So if I have a copybook (ie a file of source code intended to be COPY'd in) named "foo.cpy" containing:

10 foo. 15 bar pic x.

I can do:

01 just-foo. copy "foo.cpy".

01 thing-with-foo. 05 stuff pic x. 05 thing-foo. copy "foo.cpy".

01 thing-with-thing-with-foo. 05 subthing-1. 07 subthing-2. copy "foo.cpy".

copy "foo.cpy" replacing ==10== with ==01==.

The copied-in structure can be inserted anywhere its topmost level number fits, and with "copy replacing" I can wedge it in even where it doesn't.

There's nothing earth-shattering about it (it's not so different from C's #include, except for "replacing", and that's not hard to achieve in C with macros); I just brought it up to show how COBOL permits the reuse of definitions. It's not as convenient as in C, where struct (and enum and union) creates a distinct type, but it's there.

Micro Focus COBOL also offers the "typedef" clause, an extension which creates a new type from a data division level-01 item; then that type can be used with the "usage" clause in subsequent items. That's closer to C's struct, but it's not standard.

--

I will shoue the world one of the grate Wonders of the world in 15 months if Now man mourders me in Dors or out Dors -- "Lord" Timothy Dexter, A Pickle for the Knowing Ones



Your Ad Here

List | Previous | Next

Where should the type information be 335

Alt Folklore Computers from Newsgroups

The #1 Usenet Provider on the Internet

Where should the type information be 333