am i gonna go down in flames??
Author Message
am i gonna go down in flames??

i have the following: (and this is REALLY what i would like to do)

IF PART-I-A(SUB)
IF FIRST(SUB)

where the definitions are:
05  TOP-ENTITY-AXIS-CODES OCCURS 20.
10  TOP-EAC.
15  TOP-EAC-LINE-NO    PIC X(01).
88  PART-I-A    VALUE '1'.
88  PART-I-B    VALUE '2'.
88  PART-I-C    VALUE '3'.
88  PART-I-D    VALUE '4'.
88  PART-I-E    VALUE '5'.
88  PART-II     VALUE '6'.
15  TOP-EAC-SEQUENCE   PIC X(01).
88  FIRST       VALUE '1'.

my question is this: is the subscripting on the 88-level name the
correct way to go about testing each condition?? the if's are within a
para that is performed varying. is this going to work, or am i going to
be frustrated? (not a pretty picture, let me assure you!)

thanks for any help. i have rtfm and can't find a solid answer, so
thought would throw it out to the wizards.
suzie

(use standard abbreviations for the last two parts of my address, and
you'll find me!!)

Mon, 07 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

In other words, you want to say: IF ((TOP-EAC-LINE-NO (SUB) IS EQUAL TO '1')
AND (TOP-EAC-SEQUENCE (SUB) IS EQUAL TO '1')) THEN... do whatever... where
SUB is a varying subscript. If so, then yes, the nested IFs should work just
fine with the subscripted 88 levels... depending on the version of COBOL
you're using. I know that it'll work with COBOL/400, and I'm pretty sure
it'll work with VAX/COBOL. I'm not so sure about VSE/COBOL. As for the
various flavors of COBOL under MVS (MVWho???)... quien sabe??

Good luck! :D

Quote:

>i have the following: (and this is REALLY what i would like to do)

>IF PART-I-A(SUB)
>  IF FIRST(SUB)

>where the definitions are:
>05  TOP-ENTITY-AXIS-CODES OCCURS 20.
>    10  TOP-EAC.
>        15  TOP-EAC-LINE-NO    PIC X(01).
>            88  PART-I-A    VALUE '1'.
>            88  PART-I-B    VALUE '2'.
>            88  PART-I-C    VALUE '3'.
>            88  PART-I-D    VALUE '4'.
>            88  PART-I-E    VALUE '5'.
>            88  PART-II     VALUE '6'.
>        15  TOP-EAC-SEQUENCE   PIC X(01).
>            88  FIRST       VALUE '1'.

>my question is this: is the subscripting on the 88-level name the
>correct way to go about testing each condition?? the if's are within a
>para that is performed varying. is this going to work, or am i going to
>be frustrated? (not a pretty picture, let me assure you!)

>thanks for any help. i have rtfm and can't find a solid answer, so
>thought would throw it out to the wizards.
>suzie

>(use standard abbreviations for the last two parts of my address, and
>you'll find me!!)

Mon, 07 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

Quote:

> i have the following: (and this is REALLY what i would like to do)

> IF PART-I-A(SUB)
>   IF FIRST(SUB)

> where the definitions are:
> 05  TOP-ENTITY-AXIS-CODES OCCURS 20.
>     10  TOP-EAC.
>         15  TOP-EAC-LINE-NO    PIC X(01).
>             88  PART-I-A    VALUE '1'.
>             88  PART-I-B    VALUE '2'.
>             88  PART-I-C    VALUE '3'.
>             88  PART-I-D    VALUE '4'.
>             88  PART-I-E    VALUE '5'.
>             88  PART-II     VALUE '6'.
>         15  TOP-EAC-SEQUENCE   PIC X(01).
>             88  FIRST       VALUE '1'.

> my question is this: is the subscripting on the 88-level name the
> correct way to go about testing each condition?? the if's are within a
> para that is performed varying. is this going to work, or am i going to
> be frustrated? (not a pretty picture, let me assure you!)

> thanks for any help. i have rtfm and can't find a solid answer, so
> thought would throw it out to the wizards.
> suzie

> (use standard abbreviations for the last two parts of my address, and
> you'll find me!!)

I prefer to do it the old way.

05  TOP-ENTITY-AXIS-CODES OCCURS 20.
10  TOP-EAC.
15  TOP-EAC-LINE-NO    PIC X(01).
15  TOP-EAC-SEQUENCE   PIC X(01).

01  TOP-EAC-88.
05  TOP-EAC-LINE-NO-88         PIC X(1).
88  PART-I-A    VALUE '1'.
88  PART-I-B    VALUE '2'.
88  PART-I-C    VALUE '3'.
88  PART-I-D    VALUE '4'.
88  PART-I-E    VALUE '5'.
88  PART-II     VALUE '6'.
05  TOP-EAC-SEQUENCE-88         PIC X(1).
88  FIRST       VALUE '1'.

PROCEDURE DIVISION.
:
MOVE TOP-EAC(SUB) TO TOP-EAC-88.
IF PART-I-A
IF FIRST
:

Rgds,
Chip Ling

Mon, 07 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

Quote:

> In other words, you want to say: IF ((TOP-EAC-LINE-NO (SUB) IS EQUAL TO '1')
> AND (TOP-EAC-SEQUENCE (SUB) IS EQUAL TO '1')) THEN... do whatever... where
> SUB is a varying subscript. If so, then yes, the nested IFs should work just
> fine with the subscripted 88 levels... depending on the version of COBOL
> you're using. I know that it'll work with COBOL/400, and I'm pretty sure
> it'll work with VAX/COBOL. I'm not so sure about VSE/COBOL. As for the
> various flavors of COBOL under MVS (MVWho???)... quien sabe??

COBOL II supports subscripted 88-levels, and it's a fair presumption
that later releases do too.  I don't know about OS/VS COBOL or the
ANSI standards.

Try it with whatever compiler you're using.  If it works there, it'll
probably work with later releases of the same compiler.

If it is likely that you will be porting to a different compiler
some day, especially an older compiler, you might consider avoiding
this construct in favor of the clumsier syntax comparing subscripted
variables.

In that case, you can still get much of the benefit of 88-levels
by comparing your subscripted variable not to a hard-coded literal but
to a meaningful data name.  E.g.:

01  PSEUDO-88-LEVELS.
05  PART-I-A    PIC X VALUE '1'.
05  PART-I-B    PIC X VALUE '2'.
05  PART-I-C    PIC X VALUE '3'.
05  PART-I-D    PIC X VALUE '4'.
05  PART-I-E    PIC X VALUE '5'.
05  PART-II     PIC X VALUE '6'.
...
IF TOP-EAC-LINE-NO (SUB) = PART-I-A

...and so forth.

http://home.swbell.net/mck9/cobol/cobol.html

[snip -- asked if you can use subscripted 88-levels]

Mon, 07 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

Quote:

>i have the following: (and this is REALLY what i would like to do)

>IF PART-I-A(SUB)
>  IF FIRST(SUB)

>where the definitions are:
>05  TOP-ENTITY-AXIS-CODES OCCURS 20.
>    10  TOP-EAC.
>        15  TOP-EAC-LINE-NO    PIC X(01).
>            88  PART-I-A    VALUE '1'.
>            88  PART-I-B    VALUE '2'.
>            88  PART-I-C    VALUE '3'.
>            88  PART-I-D    VALUE '4'.
>            88  PART-I-E    VALUE '5'.
>            88  PART-II     VALUE '6'.
>        15  TOP-EAC-SEQUENCE   PIC X(01).
>            88  FIRST       VALUE '1'.

>my question is this: is the subscripting on the 88-level name the
>correct way to go about testing each condition?? the if's are within a
>para that is performed varying. is this going to work, or am i going to
>be frustrated? (not a pretty picture, let me assure you!)

>thanks for any help. i have rtfm and can't find a solid answer, so
>thought would throw it out to the wizards.
>suzie

>(use standard abbreviations for the last two parts of my address, and
>you'll find me!!)

Someone at my shop tried this and found that the test (IF PART-I-A(SUB))
ignores the subscript and always tests the first entry.  If you wish to use
the 88-levels you could define TEST-LINE-NO with the 88-levels and move
TOP-EAC-LINE-NO(SUB) to TEST-LINE-NO.

Mike

All opinions expressed here are my own and do not necessarily reflect those of my employer or any other organization.

Mon, 07 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

Quote:
> i have the following: (and this is REALLY what i would like to do)

> IF PART-I-A(SUB)
>   IF FIRST(SUB)

> where the definitions are:
> 05  TOP-ENTITY-AXIS-CODES OCCURS 20.
>     10  TOP-EAC.
>         15  TOP-EAC-LINE-NO    PIC X(01).
>             88  PART-I-A    VALUE '1'.
>             88  PART-I-B    VALUE '2'.
>             88  PART-I-C    VALUE '3'.
>             88  PART-I-D    VALUE '4'.
>             88  PART-I-E    VALUE '5'.
>             88  PART-II     VALUE '6'.
>         15  TOP-EAC-SEQUENCE   PIC X(01).
>             88  FIRST       VALUE '1'.

One thing you can do if your compiler supports ADDRESS OF is to define a
single occurrence of your array at the end of LINKAGE, then in the
paragraph that is performed varying:

With the 88s defined in LINKAGE, they would not be subscripted, and you
would not be doing a MOVE.

Good luck.

Mike

Mon, 07 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

Quote:

> IF PART-I-A(SUB)
>   IF FIRST(SUB)
> 05  TOP-ENTITY-AXIS-CODES OCCURS 20.
>     10  TOP-EAC.
>         15  TOP-EAC-LINE-NO    PIC X(01).
>             88  PART-I-A    VALUE '1'.
>         15  TOP-EAC-SEQUENCE   PIC X(01).
>             88  FIRST       VALUE '1'.
> is the subscripting on the 88-level name the correct way to go about
> testing each condition?

no, try TOP-ENTITY-AXIS-CODES(SUB). u can't index 88's.
shoud be TOP-ENTITY-AXIS-CODES(something)
cu/2 roger (just mail if probs!)

Mon, 07 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

Quote:

>> i have the following: (and this is REALLY what i would like to do)

>> IF PART-I-A(SUB)
>>   IF FIRST(SUB)

>> where the definitions are:
>> 05  TOP-ENTITY-AXIS-CODES OCCURS 20.
>>     10  TOP-EAC.
>>         15  TOP-EAC-LINE-NO    PIC X(01).
>>             88  PART-I-A    VALUE '1'.
>>             88  PART-I-B    VALUE '2'.
>>             88  PART-I-C    VALUE '3'.
>>             88  PART-I-D    VALUE '4'.
>>             88  PART-I-E    VALUE '5'.
>>             88  PART-II     VALUE '6'.
>>         15  TOP-EAC-SEQUENCE   PIC X(01).
>>             88  FIRST       VALUE '1'.

>One thing you can do if your compiler supports ADDRESS OF is to define a
>single occurrence of your array at the end of LINKAGE, then in the
>paragraph that is performed varying:

>    TO ADDRESS OF TOP-ENTITY-AXIS-CODES (SUB).

>With the 88s defined in LINKAGE, they would not be subscripted, and you
>would not be doing a MOVE.

As there are other methods of accomplishing the same task without using
the SET ADDRESS and since the SET ADDRESS is not, in my experience,
readily understood by the typical 2-year's-experienced maintenance coder,
I would *strongly* suggest avoiding this use.  It is what we used to call
'Gee, Look, Ma, I'm A Programmer!' code... yes, it *does* accomplish what
is needed but there is unnecessary complexity involved in doing so.

... just my opinion, of course.

DD

Tue, 08 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

Quote:

> As there are other methods of accomplishing the same task without using
> the SET ADDRESS and since the SET ADDRESS is not, in my experience,
> readily understood by the typical 2-year's-experienced maintenance coder,
> I would *strongly* suggest avoiding this use.  It is what we used to call
> 'Gee, Look, Ma, I'm A Programmer!' code... yes, it *does* accomplish what
> is needed but there is unnecessary complexity involved in doing so.

> ... just my opinion, of course.

> DD

Doc,
all the other methods I have seen at various shops use  Assembler
routines to acheive this sort of 'set address' function; this must
surely qualify even more as 'gee look I'm a programmer' coding.

I know this topic has been touched on several times in this NG, but what
other options are there (preferably just using COBOL (say COBOL2,MVS) to
acheive this.  Can you or anyone else possibly provide some code samples
or just discuss the theory.
Even though it is a bit flash and perhaps unorthodox I like Mike Salters
approach - it's simple, readable and understandable (once, of course,
you understand what SET ADDRESS does)

Tue, 08 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

Quote:

>> As there are other methods of accomplishing the same task without using
>> the SET ADDRESS and since the SET ADDRESS is not, in my experience,
>> readily understood by the typical 2-year's-experienced maintenance coder,
>> I would *strongly* suggest avoiding this use.  It is what we used to call
>> 'Gee, Look, Ma, I'm A Programmer!' code... yes, it *does* accomplish what
>> is needed but there is unnecessary complexity involved in doing so.

>> ... just my opinion, of course.

>> DD
>Doc,
>all the other methods I have seen at various shops use  Assembler
>routines to acheive this sort of 'set address' function; this must
>surely qualify even more as 'gee look I'm a programmer' coding.

Not at all; I would say that it is leaving low-level work (addressing) to
a lower-level language (BAL)... in similar wise there *are* ways to do
bit-level addressing in COBOL but such things are best left to BAL or C.
The right tool for the right job and all that.

Quote:

>I know this topic has been touched on several times in this NG, but what
>other options are there (preferably just using COBOL (say COBOL2,MVS) to
>acheive this.  Can you or anyone else possibly provide some code samples
>or just discuss the theory.
>Even though it is a bit flash and perhaps unorthodox I like Mike Salters
>approach - it's simple, readable and understandable (once, of course,
>you understand what SET ADDRESS does)

If I recall correctly the task was to check multiple OCCURences for two
types of 88s; an 88'd TEST-AREA or two and a PERFORMed paragraph (or an
inline, if you have COBOL85) are not flashy, *boringly* orthodox and

DD

Tue, 08 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

We're using VS COBOL II, and the SET ADDRESS TO statement does not work
when you try to

when either A or B are defined in WORKING-STORAGE.
This only works when both A and B are defined in the LINKAGE SECTION.

Quote:

> One thing you can do if your compiler supports ADDRESS OF is to define a
> single occurrence of your array at the end of LINKAGE, then in the
> paragraph that is performed varying:

>     TO ADDRESS OF TOP-ENTITY-AXIS-CODES (SUB).

> With the 88s defined in LINKAGE, they would not be subscripted, and you
> would not be doing a MOVE.

> Good luck.

> Mike

Tue, 08 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

We're using VS COBOL II, and subscripting an 88-level works just fine,
so...

Quote:
> i have the following: (and this is REALLY what i would like to do)

> IF PART-I-A(SUB)
>   IF FIRST(SUB)

> where the definitions are:
> 05  TOP-ENTITY-AXIS-CODES OCCURS 20.
>     10  TOP-EAC.
>         15  TOP-EAC-LINE-NO    PIC X(01).
>             88  PART-I-A    VALUE '1'.
>             88  PART-I-B    VALUE '2'.
>             88  PART-I-C    VALUE '3'.
>             88  PART-I-D    VALUE '4'.
>             88  PART-I-E    VALUE '5'.
>             88  PART-II     VALUE '6'.
>         15  TOP-EAC-SEQUENCE   PIC X(01).
>             88  FIRST       VALUE '1'.

> my question is this: is the subscripting on the 88-level name the
> correct way to go about testing each condition?? the if's are within a
> para that is performed varying. is this going to work, or am i going to
> be frustrated? (not a pretty picture, let me assure you!)

> thanks for any help. i have rtfm and can't find a solid answer, so
> thought would throw it out to the wizards.
> suzie

> (use standard abbreviations for the last two parts of my address, and
> you'll find me!!)

Tue, 08 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

This note and several others that I have seen seem to think that you can't
index or subscript 88-levels.  This isn't all that common, but it is
certainly valid in the current Standard and all standard-conforming
implementations that I know of.  Am I missing something?

--
+ +
+   Bill Klein -
"C" is a nice letter to START the name of your programming language
with
but I wouldn't want to end up there.

Quote:

>> IF PART-I-A(SUB)
>>   IF FIRST(SUB)
>> 05  TOP-ENTITY-AXIS-CODES OCCURS 20.
>>     10  TOP-EAC.
>>         15  TOP-EAC-LINE-NO    PIC X(01).
>>             88  PART-I-A    VALUE '1'.
>>         15  TOP-EAC-SEQUENCE   PIC X(01).
>>             88  FIRST       VALUE '1'.
>> is the subscripting on the 88-level name the correct way to go about
>> testing each condition?

>no, try TOP-ENTITY-AXIS-CODES(SUB). u can't index 88's.
>shoud be TOP-ENTITY-AXIS-CODES(something)
>cu/2 roger (just mail if probs!)

Tue, 08 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

<snip>

Quote:

> As there are other methods of accomplishing the same task without using
> the SET ADDRESS and since the SET ADDRESS is not, in my experience,
> readily understood by the typical 2-year's-experienced maintenance coder,
> I would *strongly* suggest avoiding this use.  It is what we used to call
> 'Gee, Look, Ma, I'm A Programmer!' code... yes, it *does* accomplish what
> is needed but there is unnecessary complexity involved in doing so.

I agree it does add a measure of complexity.  The original post dealt with
subscripted 88s, which seem to work fine with MF 4.x.  As I read other
suggestions that involved a MOVE, I offered this as an alternative which
wouldn't cost the cpu time that a MOVE would, since we're already dealing
with 20 iterations.

As a programmer, I'm always saying "Gee, Look Ma.....", and probably always
will!

Mike

Tue, 08 Aug 2000 03:00:00 GMT
am i gonna go down in flames??

Quote:

> <snip>

> > As there are other methods of accomplishing the same task without using
> > the SET ADDRESS and since the SET ADDRESS is not, in my experience,
> > readily understood by the typical 2-year's-experienced maintenance coder,
> > I would *strongly* suggest avoiding this use.  It is what we used to call
> > 'Gee, Look, Ma, I'm A Programmer!' code... yes, it *does* accomplish what
> > is needed but there is unnecessary complexity involved in doing so.

> I agree it does add a measure of complexity.  The original post dealt with
> subscripted 88s, which seem to work fine with MF 4.x.  As I read other
> suggestions that involved a MOVE, I offered this as an alternative which
> wouldn't cost the cpu time that a MOVE would, since we're already dealing
> with 20 iterations.

Hmmmm... if I recall the original example the MOVEd field was PIC X;
this compiles to an MVI instruction and that's purty durned quick.
(likewise an 88 on a PIC X compiles to a CLI).  Depending on transaction
volume you might have something there... but I reserve final judgement
until all the data are in.

Quote:

> As a programmer, I'm always saying "Gee, Look Ma.....", and probably always
> will!

It is a fine line to walk, certainly... on the one hand one must KISS,
on the other hand one must keep one'sself interested.  Hey, if it were
easy then *everyone* would be doing it... but for production code I beg
you err on the side of KISS.

DD

Tue, 08 Aug 2000 03:00:00 GMT

 Page 1 of 2 [ 28 post ] Go to page: [1] [2]

Relevant Pages