<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I access the dcl program completion status after a call to LIB$SPAWN from HP COBOL? in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5499613#M36694</link>
    <description>&lt;P&gt;Thank you, Sir.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do appreciate the explanation.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2012 16:29:10 GMT</pubDate>
    <dc:creator>Homer Shoemaker</dc:creator>
    <dc:date>2012-01-17T16:29:10Z</dc:date>
    <item>
      <title>How do I access the dcl program completion status after a call to LIB$SPAWN from HP COBOL?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5494279#M36687</link>
      <description>&lt;P&gt;OpenVMS 8.4, HP COBOL 2.9, rx2660,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think&amp;nbsp;I know that the&amp;nbsp;parameter returned is an address, and that the COBOL type is USAGE POINTER.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get at the data stored at that address using that variable from within my COBOL program?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to take different actions in my COBOL program based on the status code returned from the spawned DCL command procedure.&amp;nbsp; Here is an example.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All below is also in the attacment because it is easier to read.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the DCL program that I want to run just to get an error status:&lt;BR /&gt;***********************************************************************&lt;BR /&gt;D2660 HOMER-&amp;gt; type testpgm.com&lt;BR /&gt;$ SET VERIFY&lt;BR /&gt;$ ON ERROR THEN GOTO EXIT&lt;BR /&gt;$ DIR AL;SKDJF;JKL.AL;DKJF&lt;BR /&gt;$EXIT:&lt;BR /&gt;$ EXIT&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here is the screen output when I run that program from a DCL prompt:&lt;BR /&gt;********************************************************************&lt;BR /&gt;D2660 HOMER-&amp;gt; @TESTPGM&lt;BR /&gt;$ SET VERIFY&lt;BR /&gt;$ ON ERROR THEN GOTO EXIT&lt;BR /&gt;$ DIR AL;SKDJF;JKL.AL;DKJF&lt;BR /&gt;%DCL-W-PARMDEL, invalid parameter delimiter - check use of special characters&lt;BR /&gt;&amp;nbsp;\;JKL\&lt;BR /&gt;$EXIT:&lt;BR /&gt;$ EXIT&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here is the status that I want to retrieve from inside my COBOL program:&lt;BR /&gt;************************************************************************&lt;BR /&gt;D2660 HOMER-&amp;gt; SH SYMBOL $STATUS&lt;BR /&gt;&amp;nbsp; $STATUS == "%X10038110"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here is the output file created by LIB$SPAWN:&lt;BR /&gt;*********************************************&lt;BR /&gt;D2660 HOMER-&amp;gt; type testpgm.txt&lt;BR /&gt;$ ON ERROR THEN GOTO EXIT&lt;BR /&gt;$ DIR AL;SKDJF;JKL.AL;DKJF&lt;BR /&gt;%DCL-W-PARMDEL, invalid parameter delimiter - check use of special characters&lt;BR /&gt;&amp;nbsp;\;JKL\&lt;BR /&gt;$EXIT:&lt;BR /&gt;$ EXIT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Here is my COBOL program:&amp;nbsp;&lt;BR /&gt;*************************&lt;BR /&gt;IDENTIFICATION DIVISION.&lt;BR /&gt;PROGRAM-ID.&amp;nbsp;FXTESTSPAWN.&lt;BR /&gt;AUTHOR.&amp;nbsp;&amp;nbsp;H. Shoemaker.&lt;BR /&gt;DATE-WRITTEN.&amp;nbsp;12-JAN-2012&lt;/P&gt;&lt;P&gt;ENVIRONMENT DIVISION.&lt;BR /&gt;DATA DIVISION.&lt;BR /&gt;WORKING-STORAGE SECTION.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;01 DCLPGM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIC X(12).&lt;BR /&gt;01 OUTPUT-FILE-NAME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIC X(16).&lt;/P&gt;&lt;P&gt;01 DCLPGM-COMPLETION-STATUS USAGE POINTER.&lt;/P&gt;&lt;P&gt;01 RET-STATUS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIC S9(9) COMP.&lt;BR /&gt;01 DISP-RET-STATUS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIC Z(4)9.&lt;/P&gt;&lt;P&gt;01 SS$_NORMAL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PIC S9(5) COMP VALUE EXTERNAL SS$_NORMAL.&lt;/P&gt;&lt;P&gt;PROCEDURE DIVISION.&lt;BR /&gt;000-BEGIN.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISPLAY SPACE LINE 1 COLUMN 1 ERASE SCREEN.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MOVE "@TESTPGM.COM"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TO DCLPGM.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MOVE "TESTPGM.TXT"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TO OUTPUT-FILE-NAME.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALL "LIB$SPAWN" USING&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BY DESCRIPTOR DCLPGM&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OMITTED&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BY DESCRIPTOR OUTPUT-FILE-NAME&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OMITTED&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OMITTED&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OMITTED&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BY VALUE DCLPGM-COMPLETION-STATUS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OMITTED&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OMITTED&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OMITTED&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OMITTED&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OMITTED&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GIVING RET-STATUS.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISPLAY "This is the return status&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :"&amp;nbsp;&amp;nbsp;&amp;nbsp; LINE 10 COLUMN&amp;nbsp; 1.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISPLAY DISP-RET-STATUS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LINE 10 COLUMN 40.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EVALUATE RET-STATUS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN SS$_NORMAL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISPLAY "NORMAL"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LINE 10 COLUMN 50&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN OTHER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISPLAY "OTHER"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LINE 10 COLUMN 50&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END-EVALUATE.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; STOP RUN.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2012 17:48:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5494279#M36687</guid>
      <dc:creator>Homer Shoemaker</dc:creator>
      <dc:date>2012-01-13T17:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access the dcl program completion status after a call to LIB$SPAWN from HP COBOL?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5494303#M36688</link>
      <description>&lt;P&gt;The program completion status is returned by address, not by value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By value only works for passing stuff in. &amp;nbsp;Not out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The LIBRTL manual lists this argument as an address by value, which is confusing nomenclature.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2012 18:20:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5494303#M36688</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2012-01-13T18:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access the dcl program completion status after a call to LIB$SPAWN from HP COBOL?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5494353#M36689</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Hi Hoff,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;I appreciate your response.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;But I am still not sure about the steps to take to acess the completion&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;status of the dcl program from within a COBOL program.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;If the passing mechanism that I used is incorrect, which passing mechanism &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;do I use? The default, BY REFERENCE?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;Even so, I still get zero when I examine the variable&amp;nbsp;DCLPGM-COMPLETION-STATUS.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;I am probably not going about this the right way.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;Any more help would also be appreciated.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2012 19:44:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5494353#M36689</guid>
      <dc:creator>Homer Shoemaker</dc:creator>
      <dc:date>2012-01-13T19:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access the dcl program completion status after a call to LIB$SPAWN from HP COBOL?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5494381#M36690</link>
      <description>&lt;P&gt;It would appear you are unfamiliar with the calling standard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quick review...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...You can only get the status back when the variable is passed by reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...Reference means a virtual address is involved. &amp;nbsp;Usually to a variable, but can also potentially be to code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...Passing by reference means you pass the address of where the called code will write the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...A virtual address where the called code will write the completion value, in this case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, the COBOL compiler available on OpenVMS doesn't do this sort of thing very well, so you're limited to passing by reference, or calling into a language that does provide pointers and related. &amp;nbsp;(The COBOL 2002 standard is much more capable here, but the OpenVMS compiler is older and doesn't have this support. Languages such as Macro32, C, Bliss and a few other languages can and do support pointers, and can be used to create "jackets" that make things easier for COBOL programs.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Calling out from COBOL is not obvious, so take the time to&amp;nbsp;&lt;A target="_blank" href="http://h71000.www7.hp.com/doc/82final/6297/6297pro_097.html"&gt;review the COBOL documentation&lt;/A&gt;, and then Google for COBOL examples of $getjpi/$getsyi/$getdvi, etc. &amp;nbsp; &lt;A target="_blank" href="http://vouters.dyndns.org/tima/OpenVMS-Cobol-Internationalizing_messages.html"&gt;Here is one of the hits from Google&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Additionally, if you have a COBOL support contract with HP, then contact the HP support center and see if they can provide you with copies of the old source code examples for COBOL; COBOL examples of calling various RTL services and system services. &amp;nbsp;These examples were once available online via the old Compaq AskQ web site, but access has since disappeared.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2012 20:21:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5494381#M36690</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2012-01-13T20:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access the dcl program completion status after a call to LIB$SPAWN from HP COBOL?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5494813#M36691</link>
      <description>&lt;P&gt;Hi Homer,&lt;/P&gt;&lt;P&gt;You are thinking too complex.&lt;BR /&gt;Or as Hoff put it, the documentation while very correct, is also very confusion to 'beginners'.&lt;BR /&gt;There are subtle semantics at play, but if you just pass the variable by reference as normal it will work just fine.&lt;BR /&gt;When passing by reference, the value of the address of the variable will be passed to the callee.&lt;/P&gt;&lt;P&gt;Mind you Cobol _does_ have a ability to do what the documention appears to spell out&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;:
01 DCLPGM-COMPLETION-STATUS PIC S9(9) COMP.
01 DCLPGM-COMPLETION-STATUS-PT usage pointer.
:
SET DCLPGM-COMPLETION-STATUS-PT TO REFERENCE DCLPGM-COMPLETION-STATUS.
:
CALL .... by value DCLPGM-COMPLETION-STATUS-pt
:
DISPLAY DCLPGM-COMPLETION-STATUS WITH CONVERSION LINE 11 COLUMN 30.
IF DCLPGM-COMPLETION-STATUS&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But there is no need! Just call as always with variable and be happy.&lt;BR /&gt;Ouput and complete program below.&lt;/P&gt;&lt;P&gt;hth,&lt;BR /&gt;Hein&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;------ TEST_1 ---- good command&lt;BR /&gt;$ show time&lt;BR /&gt;$ exit 1234567&lt;BR /&gt;------ TEST_1 ---- Output file&lt;BR /&gt;14-JAN-2012 11:19:56&lt;BR /&gt;------ TEST_1 ---- screen output&lt;/P&gt;&lt;PRE&gt;This is the SPAWN  status            1                NORMAL
This is the PROGRAM status         1234567     GOOD&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;------ TEST_2 ---- bad command&lt;/P&gt;&lt;P&gt;$ show time&lt;BR /&gt;$ exit 1234&lt;BR /&gt;------ TEST_2 ---- Output file&lt;BR /&gt;14-JAN-2012 11:17:42&lt;BR /&gt;%SYSTEM-E-INHCHME, inhibited CHMExecutive trap&lt;BR /&gt;------ TEST_2 ---- screen output&lt;/P&gt;&lt;PRE&gt;This is the SPAWN status       1          NORMAL
This is the PROGRAM status   1234     BAD&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;IDENTIFICATION DIVISION.
PROGRAM-ID. FXTESTSPAWN.
AUTHOR.  H. Shoemaker.
DATE-WRITTEN. 12-JAN-2012
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.

01 DCLPGM                     PIC X(12).
01 OUTPUT-FILE-NAME           PIC X(16).
01 DCLPGM-COMPLETION-STATUS   PIC S9(9) COMP.
01 RET-STATUS                 PIC S9(9) COMP.
01 DISP-RET-STATUS            PIC Z(4)9.
01 SS$_NORMAL                 PIC S9(5) COMP VALUE EXTERNAL SS$_NORMAL.
PROCEDURE DIVISION.
000-BEGIN.
   
    DISPLAY SPACE LINE 1 COLUMN 1 ERASE SCREEN.
   
    MOVE "@TESTPGM.COM"                 TO DCLPGM.
    MOVE "TESTPGM.TXT"                  TO OUTPUT-FILE-NAME.
   
    CALL "LIB$SPAWN" USING
                     BY DESCRIPTOR DCLPGM
                     OMITTED
                     BY DESCRIPTOR OUTPUT-FILE-NAME
                     OMITTED
                     OMITTED
                     OMITTED
                     by reference DCLPGM-COMPLETION-STATUS
                     OMITTED
                     OMITTED
                     OMITTED
                     OMITTED
                     OMITTED
                     GIVING RET-STATUS.
                    
       
    DISPLAY "This is the SPAWN  status       :"    LINE 10 COLUMN  1.
    DISPLAY RET-STATUS WITH CONVERSION             LINE 10 COLUMN 30.
    EVALUATE RET-STATUS
       WHEN SS$_NORMAL     DISPLAY "NORMAL"        LINE 10 COLUMN 50
       WHEN OTHER          DISPLAY "OTHER"         LINE 10 COLUMN 50
    END-EVALUATE.

    DISPLAY "This is the PROGRAM status       :"    LINE 11 COLUMN  1.
    DISPLAY DCLPGM-COMPLETION-STATUS WITH CONVERSION LINE 11 COLUMN 30.
    IF DCLPGM-COMPLETION-STATUS 
       IS SUCCESS          DISPLAY "GOOD"          LINE 11 COLUMN 50
       ELSE                DISPLAY "BAD"           LINE 11 COLUMN 50
    END-IF.
   

    STOP RUN.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2012 17:56:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5494813#M36691</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2012-01-14T17:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access the dcl program completion status after a call to LIB$SPAWN from HP COBOL?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5494829#M36692</link>
      <description>&lt;P&gt;Excellent!&amp;nbsp; Thank you both.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hein,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already tested the second, less complex&amp;nbsp; solution, and it does exactly what I want it to.&amp;nbsp;&amp;nbsp; Since it is Saturday, and&amp;nbsp; I am typing this on&amp;nbsp;my laptop while sitting at the hotel bar and waiting the football game to come on, I will raise a glass to you.&amp;nbsp; I owe you a beer, probably a few beers, next time I see you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Homer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2012 19:42:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5494829#M36692</guid>
      <dc:creator>Homer Shoemaker</dc:creator>
      <dc:date>2012-01-14T19:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access the dcl program completion status after a call to LIB$SPAWN from HP COBOL?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5495621#M36693</link>
      <description>&lt;P&gt;Homer,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Just to explain the peculiar nomenclature of this&amp;nbsp;parameter in the documentation. Like many others you were confused by the description of "address by value", when the completion status is really just a longword by reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For practical purposes "address by immediate value" just means exactly the same thing as "by reference". The reason for the distinction is reference parameters are expected to be written synchronously, during the execution of the called routine. In the case of LIB$SPAWN, you can use the NOWAIT option to return control potentially before the subprocess has completed, in which case the status value will be written after the routine has returned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In an attempt to highlight this feature of the argument it's described as address by immediate value,&amp;nbsp; because the routine itself really just stores away the address. When the asynchronous event occurs&amp;nbsp;(in this case the subprocess completion), the address is used to write the completion status. This can be a problem, if, for example, the parameter were a stack based temporary variable, since you're overwriting what is now a random memory location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In practice, most folk just get confused (this post being just another example). Perhaps it would have been better to describe the argument as "longword by reference written asynchronously".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(there's also an inconsistency here in the documentation, as the IOSBs of the asych system services behave in exactly the same way, but they're all described as "by reference").&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jan 2012 20:41:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5495621#M36693</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2012-01-15T20:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access the dcl program completion status after a call to LIB$SPAWN from HP COBOL?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5499613#M36694</link>
      <description>&lt;P&gt;Thank you, Sir.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do appreciate the explanation.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2012 16:29:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/how-do-i-access-the-dcl-program-completion-status-after-a-call/m-p/5499613#M36694</guid>
      <dc:creator>Homer Shoemaker</dc:creator>
      <dc:date>2012-01-17T16:29:10Z</dc:date>
    </item>
  </channel>
</rss>

