Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

i am new to COBOL. What is level 77?

464 views
Skip to first unread message

Tony

unread,
May 28, 1997, 3:00:00 AM5/28/97
to

what is a level 77? what was it used for?

harry silva

unread,
May 29, 1997, 3:00:00 AM5/29/97
to

ram...@sprintmail.com (Tony) wrote:

>what is a level 77? what was it used for?


Typically , traditionally, they are used for independant items. It
was and is mostly documtary. 01 does just as well.

There are other levels :

66 - typically used in Linkage section

88 - typically used in as counters.

there is no real signifant with the compiler.

only a few even demand sequential numbers any more.

/harry.

Mark Longmire

unread,
May 29, 1997, 3:00:00 AM5/29/97
to

Tony <ram...@sprintmail.com> wrote in article
<5mhpt8$b...@newsfep2.sprintmail.com>...

> what is a level 77? what was it used for?
>


77 levels can't have any subordinate levels assigned to them, where as
level 01-?? can. I'm not sure what level to stop at for group level
definitions.

example:

77 COUNTER PIC 99.

01 COUNTERS.
05 COUNTER-1 PIC 99.
05 COUNTER-2 PIC 99.

Your compiler should fail when trying to define subordinate elements
beneath a level 77.

David K. Bryant

unread,
May 29, 1997, 3:00:00 AM5/29/97
to

sil...@spectra.net (harry silva) writes:

>ram...@sprintmail.com (Tony) wrote:

>>what is a level 77? what was it used for?

>Typically , traditionally, they are used for independant items. It
>was and is mostly documtary. 01 does just as well.

The 77-level used to (probably not anymore) force boundary alignment.
Some variable sizes must be on half-word or full-word boundaries.
(Like SYNC).

Brian Simmons

unread,
May 30, 1997, 3:00:00 AM5/30/97
to

In message <338D39...@imi.mb.ca>
Charles Goodman <cgoo...@imi.mb.ca> writes:


> Tony wrote:
> >
> > what is a level 77? what was it used for?

> RTFM

Very funny Charles, this came up some time back and I did RTFM - it
didn't help. If you've never used them or seen them in use you're
probably stuffed. Please try to be more helpful.

Brian

harry silva

unread,
May 30, 1997, 3:00:00 AM5/30/97
to

"Thane Hubbell" <red...@ibm.net> wrote:

>> 88 - typically used in as counters.
>>

>This is incorrect. 88 levels are used as indicators.

>IE:

>01 DATA-FLAG PIC X.
> 88 YES-THERE-WAS-DATA VALUE "Y".
> 88 NO-DATA VALUE "N".

>If YES-THERE-WAS-DATA
> perform whatever.

>See?

Sounds interesting. But is 88 used as above specific to your
implimentation of COBOL? I have rarely seen it used as you
mtipulate. Perhaps it's pecular to your compiler. I have never used


Indicators as you have suggested. We use independant varables and
conventional tests in most of our programs. They are easier to
program and repair. I once saw 88 used to read the condition of the
console switches or was that 66. But most mainframes don't have
console switches in the same sense as they did then.

Interesting.. does you compiler know the 'Y' and 'y'.

/harry/


George Bickmore

unread,
May 30, 1997, 3:00:00 AM5/30/97
to

Basicly all of these hacks have something useful to say, but they have
clouded it in BS. level 77 is used for independent data which has neither
a subordinate structure nor is part of a superior structure. Not worth a
lot of thought in today's world. As to 88's they are called "conditioned
variables". This is because they are used to apply conditions to some
variable which can be tested. The example of IS-IT-TRUE is correct as in:

01 IS-IT-TRUE PIC X VALUE "Y".
88 IT-IS-TRUE VALUE "Y".
88 IT-IS-NOT-TRUE VALUE "N".

MOVE "N" TO IS-IT-TRUE.
IF IT-IS-TRUE GO TO X.

Makes for nice documentation in the procedure code.

harry silva <sil...@spectra.net> wrote in article
<5mje96$d...@ns2.spectra.net>...


> ram...@sprintmail.com (Tony) wrote:
>
> >what is a level 77? what was it used for?
>
>

> Typically , traditionally, they are used for independant items. It
> was and is mostly documtary. 01 does just as well.
>

> There are other levels :
>
> 66 - typically used in Linkage section
>

> 88 - typically used in as counters.
>

harry silva

unread,
May 30, 1997, 3:00:00 AM5/30/97
to

"Thane Hubbell" <red...@ibm.net> wrote:

>harry silva <sil...@spectra.net> wrote in article

