interesting use of NEXT SENTENCE vs. CONTINUE
- From: "Frank Swarbrick" <Frank.Swarbrick@xxxxxxxxxxxxxx>
- Date: Thu, 2 Jun 2005 10:24:00 -0600
With all the discussion of the differences between NEXT SENTENCE and
CONTINUE over the years I've been reading comp.lang.cobol I just could not
resist sharing with you some actual production code:
* *************************************************************
* * PRODUCE EXCEPTION FOR ACCOUNTS THAT HAVE NOT HAD ANY ***
* * TRANSACTIONS, NO CASH RESERVE AND HAVE BEEN OPEN AT ***
* * LEAST SEVEN DAYS ***
* *************************************************************
IF CURR-BAL = ZERO
AND DATE-LAST-TXN = ZERO
AND DATE-LAST-STMT = ZERO
AND DATE-OPEN < DATE-6-DAYS-AGO
AND NOT-IN-SWEEP-GRP
AND NOT MSTR-CLOSING-ACCT-OD
AND NOT MSTR-CHARGE-OFF-ACCT
AND NOT MSTR-OLD-CHG-OFF-ACCT
AND NOT MSTR-INTERNAL-BANK
AND RSRV-CURR-BAL = ZERO
AND RSRV-LIMIT = ZERO
AND NO-D13-GENERAL-MEMO
* *************************************************************
IF VPAY-CARD-SVC
IF DATE-OPEN < DATE-40-DAYS-AGO
CONTINUE
ELSE
NEXT SENTENCE
END-IF
END-IF
* *************************************************************
MOVE 'M' TO REPORT-CODE
MOVE +058 TO REPORT-RSN
PERFORM 6200-EXCEPT-OUTPUT THRU
6200-EXCEPT-OUTPUT-EXIT
MOVE 'C' MSTR-CODE-OVERDRAFT
GO TO PROCESS-LARGE-BAL-CHANGE.
The "interesting" code is between the last to lines of all asterisks. It
was obviously added in after the original code, and was obviously done in
order to avoid adding a new GO TO such as:
IF VPAY-CARD-SVC
IF DATE-OPEN < DATE-40-DAYS-AGO
CONTINUE
ELSE
GO TO XXX-CONTINUE
END-IF
END-IF
Where XXX-CONTINUE is a label following the GO TO on the last line above.
But how someone thought this was actually a good idea is beyond me! I
believe he could if just added another AND condition as follows:
AND (NOT VPAY-CARD-SVC OR DATE-OPEN < DATE-40-DAYS-AGO)
(Basically, for VPAY card accounts this exception is generated after 41 days
instead of the 7 day period for all other account SVC types.)
Actually, now that I look at it that is somewhat hard to understand, so I
guess I can see why he chose a separate IF statement. But the CONTINUE vs.
NEXT SENTENCE thing is just nutty.
Anyway, just found it amusing that someone thought it was clever to use NEXT
SENTENCE in this way.
Frank
---
Frank Swarbrick
Senior Developer/Analyst - Mainframe Applications
FirstBank Data Corporation - Lakewood, CO USA
.
- Follow-Ups:
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Andreas Lerch
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: LX-i
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Pete Dashwood
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Michael Mattias
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: HeyBub
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Richard
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- From: Howard Brazee
- Re: interesting use of NEXT SENTENCE vs. CONTINUE
- Prev by Date: Re: SEARCH ALL
- Next by Date: Re: Dynamic memory in standard COBOL; using large data fields
- Previous by thread: Re: convert from rmcobol
- Next by thread: Re: interesting use of NEXT SENTENCE vs. CONTINUE
- Index(es):