Re: Report enhancements

From: Robert Wagner (spamblocker-robert_at_wagner.net)
Date: 10/28/04


Date: Thu, 28 Oct 2004 20:17:21 GMT

On Thu, 28 Oct 2004 08:51:50 -0700, "Chuck Stevens"
<charles.stevens@unisys.com> wrote:

>
>"Robert Wagner" <spamblocker-robert@wagner.net> wrote in message
>news:kb61o0trndv8m3torop3obncpp6og8od8o@4ax.com...
>> The fact that no syntax works for out-of-line perform should tell you
>> the concept is flawed. For example PERFORM FOO UNTIL EXIT is truly an
>> infinite loop, therefore a bug (without a GO TO). I would expect the
>> compiler to diagnose it as syntax error.
>
>I haven't yet seen the reasons "EXIT PERFORM" was precluded from use within
>out-of-line PERFORM ranges.

I think the reason is syntactical. EXIT FOO can be read GO TO
(nearest) END-FOO (and stop looping for perform), where END-FOO can be
explicit or implicit. An out-of-line EXIT PERFORM cannot ascertain
where the exit is by syntax alone; it must get the address from the
stack at execution time.

> As I stated before, our implementation allows
>this as an extension. Upon execution of an EXIT PERFORM, the "innermost"
>active PERFORM in the program is exited, and if there isn't one, execution
>proceeds to the next statement as if CONTINUE had been coded.

You are using semantics rather than syntax. To this outside observer,
it seems J4 would not be receptive.

>I agree that an out-of-line indefinite PERFORM pretty much requires either
>the despised GO TO or the prohibited EXIT PERFORM, but I'm not really
>opposed to relaxing the restriction on the latter, unless someone convinces
>me that there's a good reason why it's there.

I can't think of a good reason.

>> Having said that, I'm surprized no one suggested this, which works on
>> Micro Focus today:
>>
>> PERFORM UNTIL FALSE [AND ...]
>> PERFORM UNTIL TRUE [OR ...]
>
>Yes, TRUE and FALSE are reserved words as early as ANSI X3.23-1985,
>introduced, I believe, in support of EVALUATE. To this the 2002 standard
>added the use of FALSE in the VALUE clause of 88-level items (WHEN SET TO
>FALSE) and both values in the SET statement for 88's. Adding "PERFORM
>UNTIL FALSE" would not require new reserved words.

But it would require TRUE and FALSE to be boolean literals, as they
are in most other languages and in Micro Focus as an extension.

While we're on the subject, it seems asymmetrical that we can say SET
CONDITION-1 TO FALSE but cannot say

01 PIC X VALUE FALSE.
       88 CONDITION-1 VALUES 'A' 'B' 'C' FALSE 'D'.

When the value of false changes to 'E', we must change 01 VALUE as
well as 88 VALUES. That's contrary to the spirit of 88s.

>> They could legitimately be used in debugging, similar to IF FALSE AND
>> ... to temporarily comment out code and IF TRUE OR ... to make it
>> execute unconditionally.
>
>I'm not sure what you mean by :"IF FALSE [or TRUE] AND ..." specifically as
>it relates to COBOL; these are extensions as well. TRUE/FALSE are allowed
>only in the contexts mentioned above, so far as I know, in '02 COBOL.
>n-names (88's); (2) in EVALUATE; and (3) SET <condition-name>. You can
>accomplish much the same thing with directives in '02 COBOL.

Examples follow. Please explain how we can do this with '02 features.

  IF (A OR B OR C)
D or true *> forced true when debugging
      MOVE D TO E
      PERFORM FOO
  END-IF

  IF (A OR B OR C)
D and false *> bypass when debugging
      ....
  END-IF

  PERFORM UNTIL (A OR B)
D or true *> bypass when debugging
  ....
  END-PERFORM



Relevant Pages

  • Re: Infinite Loops and Explicit Exits
    ... >That's one reason why I suggest that both EXIT PERFORM and EXIT PERFORM ... >CYCLE be treated as CONTINUE at execution time if they are executed outside ... If not under control of a PERFORM, ...
    (comp.lang.cobol)
  • Re: Automatic variables
    ... || Using CVF to build a GUI system, I came across an injunction in the manual ... local pointer to ALLOCATE a memory and then forget to deallocate it; ... end subroutine foo ... on exit of Foo. ...
    (comp.lang.fortran)
  • Re: return from a sourced shell script
    ... Suppose that in the current shell, ... there is a call to a function foo. ... Then, I want to quit ... trap exit ERR ...
    (comp.unix.shell)
  • Re: sbcl and non-ascii filenames (again)
    ... [ruhl@latakia foo]$ ls ... Type HELP for debugger help, or to exit from SBCL. ...
    (comp.lang.lisp)
  • Re: File Permissions are incorrect. Security flaw in Linux
    ... On Wed, 1 Oct 2003, Jurjen Oskam wrote: ... # chmod 744 foo ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)