It can be used for that, but it is also used for indicating the return code to be passed back to the operating system, which is the particular situation I'm concerned about.
>________________________________ > From: Tom Marchant <[email protected]> >To: [email protected] >Sent: Thursday, February 27, 2014 8:23 AM >Subject: Re: Using (COBOL) STOP RUN in "subsystem" environments > > >On Wed, 26 Feb 2014 16:59:10 -0800, Frank Swarbrick wrote: > >>MOVE 16 TO RETURN-CODE. >>EXEC SQL ROLLBACK END-EXEC. >>GOBACK. > >>In this case the program ends with RC = 0, not the expected RC = 16. This is >>because the EXEC SQL does a COBOL call to a DB2 module. When the DB2 module >>returns it sets R15 to zero, which implicitly resets RETURN-CODE back to >>zero. Not what is really desired! > >It has been decades since I worked with Cobol, but what I remember about >RETURN-CODE is that is is used for two purposes: >- to indicate the return code to be passed back to the calling program >- to test the return code passed back from a called program > >I am not surprised by the behavior that you describe. > >-- >Tom Marchant > >---------------------------------------------------------------------- >For IBM-MAIN subscribe / signoff / archive access instructions, >send email to [email protected] with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