><5mlhod$3...@ns2.spectra.net>...


>> Sounds interesting. But is 88 used as above specific to your
>> implimentation of COBOL? I have rarely seen it used as you
>> mtipulate. Perhaps it's pecular to your compiler. I have never used

>Nope. Been that way for a long time in any compiler I have used (5
>different COBOL compilers).

>RM COBOL.
>MF COBOL
>VS/COBOL
>S36/COBOL
>Realia COBOL

>If your compiler is ANSI 85 you can do this, and it is VERY maintainable.

>Try.

>01 Error-flag pic X value spaces.
> 88 There-was-an-error value "Y".

>OLD METHOD:

>IF ........ move "Y" to error-flag.

>IF error-flag = "Y"
> .... do something....

>New method.

>IF ..... SET THERE-WAS-AN-ERROR to true.

I see your point. But the code is no more clear to me. Does it
compile into a smaller obj code?


>IF THERE-WAS-AN-ERROR
> .... do something....


this is more maintainable then ?

IF ERROR- = True
do something....

I grant that 88 has a special meaning that has possibly changed.

>With this method you don't care whether it is a "Y" or "y" or even an "X"
>to make the condition true. Very easy to use.

>If your compiler is NOT ansi 85 you can do:

>If ..... move "Y" to error-flag
>If there-was-an-error
> ... do something....

>Still fairly easy to maintain and very powerful!

>Take it easy!

Always do. I am not offended... was not.. and certainly do not mean
to offend anyone. I am learning some new method of coding:? I am not
sure how directly relevant it is (at least now) but in the future it
could have some value.

Do you know if the 88 is reserved in the compiler or just
'traditional'?


>PS. My compiler does know the difference between "Y" and "y".


Intersting. I ment does the compiler consider 'y' and 'Y' equilvent
in this 88 test. Also the use of 88 required or is it just
Tradiotinal? Can one just as easily use 02 ?

01 Error-flag pic X value spaces.
02 There-was-an-error value "Y".


We used a simulare method in C or C++.

Do you know if therre is a defined way to get the System date?


VonDraco

unread,
May 31, 1997, 3:00:00 AM5/31/97
to Tony

> what is a level 77? what was it used for?

A level 77 is a variable. Expressed like this:

77 WS-MISC-VARIABLE PIC X(10).

It is an "independent" variable, in that it has no other variable
associated with it nor is it a part of any "structure". Myself, I shy
away from their use; most variables should be placed in a structure if
only for documentation and ease of reference.

Eg. rather than having

77 EMPLOYEE-STATUS Pic XX.
77 COMPANY-STATUS Pic XX.
77 PROJECT-STATUS Pic XX.

You should ideally have

01 File-Status.
05 Employee-Status Pic X(02).
05 Company-Status Pic X(02).
05 Project-Status Pic X(02).

Hope that helps.


VonDraco

Andy Decepida

unread,
May 31, 1997, 3:00:00 AM5/31/97
to


George Bickmore <gbic...@mfcbellows.com> wrote in article
<01bc6d34$ff989d10$0205a8c0@georgebickmore>...
:
: 01 IS-IT-TRUE PIC X VALUE "Y".


: 88 IT-IS-TRUE VALUE "Y".
: 88 IT-IS-NOT-TRUE VALUE "N".
:
: MOVE "N" TO IS-IT-TRUE.
: IF IT-IS-TRUE GO TO X.
:
: Makes for nice documentation in the procedure code.

In COBOL-85 you can even say

SET IT-IS-TRUE TO TRUE.

or

SET IT-IS-NOT-TRUE TO TRUE.


David K. Bryant

unread,
May 31, 1997, 3:00:00 AM5/31/97
to

"Ernie Jones" <ejo...@seanet.com> writes:

>The use of 88 levels as described about has been in use since the
>beginning by millions of COBOL programmers. If you have rarely seen it
>used, then I am woundering how much COBOL you have seen. I have been
>working COBOL for 15 years and rarerly see a program where it is not used.


As a contractor, I see code from many authors. Some of it
shows talent. A little shows real talent. Most (mainly from
mainframers) is just plain, boring, no-talent stuff. Only
scratching the surface of COBOL features available. Manually
doing built-in functions. Manual MOVEs where COBOL will do
it for you. The list is long.

Eugene A. Pallat

unread,
Jun 1, 1997, 3:00:00 AM6/1/97
to

Ernie Jones <ejo...@seanet.com> wrote in article
<01bc6d70$d1040e80$5050b6cc@ernestjo>...

> harry silva <sil...@spectra.net> wrote in article
> <5mlhod$3...@ns2.spectra.net>...

