|
You may try RETURN-CODE special register. Here you may find a description from IBM manual: 3.1.39.1 RETURN-CODE Special Register The RETURN-CODE special register can be used to pass return code information (that is, a numeric value) from a program to its caller (either a calling program or the system). You can set the RETURN-CODE special register before executing an EXIT PROGRAM, GOBACK, or STOP RUN statement. RETURN-CODE has the implicit definition: 01 RETURN-CODE GLOBAL PICTURE S9999 USAGE BINARY VALUE 0 This special register may be used anywhere in a program where a data-item with a data definition of PICTURE S9999 USAGE BINARY is allowed. When used in nested programs, the RETURN-CODE special register is implicitly defined as GLOBAL in the outermost program. When a COBOL subprogram terminates, the contents of the RETURN-CODE special register of the subprogram are transferred into the RETURN-CODE special register of the calling program. When the main COBOL program terminates, and control returns to the operating system, the special register content is returned to the operating system as a user return code. For the first call to a program, the RETURN-CODE special register is initialized to zero, which is the normal return code for successful completion. The field will be re-set to zero on subsequent calls to a program that has been cancelled or which possesses the INITIAL attribute. Otherwise, the RETURN-CODE special register will not be re-set, it will be unchanged from the value it contained after the previous call. You can specify the RETURN-CODE special register in a function wherever an integer argument is allowed. Sincerely. Domenico Finucci Fiditalia , Milano, 02- 4301-2494 -----Messaggio originale----- Da: Matthias Oertli [mailto:oertlim@s054.aone.net.au] Inviato: mercoledì 2 maggio 2001 14.52 A: midrange-l@midrange.com Oggetto: Cleanup after program failure Hi guys, I've been asked to code a call to program B from within program A. The difficulty is that program B needs a different environment to program A: A slight change in the library list and a modified data area. This is easily doable, make program A call a small CL which sets up everything, then calls program B and when it returns undoes the changes and finally returns to program A. My problem is this: If program B (or the CL) fails for whatever reason, program A regains control without the environment having been restored to what it should be which could mean disaster. How can I guard against this situation? Thanks for your help. Best regards, Matthias -- --------------------------------------------------------------------- Matthias Oertli <oertlim@s054.aone.net.au> +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.