|
Hello, To handle such things, in COBOL we use some flag variables (of 1 length character.)We set them on / off ("Y"/"N"), based on different conditions and use these flag variables also in PERFORM...UNTIL loop. For example, Assume FILE-A is keyed on INPUT-YEAR and INPUT-MONTH Assume there is a field employee ID also in the file FILE-A The purpose of this loop can be stated as: Accumulating the total amount for a particular employee ID for the year 2005. MOVE "N" TO WS-T-FLAG-STOP. COMPUTE WS-T-AMOUNT = 0 MOVE 2005 TO INPUT-YEAR OF FILE-A MOVE ZEROS TO INPUT-MONTH OF FILE-A START FILE-A KEY NOT LESS THAN EXTERNALLY-DESCRIBED-KEY INVALID KEY MOVE WS-C-NOT-FOUND TO RETURN-FILE-STATUS END-START IF RETURN-FILE-STATUS = WS-C-FOUND READ FILE-A NEXT RECORD PERFORM UNTIL INPUT YEAR OF FILE-A NOT = 2005 OR WS-T-FLAG-STOP = "Y" OR RETURN-FILE-STATUS NOT = WS-C-END-OF-FILE COMPUTE WS-T-AMOUNT = WS-T-AMOUNT + AMOUNT OF FILE-A READ FILE-A NEXT RECORD IF EMPLOYEE-ID OF FILE-A NOT = WS-T-SAVE-EMPLOYEE-ID MOVE "Y" TO WS-T-FLAG-STOP END-IF END-PERFORM END-IF This is one way we handle things in COBOL. Like to know more replies from other experts... Thanks, -----Original Message----- From: cobol400-l-bounces+muthathal_ramasamy=satyam.com@xxxxxxxxxxxx [mailto:cobol400-l-bounces+muthathal_ramasamy=satyam.com@xxxxxxxxxxxx] Sent: Tuesday, April 19, 2005 2:05 PM To: COBOL Programming on the iSeries/AS400; Cobol400-L@Midrange. Com (E-mail) Subject: [COBOL400-L] "leave" keyword for cobol400 hello all!!! in rpg400 and rpgile there is an opcode "LEAVEXX" which is used to leave a subroutine, loop etc.. What i want to do in my perform until -----, is i want to leave every now and then. What keyword is used in cobol400 to leave a perform until loop, just like a "LEAVE" in rpg. MANY THANKS IN ADVANCE!!! GODBLESS!!! _______________________________________________ This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/cobol400-l or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/cobol400-l. ************************************************************************** This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. **************************************************************************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.