> > "Thane Hubbell" <red...@ibm.net> wrote:
> > >> 88 - typically used in as counters.

> > >This is incorrect. 88 levels are used as indicators.
> > >IE:
> > >01 DATA-FLAG PIC X.
> > > 88 YES-THERE-WAS-DATA VALUE "Y".
> > > 88 NO-DATA VALUE "N".
> >
> > >If YES-THERE-WAS-DATA
> > > perform whatever.
> >
> > >See?
> >

> > Sounds interesting. But is 88 used as above specific to your
> > implimentation of COBOL? I have rarely seen it used as you
> > mtipulate. Perhaps it's pecular to your compiler. I have never used

> <snip>
>
> Nope. The use of 88 levels as described about has been in use since the


> beginning by millions of COBOL programmers. If you have rarely seen it
> used, then I am woundering how much COBOL you have seen. I have been
> working COBOL for 15 years and rarerly see a program where it is not
used.

The only place I never saw the 88 condition levels used was where the
programmers hard coded the tests in-line because they didn't know any
better. They were former Autocoder types and wrote COBOL as if it was
Autocoder and tought a 1000 line COBOL program was too big too understand!

Remove the '-' from orion-data for sending email to me.

Gene eapa...@orion-data.com

Orion Data Systems

Solicitations to me must be pre-approved in writing
by me after soliciitor pays $1,000 US per incident.
Solicitations sent to me are proof you accept this
notice and will send a certified check forthwith.

RunTroyRun

unread,
Jun 1, 1997, 3:00:00 AM6/1/97
to

In his reply to this question, From: VonDraco <vond...@telerama.lm.com>
says:

>>It is an "independent" variable, in that it has no other variable
>>associated with it nor is it a part of any "structure". Myself, I shy
>>away from their use; most variables should be placed in a structure if
>>only for documentation and ease of reference.
>>Eg. rather than having
>>77 EMPLOYEE-STATUS Pic XX.
>>77 COMPANY-STATUS Pic XX.
>>77 PROJECT-STATUS Pic XX.
>>You should ideally have
>>01 File-Status.
>> 05 Employee-Status Pic X(02).
>> 05 Company-Status Pic X(02).
>> 05 Project-Status Pic X(02).

Correct. Another thing that only an assembly language programmer might be
aware of is that (in the old days when I still used cobol) both 77 and 01
were stored on doubleword (evenly divisible by 8) storage addresses.
Wasteful and unneeded except for some COMP SYNC types.

Troy.

Mike Rochford

unread,
Jun 2, 1997, 3:00:00 AM6/2/97
to

Charles Goodman wrote:

>
> Tony wrote:
> >
> > what is a level 77? what was it used for?
> RTFM

Why ??? Don't you know either Charles ??????

harry silva

unread,
Jun 2, 1997, 3:00:00 AM6/2/97
to

I hope this does not deteroatre in to who writes more code.

I have written Cobol Code from about the time they developed Cobol.
But I have learned a lot just reading the various threads.

I have never used the 88 structure. Nor found a need to use anything
simular. I find coding the IF structure in the conventional way is
easier to maintain. (This seems to be a minority position here
however) What I was asking is does the compiler requre the 88
designator or is that simply done traditionally.

Some compilers limit the lowest level is 49/50? Some allow 99 levels.


"Charles E. Weindorf" <mud...@erie.net> wrote:

>Our Cobol shop has multiple-million lines of COBOL code (IBM-MVS and
>PC-Realia), and there are 88 levels just like the one described below all
>over the place. Many legacy systems use 88 to shorten the IF statements.
>The 88 can contain multiple values so that you need only check the single
>88 in the IF to test for many possible values in one field.

>05 TEAM-NAME PIC X(20).
> 88 NL-CENTRAL VALUE 'PIRATES' 'ASTROS' 'REDS' 'CUBS' 'CARDS'.

>IF NL-CENTRAL
> MOVE 'Under .500' TO DISPLAY-FIELD.

>--
>Chuck

>Read original science fiction and fantasy works at
>http://moose.erie.net/~mudsox

>> >01 DATA-FLAG PIC X.
>> > 88 YES-THERE-WAS-DATA VALUE "Y".
>> > 88 NO-DATA VALUE "N".
>>
>> >If YES-THERE-WAS-DATA
>> > perform whatever.

>> Sounds interesting. But is 88 used as above specific to your

Renegade

unread,
Jun 3, 1997, 3:00:00 AM6/3/97
to

In a sudden flurry of activity, sil...@spectra.net (harry silva)
wrote:

