Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

AS/400 COBOL Return Code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • AS/400 COBOL Return Code

    I'm trying to convert an HP COBOL application to an iSeries AS/400 COBOL ILE application. I'm having trouble with the Return Code function. In my program, I move a value to return-code and when control is returned to the CL I am executing, the value is replaced with a 0. Can someone explain the steps I need to take in my program and CL to be able to recognize the value I want returned?

  • #2
    AS/400 COBOL Return Code

    When the main ILE COBOL program returns to the operating system the Return-code special register is copied to the jobs user return code area. This area can be accessed from CL using the Retrieve Job Information (QUSRJOBI) API. So if you have: IDENTIFICATION DIVISION. PROGRAM-ID. CBLRTN. PROCEDURE DIVISION. MOVE 5 TO Return-code. STOP RUN. Your CL program could: pgm dcl &rcvvar *char 512 dcl &rcvvarsiz *char 4 dcl &rtnchar *char 4 dcl &rtncde dec (5 0) chgvar %bin(&rcvvarsiz) 512 call cblrtn call qusrjobi (&rcvvar &rcvvarsiz 'JOBI0600' * ' ') chgvar &rtnchar %sst(&rcvvar 109 4) chgvar &rtncde %bin(&rtnchar) endpgm and &rtncde would have a value of 5. Note that passing a parameter from CL to the COBOL program can also allow the COBOL program to return data to the CL program and tends to be more straight forward than using the Return-code special register.

    Comment

    Working...
    X