Page 1 of 1

Is an 88 level initialised when being set to true?

PostPosted: Tue Mar 05, 2013 3:38 pm
by DSP_London
Hello,

Haven't done any coding for about 8 years, so I'm rather rusty! Just have a quick question about 88 levels, and I haven't been able to find a definitive answer in the manuals (although that may be down to my poor manual-trawling skills, rather then the information not being there!).

If I have a field with a couple of associated 88 levels thus:

04 ACTION-TYPE PIC X(6)
88 UPD VALUE 'UPDATE'
88 NEW VALUE 'NEW'

(I know that in this particular example I could use a PIC X and have 'U' and 'N' as values, but that doesn't work for my particular problem, nor would it particularly clear to someone reading it.)

If I code:

SET UPD TO TRUE

Then ACTION-TYPE contains 'UPDATE'

If later on, the code then goes though:

SET NEW TO TRUE

Does ACTION-TYPE get initialised first? I'd want ACTION-TYPE to contain 'NEW ', but I'm not 100% sure that it wouldn't contain 'NEWATE'.

If someone could confirm or deny it, I'd be grateful!

You know what? I could just write something and try it!
/slaps head

If anyone's got an answer, I'd appreciate it, particularly if there are 'exceptions to the rule', but meanwhile I'll go and knock something up.

Cheers!

DSP

Re: Is an 88 level initialised when being set to true?

PostPosted: Tue Mar 05, 2013 3:49 pm
by DSP_London
Turns out the field gets cleared, so in the above example, I end up with 'NEW', not 'NEWATE'.

You live and learn!

DSP

Re: Is an 88 level initialised when being set to true?

PostPosted: Tue Mar 05, 2013 4:48 pm
by BillyBoyo
Sometimes while describing your problem, you get to the answer or a way to get to the answer. We don't mind that at all.

Since the "NEW" test on the 88 had to operate when the field contained only "NEWbbb" (where b=blank) and not "NEWany" (where any is anything), then you'd expect the field to initialise to "NEWbbb", which you showed.

EDIT:

I just notice that you think it is first cleared to space then set to "NEW". To emphasise the above, the length of all the 88s for that field are six bytes, automatically space-padded when the value is shorter than six characters.

Re: Is an 88 level initialised when being set to true?

PostPosted: Tue Mar 05, 2013 7:05 pm
by DSP_London
"the length of all the 88s for that field are six bytes, automatically space-padded when the value is shorter than six characters."

Ah! That's the bit I wasn't sure about.

Thanks for the clarification.

DSP

Re: Is an 88 level initialised when being set to true?

PostPosted: Tue Mar 05, 2013 9:19 pm
by Robert Sample
There is a basic misunderstanding in the title of your post that needs to be cleared up as well. An 88 level CANNOT be initialized as it is not a variable -- which the COBOL Language Reference manual tells you -- as it is a called a conditional and has no strorage allocated to it. The associated conditional variable has storage allocated for it, but the conditional itself is merely a value or set of values (per 5.3.3 of the manual).

Re: Is an 88 level initialised when being set to true?

PostPosted: Wed Mar 06, 2013 8:39 pm
by Ed Goodman
Not knowing assembler, I would have turned that question around: Would 'NEWATE' resolve as TRUE for 'IF NEW'?

Since the answer is no, I would have guessed the final result to be 'NEW '.