>"Thane Hubbell" <red...@ibm.net> wrote:
>
>
>
>>> 88 - typically used in as counters.
>>>
>
>>This is incorrect. 88 levels are used as indicators.
>
>>IE:
>
>>01 DATA-FLAG PIC X.
>> 88 YES-THERE-WAS-DATA VALUE "Y".
>> 88 NO-DATA VALUE "N".
>
>>If YES-THERE-WAS-DATA
>> perform whatever.
>
>>See?

>
>Sounds interesting. But is 88 used as above specific to your
>implimentation of COBOL? I have rarely seen it used as you
>mtipulate. Perhaps it's pecular to your compiler. I have never used
>
>
>Indicators as you have suggested. We use independant varables and
>conventional tests in most of our programs. They are easier to
>program and repair. I once saw 88 used to read the condition of the
>console switches or was that 66. But most mainframes don't have
>console switches in the same sense as they did then.
>
>Interesting.. does you compiler know the 'Y' and 'y'.
>
This is odd, because they have been used as indicators in every shop
I've worked in. Especially in the newer releases of COBOL (370, etc),
as in SET EOF TO TRUE where:
05 EOF-SW PIC X VALUE 'N'.
88 EOF VALUE 'Y'.

or EVALUATE TRUE....

etc.....
Dave

The opinions expressed in this post are purely my own.
You may e-mail replies to: rene...@dwx.com


Renegade

unread,
Jun 3, 1997, 3:00:00 AM6/3/97
to

In a sudden flurry of activity, sil...@spectra.net (harry silva)
wrote:

>I see your point. But the code is no more clear to me. Does it


>compile into a smaller obj code?
>
>

One of the advantages to a level 88 is that it doesn't reserve storage
(no picture clause), so it a bit smaller I guess.

>this is more maintainable then ?
>

Yes! A level 88 can only be true or false. That means that it is
great for switches, such as EOF, IS-THERE-AN-ERROR, etc. This can
make your coding even easier to read.

>Always do. I am not offended... was not.. and certainly do not mean
>to offend anyone. I am learning some new method of coding:? I am not
>sure how directly relevant it is (at least now) but in the future it
>could have some value.
>
>Do you know if the 88 is reserved in the compiler or just
>'traditional'?
>

88 is reserved by the compiler as a conditional (true/false). It
holds no storage. It is an extremely popular indicator switch in most
shops and even schools... and it's been around as such since COBOL
68...

>>PS. My compiler does know the difference between "Y" and "y".
>
>
>Intersting. I ment does the compiler consider 'y' and 'Y' equilvent
>in this 88 test. Also the use of 88 required or is it just
>Tradiotinal? Can one just as easily use 02 ?
>

Whether it considers 'y' and 'Y' equivilent is a compiler option, most
do not...

>01 Error-flag pic X value spaces.
> 02 There-was-an-error value "Y".
>

No, an 02 level must have a picture (usage) clause. In this example,
you would have to ask:

IF THERE-WAS-AN-ERROR = 'Y' ....
while with a 88:

IF THERE-WAS-AN-ERROR....


>
>We used a simulare method in C or C++.
>
>Do you know if therre is a defined way to get the System date?
>

You're yanking our chain, aren't you (?)......

Obtaining the system date depends on which ANSI standard you are
using. You can:

ACCEPT WS-DAY FROM DAY.
ACCEPT WS-DATE FROM CURRENT-DATE.
MOVE DAY TO WS-DAY.
MOVE CURRENT-DATE TO WS-DATE.
MOVE FUNCTION CURRENT-DATE (1:8) TO WS-DATE.
(just the actual date, skipping the time) ^

etc....

David Speight

unread,
Jun 3, 1997, 3:00:00 AM6/3/97
to

A 77 level was used to define a non group item.
I think that it went away with ANSI 85 COBOL.

. WORKING-STORAGE SECTION.
. 77 PAGE-NUMBER PIC S9(5) COMP-3.
. 77 LINE-NUMBER PIC S9(3) COMP-3.
. 01 PRINT-LINE.
. ...


Mike Rochford wrote in article <3392E5...@easirun.co.za>...

Thane Hubbell

unread,
Jun 3, 1997, 3:00:00 AM6/3/97
to


harry silva <sil...@spectra.net> wrote in article

<5mva4m$2...@ns2.spectra.net>...


>
> Some compilers limit the lowest level is 49/50? Some allow 99 levels.
>

Hmmm never met one like that! All of them I have used have allowed 88
levels. Some don' t use them, but they sure HELP in determining what
switch values perform what function.


