Sorry. finger check before I ended the last IF

IF condition THEN
   IF cond2
   THEN statement
   END-IF
ELSE
   else for first condition
END-IF

Or maybe something as weird as:

COMPUTE A=B+C/D*F
ON SIZE ERROR
DISPLAY 'GOT SIZE ERROR COMPUTING A' UPON SYSOUT
GOBACK
END-COMPUTE



On Mon, Mar 25, 2013 at 10:38 AM, John McKown
<[email protected]>wrote:

> My opinion on your "level" question. 01 level is generally used to group
> together related storage or variables. Each 01 level starts a new storage
> area on a doubleword boundary. 77 levels are generally used for
> "independent" variables such as loop counters or maybe accumulators of some
> sort.
>
> Something "new" you might want to review is the use of WORKING STORAGE
> versus LOCAL STORAGE. One main thing about WORKING STORAGE in a subroutine
> is that it maintains the values contained between executions of the
> subroutine. It is a bit like C language "static". On the other hand, LOCAL
> STORAGE values are reset to their VALUE clause (or "nothing in particular"
> if no VALUE clause) each time the subroutine is invoked.
>
> To me, some other "big" and "useful" changes are:
>
> in line PERFORM - allows more like a DO loop instead of needing to PERFORM
> a paragraph or section in another part of the program. It has all the
> options of the historic PERFORM, but is "nicer" if the code to be PERFORM'd
> is not used anywhere else. Avoids putting in otherwise "useless" paragraphs.
>
> Explicit scope termination: Wonderful. Many verbs can now be explicitly
> terminated instead of requiring a end of sentence period. This is
> especially wonderful for the IF / THEN / ELSE / END-IF construct. It makes
> is much easier to nest IF statements and not need a lot of NEXT SENTENCE
> junk as the ELSE portion to "do nothing" E.g. instead of:
>
> IF condition THEN
>    IF cond2
>    THEN statement
>    ELSE NEXT SENTENCE
> ELSE
>    statement for ELSE of first condition
> .
>
> You can:
>
> IF condition THEN
>    IF cond2
>    THEN statement
>
>
> You might look around here for some sites / email groups
> http://www.cobug.com/cobug/docs/forums0008.html#LST
>
>
>
> On Mon, Mar 25, 2013 at 10:17 AM, Bill Ashton <[email protected]>wrote:
>
>> Hi guys...I have been asked to do some COBOL coding, and I have not done
>> some for quite a few years. Is there a COBOL listserv available, and is
>> there any other website that would have recommended best practices?
>>
>> For example, I used to try to code all my working storage under a very few
>> 01 levels, to keep the storage contiguous. I now see lots of 77 levels in
>> sample programs. Which is better and why - can someone point me toward a
>> best practices website?
>> --
>> Thank you and best regards,
>> *Billy Ashton*
>>
>> ----------------------------------------------------------------------
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to [email protected] with the message: INFO IBM-MAIN
>>
>
>
>
> --
> This is a test of the Emergency Broadcast System. If this had been an
> actual emergency, do you really think we'd stick around to tell you?
>
> Maranatha! <><
> John McKown
>



-- 
This is a test of the Emergency Broadcast System. If this had been an
actual emergency, do you really think we'd stick around to tell you?

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to