> -----Original Message-----
> From: IBM Mainframe Discussion List 
> [mailto:[email protected]] On Behalf Of Don Leahy
> Sent: Monday, April 25, 2011 4:31 PM
> To: [email protected]
> Subject: Re: Recursive PERFORM in COBOL
> 
> Recursive performs are certainly not forbidden, but are rare. 
>  I once used
> one as the target paragraph of the ON OVERFLOW clause of 
> STRING operation.
> 
> 
>  A100-CONTINUE.
> . . . a lot of stuff omitted . . .
>            PERFORM
>               VARYING WORD-IX FROM WORD-IX BY +1
>                 UNTIL WORD-IX > +100
>                    OR INPUT-WORD (WORD-IX) = SPACES
>               MOVE INPUT-WORD (WORD-IX) TO WS-WORD
>               STRING WS-WORD
>                        DELIMITED BY SPACES
>                      SPACE
>                        DELIMITED BY SIZE
>                  INTO OUTPUT-LINE
>                  WITH POINTER WS-CHAR-OUT-PTR
>                    ON OVERFLOW
>                       PERFORM A100-CONTINUE
>               END-STRING
>            END-PERFORM
>            .
> 

"forbidden" was a poor choice of words on my part. The manual: 
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR50/6.2.27.1
states: "Note: A PERFORM statement must not cause itself to be executed. A 
recursive PERFORM statement can cause unpredictable results." Your example may 
not violate this clause as shown. Or it may. I don't know. It depends on how 
execution got to paragraph A100-CONTINUE. I try to avoid doing things which are 
documented to have "unpredictable results". You'd be amazed at the number of 
times that some programmer will complain that the system is broken when 
something which is documented to have "unpredictable results" has "worked in 
the past" but was now "broken". I must then try to explain to them that getting 
the correct answer is covered by the phrase "unpredictable results" just as 
much as getting a wrong answer or an abend. If they continue to whine at me, I 
report them to my manager who uses stronger language to get them to go away. 
I'd prefer an abend to "unpredictable results".

--
John McKown 
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * 
[email protected] * www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM

 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to