Reg Wilkinson

unread,
Jun 4, 1997, 3:00:00 AM6/4/97
to

On the subject of level 77's...I think the definition of a level
77 goes something like this:

A level 77 field is treated by the compiler (seems to be mostly
pre COBOL-85) in exactly the same manner as a level 01, with the
exception that a level 77 cannot contain any group fields.

i.e.

77 A-DATA-ITEM PIC X(4).
AND
01 A-DATA-ITEM PIC X(4).

MEAN EXACTLY THE SAME.

--

Le Ole Captain

unread,
Jun 5, 1997, 3:00:00 AM6/5/97
to

Renegade wrote:
> >
> >
> >Intersting. I ment does the compiler consider 'y' and 'Y' equilvent
> >in this 88 test. Also the use of 88 required or is it just
> >Tradiotinal? Can one just as easily use 02 ?
> >
> Whether it considers 'y' and 'Y' equivilent is a compiler option, most
> do not...
>

The F-COBOL compiler, which does not seem to be 100% COBOL-85
Compliant. Considers 'Y' and 'y' to be very different. The overhead
(uppercase) (lowercase) functions take a lot of space to use.


> >Do you know if therre is a defined way to get the System date?
> >
> You're yanking our chain, aren't you (?)......
>

Actually no. DEC Cobol has/had what are called fixed varables... or
some thing like that (ie:reserved words that are equilvent of functions
in some cases.. including 2 'user defined' functions).

Any way to get the system date & Time as I recall, and read from my
printouts (which our CIS director is trying to get converted to the PC
environment) , one simply :

move TODAY to X-Varable (or 9-Varable).

That did not work in F-Cobol and there was 'honestly' nothing in the
doc's about the Accept's. The F-Cobol Compiler is very robust and
matches and is ahead in may way of the MF-COBOL but the Documentation
is very very in adequate. Our CIS director is quite a mizzer. We had
to buy the 'Cobol-85' manual on our own (IE:a general handbook).

harry silva

unread,
Jun 11, 1997, 3:00:00 AM6/11/97
to

Reg Wilkinson <10136...@CompuServe.COM> wrote:

>i.e.

>MEAN EXACTLY THE SAME.

>--
>

Functionally this is true.

But like manythings in COBOL conventions were worked into the code.
That is we do certain things certain ways so that in the event some
one else must maintain the code we wrote they would understand what we
did.

Thus the use of 77 has probably alwas been the same as 01 to the
compiler. Althou some earlier compilers would not allow a picture
clause on an 01 item. And few CIS managers would not either.

77 is a flag to the programmer that this data item is Independant.
Not directly associated with a Record, or data file.

My point ia.. yes in Cobol-85 77 and 01 are the same - or generates
the same machine code (and might have always done that in some
compilers - but not all I once did a test on a DEC-Cobol compiler and
they did not compile into even simular code) but programmers have
always seemed to differante them. One for 'records'. one for
Independent storage.


roger....@ukonline.co.uk

unread,
Jun 12, 1997, 3:00:00 AM6/12/97
to

The reason for it is/was to cause a different word allignment
to an "01" level.

Richard Plinston

unread,
Jun 12, 1997, 3:00:00 AM6/12/97
to

In message <<5np2dv$jvo$1...@morse.news.easynet.net>> roger....@ukonline.co.uk writes:

>>> What is level 77?


> The reason for it is/was to cause a different word allignment
> to an "01" level.

How do you get a 'different' word alignment ? It is either
word aligned or is not.

01 levels start on a word boundary, so do 77s (on all machines
that I have worked on).

I understand that the only reason for a 77 was that an 01 started
a record and thus shouldn't be used for a non-record independant
item. In an old compiler I used it required all the 77s to
precede the records and tables withing WS.

roger....@ukonline.co.uk

unread,
Jun 13, 1997, 3:00:00 AM6/13/97
to

Dave,
Thank you for helping to dig me out of there.
I said WORD allignment when I meant BYTE.
As you say - who bothers these days?!
Roger.

Richard Plinston

unread,
Jun 14, 1997, 3:00:00 AM6/14/97
to

In message <<33a0c419....@news.dwx.com>> rene...@dwx.com writes:

> wrote:
> >01 levels start on a word boundary, so do 77s (on all machines
> >that I have worked on).
> >
> Level 77's do not force boundry alignment, as the 01 level does. I
> can't imagine why they seem to work different on the machines that you
> have worked on than on IBM mainframes, but....

In Don Nelsons book he states: "[77] is not very useful, since an
elementary level 1 is exactly the same."


0 new messages