>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.
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.
>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).
> 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
>> 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/
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 <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?
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
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.
>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.
> 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.
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.
>>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.
Why ??? Don't you know either Charles ??????
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
or EVALUATE TRUE....
etc.....
Dave
The opinions expressed in this post are purely my own.
You may e-mail replies to: rene...@dwx.com
>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....
Mike Rochford wrote in article <3392E5...@easirun.co.za>...
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.
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.
--
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).
>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.
In Don Nelsons book he states: "[77] is not very useful, since an
elementary level 1 is exactly the same."