<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: ILE Call(e) error handling</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/ile-calle-error-handling/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/ile-calle-error-handling/</link>
	<description></description>
	<pubDate>Mon, 09 Nov 2009 06:38:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Sloopy</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/ile-calle-error-handling/#comment-58352</link>
		<dc:creator>Sloopy</dc:creator>
		<pubDate>Fri, 05 Dec 2008 10:00:15 +0000</pubDate>
		<guid isPermaLink="false">#comment-58352</guid>
		<description>Most of the problems with executing commands from RPG come from the use of QCMDEXC.

If a command sends its error message to the previous program, that program will be QCMDEXC. QCMDEXC will return an error indication to the calling RPG program, but if the RPG program wants any details about the error, those could be hard to get.

Since QCMDEXC can't return any values from the command back to the calling program, my original suggestion - to call the command processing program directly from the RPG, so that error information can be passed back - is a sound proposition, when you are able to add a return code parameter to the command definition and the processing CL.

But if you can't do that, as in the example you give of an emailing command, the best solution is to write a 'wrapper' CL program which can be called directly from your RPG program.

The wrapper program will have a return code, as previously described, to tell the RPG program whether an error ocurred, with some level of detail. It will also accept the parameters that the command requires. You can use the return code on the CALL to tell the wrapper whether you want to prompt the command or not - the parameter may be either blank or '*PROMPT'.

The wrapper would then execute the command, with or without prompting. The command processing program will send its error messages to the previous program, which will be the wrapper program, which can then receive the messages and set the return code before returning back to the RPG.

If your RPG program is a screen program, the wrapper could optionally resend the error messages to ITS previous program, which is the RPG program. If the program message queue specified in the screen message subfile is the same name as the program, then messages sent to it will appear in the message subfile when the screen is redisplayed.

Sloopy</description>
		<content:encoded><![CDATA[<p>Most of the problems with executing commands from RPG come from the use of QCMDEXC.</p>
<p>If a command sends its error message to the previous program, that program will be QCMDEXC. QCMDEXC will return an error indication to the calling RPG program, but if the RPG program wants any details about the error, those could be hard to get.</p>
<p>Since QCMDEXC can&#8217;t return any values from the command back to the calling program, my original suggestion - to call the command processing program directly from the RPG, so that error information can be passed back - is a sound proposition, when you are able to add a return code parameter to the command definition and the processing CL.</p>
<p>But if you can&#8217;t do that, as in the example you give of an emailing command, the best solution is to write a &#8216;wrapper&#8217; CL program which can be called directly from your RPG program.</p>
<p>The wrapper program will have a return code, as previously described, to tell the RPG program whether an error ocurred, with some level of detail. It will also accept the parameters that the command requires. You can use the return code on the CALL to tell the wrapper whether you want to prompt the command or not - the parameter may be either blank or &#8216;*PROMPT&#8217;.</p>
<p>The wrapper would then execute the command, with or without prompting. The command processing program will send its error messages to the previous program, which will be the wrapper program, which can then receive the messages and set the return code before returning back to the RPG.</p>
<p>If your RPG program is a screen program, the wrapper could optionally resend the error messages to ITS previous program, which is the RPG program. If the program message queue specified in the screen message subfile is the same name as the program, then messages sent to it will appear in the message subfile when the screen is redisplayed.</p>
<p>Sloopy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Filuphaze</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/ile-calle-error-handling/#comment-58305</link>
		<dc:creator>Filuphaze</dc:creator>
		<pubDate>Wed, 03 Dec 2008 20:03:09 +0000</pubDate>
		<guid isPermaLink="false">#comment-58305</guid>
		<description>I have a CMD that is compiled over a CL.  In my ILE program I am calling the CL the CMD is compiled over and it doesn't prompt for the user's input.  If I use qcmdexc to execute the CMD directly and if there is an error I do not know which procedure causes the error without looking at the job log.  If I include the MONMSG in the CL that handles the error but I am not aware of it to display on the screen for the user to know the option did not complete.  Here is the source for the CMD. I commented out the MONMSG's.  My ILE program knows there was an error as the *STATUS is 00202 but I don't know which error it was on during or after the CVT2CMD.

            CMD        PROMPT('Email an AS/400 Spool File')
            PARM      KWD(ADDRESS) TYPE(*CHAR) LEN(80) MIN(1) +
                          CASE(*MIXED) PROMPT('Email address')
            PARM      KWD(ADDR1CC) TYPE(*CHAR) LEN(80) +
                          CASE(*MIXED) PROMPT('Cc')
            PARM      KWD(ADDR2CC) TYPE(*CHAR) LEN(80) +
                          CASE(*MIXED) PROMPT('Cc')
            PARM      KWD(ADDR3CC) TYPE(*CHAR) LEN(80) +
                          CASE(*MIXED) PROMPT('Cc')
            PARM      KWD(ADDR4CC) TYPE(*CHAR) LEN(80) +
                          CASE(*MIXED) PROMPT('Cc')
            PARM      KWD(FILE) TYPE(*NAME) MIN(1) MAX(1) +
                          PROMPT('Spool file')
            PARM      KWD(JOB) TYPE(JOB) DFT(*) SNGVAL((* ' ')) +
                          MAX(1) PROMPT('Job')
             PARM       KWD(SPLNBR) TYPE(*CHAR) LEN(5) DFT(*LAST) +
                          SPCVAL((*LAST) (*ONLY)) MIN(0) +
                          CHOICE('1-9999, *LAST') PROMPT('Spooled +
                          file number')
            PARM      KWD(DOC) TYPE(*CHAR) LEN(12) DFT(*DFT) +
                        SPCVAL((*DFT)) PROMPT('Document name')
             PARM       KWD(SUB) TYPE(*CHAR) LEN(44) SPCVAL((*DFT)) +
                          PROMPT('Subject Line')
            PARM      KWD(MSG) TYPE(*CHAR) LEN(256) DFT(*DFT) +
                        SPCVAL((*DFT)) PROMPT('Message text')
JOB:        QUAL      TYPE(*NAME) LEN(10)
            QUAL      TYPE(*NAME) LEN(10) CHOICE(*NONE) +
                          PROMPT('User')
            QUAL      TYPE(*CHAR) LEN(6) CHOICE(*NONE) +
                          PROMPT('Number')

CL Source:
             PGM        PARM(&#38;ADDRESS &#38;ADDR1CC &#38;ADDR2CC &#38;ADDR3CC +
                          &#38;ADDR4CC &#38;FILE &#38;JOB_IN &#38;SPLNBR &#38;DOC &#38;SUB +
                          &#38;MSG)
/* Parameters... */
            DCL        VAR(&#38;ADDRESS) TYPE(*CHAR) LEN(80)
            DCL        VAR(&#38;ADDR1CC) TYPE(*CHAR) LEN(80)
            DCL        VAR(&#38;ADDR2CC) TYPE(*CHAR) LEN(80)
            DCL        VAR(&#38;ADDR3CC) TYPE(*CHAR) LEN(80)
            DCL        VAR(&#38;ADDR4CC) TYPE(*CHAR) LEN(80)
            DCL        VAR(&#38;FILE)    TYPE(*CHAR) LEN(10)
            DCL        VAR(&#38;JOB_IN)  TYPE(*CHAR) LEN(26)
            DCL        VAR(&#38;SPLNBR)  TYPE(*CHAR) LEN(4)
            DCL        VAR(&#38;DOC)    TYPE(*CHAR) LEN(12)
            DCL        VAR(&#38;SUB)    TYPE(*CHAR) LEN(44)
            DCL        VAR(&#38;MSG)    TYPE(*CHAR) LEN(256)
/* Work fields... */
            DCL        VAR(&#38;USER)  TYPE(*CHAR) LEN(10)
            DCL        VAR(&#38;JOB)    TYPE(*CHAR) LEN(10)
            DCL        VAR(&#38;NUMBER) TYPE(*CHAR) LEN(6)
             DCL        VAR(&#38;UTLLIB) TYPE(*CHAR) LEN(10) +
                          VALUE('WDISTLIB')
            DCL        VAR(&#38;RMVLIB) TYPE(*CHAR) LEN(1)  VALUE('1')
            DCL        VAR(&#38;FLR)    TYPE(*CHAR) LEN(80) VALUE('TEMP')
            DCL        VAR(&#38;LF)    TYPE(*CHAR) LEN(3)  VALUE(X'0D0D0D')
            DCL        VAR(&#38;WORD) TYPE(*CHAR) LEN(30)

/* 0010 - Split out job details... */
            CHGVAR    VAR(&#38;NUMBER) VALUE(%SST(&#38;JOB_IN 21 6))
            CHGVAR    VAR(&#38;USER) VALUE(%SST(&#38;JOB_IN 11 10))
            CHGVAR    VAR(&#38;JOB) VALUE(%SST(&#38;JOB_IN 01 10))

/* 0030 - Copy the spool file from either the qualified or current job... */
            IF        COND(&#38;JOB_IN *EQ ' ') THEN(DO)
            RTVJOBA    JOB(&#38;JOB) USER(&#38;USER) NBR(&#38;NUMBER)
            ENDDO

/* 0100 - Build the stream file to be sent... */
            IF        COND(&#38;DOC *EQ '*DFT') THEN(DO)
            CHGVAR    VAR(&#38;DOC) VALUE('SP' *CAT &#38;NUMBER *CAT '.PDF')
            ENDDO

/* 0110 - If a default message is required then set it...  */
            IF        COND(&#38;MSG *EQ '*DFT') THEN(DO)
             CHGVAR     VAR(&#38;MSG) VALUE('Spoolfile ' *CAT &#38;FILE +
                          *TCAT ' from job ' *CAT &#38;JOB *TCAT '/' +
                          *CAT &#38;USER *TCAT '/' *CAT &#38;NUMBER *CAT ' +
                          for your review.')
            ENDDO

            CHGVAR    VAR(&#38;MSG) VALUE(&#38;MSG *TCAT &#38;LF)

/* 0120 - Convert Spooled File to PDF Document             */
             CVT2CMD    FROMFILE(&#38;FILE) TOSTMF(&#38;DOC) +
                          TODIR('qdlstemp') +
                          JOB(&#38;NUMBER/&#38;USER/&#38;JOB) SPLNBR(&#38;SPLNBR) +
                          TOFMT(*PDF) STMFOPT(*REPLACE) +
                          TITLE('ESPLF PDF')
/*           MONMSG     MSGID(CPF3482) EXEC(SNDPGMMSG MSG('File +
                          cannot be sent because it is Open') +
                          TOUSR(&#38;USER))                        */

/* 0200 - Email the document to the email address... */
            IF        COND(&#38;SUB *NE ' ') THEN(DO)
             CHGDOCD    DOC(&#38;DOC) FLR(&#38;FLR) DOCD(&#38;SUB)
            ENDDO
             SNDDST     TYPE(*DOC) TOINTNET((&#38;ADDRESS) (&#38;ADDR1CC +
                          *CC) (&#38;ADDR2CC *CC) (&#38;ADDR3CC *CC) +
                          (&#38;ADDR4CC *CC)) DSTD('Email of Spool +
                          File') MSG(&#38;MSG) DOC(&#38;DOC) FLR(&#38;FLR)
 /*          MONMSG     MSGID(CPF901A) EXEC(SNDPGMMSG MSG('Send +
                          Distribution Request Failed'))         */

/* 9010 - Clear down the work files and documents... */

            DLTDLO    DLO(&#38;DOC) FLR(&#38;FLR)
 /*          MONMSG     MSGID(CPF8A16) EXEC(SNDPGMMSG MSG('Document +
                          Object Deletion Failed'))                  */

/* 9100 - Remove the utility library from the library list... */

            IF        COND(&#38;RMVLIB *EQ '1') THEN(DO)
            RMVLIBLE  LIB(&#38;UTLLIB)
            MONMSG    MSGID(CPF0000)
            ENDDO

/* 9900 - Finally exit the program... */

 ENDIT:      ENDPGM
</description>
		<content:encoded><![CDATA[<p>I have a CMD that is compiled over a CL.  In my ILE program I am calling the CL the CMD is compiled over and it doesn&#8217;t prompt for the user&#8217;s input.  If I use qcmdexc to execute the CMD directly and if there is an error I do not know which procedure causes the error without looking at the job log.  If I include the MONMSG in the CL that handles the error but I am not aware of it to display on the screen for the user to know the option did not complete.  Here is the source for the CMD. I commented out the MONMSG&#8217;s.  My ILE program knows there was an error as the *STATUS is 00202 but I don&#8217;t know which error it was on during or after the CVT2CMD.</p>
<p>            CMD        PROMPT(&#8217;Email an AS/400 Spool File&#8217;)<br />
            PARM      KWD(ADDRESS) TYPE(*CHAR) LEN(80) MIN(1) +<br />
                          CASE(*MIXED) PROMPT(&#8217;Email address&#8217;)<br />
            PARM      KWD(ADDR1CC) TYPE(*CHAR) LEN(80) +<br />
                          CASE(*MIXED) PROMPT(&#8217;Cc&#8217;)<br />
            PARM      KWD(ADDR2CC) TYPE(*CHAR) LEN(80) +<br />
                          CASE(*MIXED) PROMPT(&#8217;Cc&#8217;)<br />
            PARM      KWD(ADDR3CC) TYPE(*CHAR) LEN(80) +<br />
                          CASE(*MIXED) PROMPT(&#8217;Cc&#8217;)<br />
            PARM      KWD(ADDR4CC) TYPE(*CHAR) LEN(80) +<br />
                          CASE(*MIXED) PROMPT(&#8217;Cc&#8217;)<br />
            PARM      KWD(FILE) TYPE(*NAME) MIN(1) MAX(1) +<br />
                          PROMPT(&#8217;Spool file&#8217;)<br />
            PARM      KWD(JOB) TYPE(JOB) DFT(*) SNGVAL((* &#8216; &#8216;)) +<br />
                          MAX(1) PROMPT(&#8217;Job&#8217;)<br />
             PARM       KWD(SPLNBR) TYPE(*CHAR) LEN(5) DFT(*LAST) +<br />
                          SPCVAL((*LAST) (*ONLY)) MIN(0) +<br />
                          CHOICE(&#8217;1-9999, *LAST&#8217;) PROMPT(&#8217;Spooled +<br />
                          file number&#8217;)<br />
            PARM      KWD(DOC) TYPE(*CHAR) LEN(12) DFT(*DFT) +<br />
                        SPCVAL((*DFT)) PROMPT(&#8217;Document name&#8217;)<br />
             PARM       KWD(SUB) TYPE(*CHAR) LEN(44) SPCVAL((*DFT)) +<br />
                          PROMPT(&#8217;Subject Line&#8217;)<br />
            PARM      KWD(MSG) TYPE(*CHAR) LEN(256) DFT(*DFT) +<br />
                        SPCVAL((*DFT)) PROMPT(&#8217;Message text&#8217;)<br />
JOB:        QUAL      TYPE(*NAME) LEN(10)<br />
            QUAL      TYPE(*NAME) LEN(10) CHOICE(*NONE) +<br />
                          PROMPT(&#8217;User&#8217;)<br />
            QUAL      TYPE(*CHAR) LEN(6) CHOICE(*NONE) +<br />
                          PROMPT(&#8217;Number&#8217;)</p>
<p>CL Source:<br />
             PGM        PARM(&amp;ADDRESS &amp;ADDR1CC &amp;ADDR2CC &amp;ADDR3CC +<br />
                          &amp;ADDR4CC &amp;FILE &amp;JOB_IN &amp;SPLNBR &amp;DOC &amp;SUB +<br />
                          &amp;MSG)<br />
/* Parameters&#8230; */<br />
            DCL        VAR(&amp;ADDRESS) TYPE(*CHAR) LEN(80)<br />
            DCL        VAR(&amp;ADDR1CC) TYPE(*CHAR) LEN(80)<br />
            DCL        VAR(&amp;ADDR2CC) TYPE(*CHAR) LEN(80)<br />
            DCL        VAR(&amp;ADDR3CC) TYPE(*CHAR) LEN(80)<br />
            DCL        VAR(&amp;ADDR4CC) TYPE(*CHAR) LEN(80)<br />
            DCL        VAR(&amp;FILE)    TYPE(*CHAR) LEN(10)<br />
            DCL        VAR(&amp;JOB_IN)  TYPE(*CHAR) LEN(26)<br />
            DCL        VAR(&amp;SPLNBR)  TYPE(*CHAR) LEN(4)<br />
            DCL        VAR(&amp;DOC)    TYPE(*CHAR) LEN(12)<br />
            DCL        VAR(&amp;SUB)    TYPE(*CHAR) LEN(44)<br />
            DCL        VAR(&amp;MSG)    TYPE(*CHAR) LEN(256)<br />
/* Work fields&#8230; */<br />
            DCL        VAR(&amp;USER)  TYPE(*CHAR) LEN(10)<br />
            DCL        VAR(&amp;JOB)    TYPE(*CHAR) LEN(10)<br />
            DCL        VAR(&amp;NUMBER) TYPE(*CHAR) LEN(6)<br />
             DCL        VAR(&amp;UTLLIB) TYPE(*CHAR) LEN(10) +<br />
                          VALUE(&#8217;WDISTLIB&#8217;)<br />
            DCL        VAR(&amp;RMVLIB) TYPE(*CHAR) LEN(1)  VALUE(&#8217;1&#8242;)<br />
            DCL        VAR(&amp;FLR)    TYPE(*CHAR) LEN(80) VALUE(&#8217;TEMP&#8217;)<br />
            DCL        VAR(&amp;LF)    TYPE(*CHAR) LEN(3)  VALUE(X&#8217;0D0D0D&#8217;)<br />
            DCL        VAR(&amp;WORD) TYPE(*CHAR) LEN(30)</p>
<p>/* 0010 - Split out job details&#8230; */<br />
            CHGVAR    VAR(&amp;NUMBER) VALUE(%SST(&amp;JOB_IN 21 6))<br />
            CHGVAR    VAR(&amp;USER) VALUE(%SST(&amp;JOB_IN 11 10))<br />
            CHGVAR    VAR(&amp;JOB) VALUE(%SST(&amp;JOB_IN 01 10))</p>
<p>/* 0030 - Copy the spool file from either the qualified or current job&#8230; */<br />
            IF        COND(&amp;JOB_IN *EQ &#8216; &#8216;) THEN(DO)<br />
            RTVJOBA    JOB(&amp;JOB) USER(&amp;USER) NBR(&amp;NUMBER)<br />
            ENDDO</p>
<p>/* 0100 - Build the stream file to be sent&#8230; */<br />
            IF        COND(&amp;DOC *EQ &#8216;*DFT&#8217;) THEN(DO)<br />
            CHGVAR    VAR(&amp;DOC) VALUE(&#8217;SP&#8217; *CAT &amp;NUMBER *CAT &#8216;.PDF&#8217;)<br />
            ENDDO</p>
<p>/* 0110 - If a default message is required then set it&#8230;  */<br />
            IF        COND(&amp;MSG *EQ &#8216;*DFT&#8217;) THEN(DO)<br />
             CHGVAR     VAR(&amp;MSG) VALUE(&#8217;Spoolfile &#8216; *CAT &amp;FILE +<br />
                          *TCAT &#8216; from job &#8216; *CAT &amp;JOB *TCAT &#8216;/&#8217; +<br />
                          *CAT &amp;USER *TCAT &#8216;/&#8217; *CAT &amp;NUMBER *CAT &#8216; +<br />
                          for your review.&#8217;)<br />
            ENDDO</p>
<p>            CHGVAR    VAR(&amp;MSG) VALUE(&amp;MSG *TCAT &amp;LF)</p>
<p>/* 0120 - Convert Spooled File to PDF Document             */<br />
             CVT2CMD    FROMFILE(&amp;FILE) TOSTMF(&amp;DOC) +<br />
                          TODIR(&#8217;qdlstemp&#8217;) +<br />
                          JOB(&amp;NUMBER/&amp;USER/&amp;JOB) SPLNBR(&amp;SPLNBR) +<br />
                          TOFMT(*PDF) STMFOPT(*REPLACE) +<br />
                          TITLE(&#8217;ESPLF PDF&#8217;)<br />
/*           MONMSG     MSGID(CPF3482) EXEC(SNDPGMMSG MSG(&#8217;File +<br />
                          cannot be sent because it is Open&#8217;) +<br />
                          TOUSR(&amp;USER))                        */</p>
<p>/* 0200 - Email the document to the email address&#8230; */<br />
            IF        COND(&amp;SUB *NE &#8216; &#8216;) THEN(DO)<br />
             CHGDOCD    DOC(&amp;DOC) FLR(&amp;FLR) DOCD(&amp;SUB)<br />
            ENDDO<br />
             SNDDST     TYPE(*DOC) TOINTNET((&amp;ADDRESS) (&amp;ADDR1CC +<br />
                          *CC) (&amp;ADDR2CC *CC) (&amp;ADDR3CC *CC) +<br />
                          (&amp;ADDR4CC *CC)) DSTD(&#8217;Email of Spool +<br />
                          File&#8217;) MSG(&amp;MSG) DOC(&amp;DOC) FLR(&amp;FLR)<br />
 /*          MONMSG     MSGID(CPF901A) EXEC(SNDPGMMSG MSG(&#8217;Send +<br />
                          Distribution Request Failed&#8217;))         */</p>
<p>/* 9010 - Clear down the work files and documents&#8230; */</p>
<p>            DLTDLO    DLO(&amp;DOC) FLR(&amp;FLR)<br />
 /*          MONMSG     MSGID(CPF8A16) EXEC(SNDPGMMSG MSG(&#8217;Document +<br />
                          Object Deletion Failed&#8217;))                  */</p>
<p>/* 9100 - Remove the utility library from the library list&#8230; */</p>
<p>            IF        COND(&amp;RMVLIB *EQ &#8216;1&#8242;) THEN(DO)<br />
            RMVLIBLE  LIB(&amp;UTLLIB)<br />
            MONMSG    MSGID(CPF0000)<br />
            ENDDO</p>
<p>/* 9900 - Finally exit the program&#8230; */</p>
<p> ENDIT:      ENDPGM<br />
</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Filuphaze</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/ile-calle-error-handling/#comment-58275</link>
		<dc:creator>Filuphaze</dc:creator>
		<pubDate>Tue, 02 Dec 2008 19:26:16 +0000</pubDate>
		<guid isPermaLink="false">#comment-58275</guid>
		<description>This has worked fine until I have come across a CMD over a CL program that prompts the user for input.  From a HLL program call to the CL the return code is blank but it doesn't prompt the user and if I place the prompt in the CL it recursively calls itself with the '*CMD'.  Could you show me some code examples of the CL and RPG code?  Thanks for your help.</description>
		<content:encoded><![CDATA[<p>This has worked fine until I have come across a CMD over a CL program that prompts the user for input.  From a HLL program call to the CL the return code is blank but it doesn&#8217;t prompt the user and if I place the prompt in the CL it recursively calls itself with the &#8216;*CMD&#8217;.  Could you show me some code examples of the CL and RPG code?  Thanks for your help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Filuphaze</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/ile-calle-error-handling/#comment-58217</link>
		<dc:creator>Filuphaze</dc:creator>
		<pubDate>Mon, 01 Dec 2008 15:03:44 +0000</pubDate>
		<guid isPermaLink="false">#comment-58217</guid>
		<description>That works great Sloopy.  Thanks.</description>
		<content:encoded><![CDATA[<p>That works great Sloopy.  Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sloopy</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/ile-calle-error-handling/#comment-58165</link>
		<dc:creator>Sloopy</dc:creator>
		<pubDate>Fri, 28 Nov 2008 10:36:17 +0000</pubDate>
		<guid isPermaLink="false">#comment-58165</guid>
		<description>One way to do this is to handle the errors in the CL and return a code to the calling program to tell it what happened.

In our programs, we always include a 7-character return code in our parameter lists for calls. Seven characters allows us to send a word of up to seven sensible characters OR a proper message ID, which the calling program can send.

If a call returns a blank return code, the caller can assume that the function completed correctly.

If a CL program is used as a command processing program, it can still be called directly from a HLL program. To distinguish between the uses, the command definition is created with its first parameter a 7-character constant with the value '*CMD'. The CL program recognises this, and will handle errors and return them as escape messages, to be handled by whatever used the command.

If a HLL program calls the CL, it does so directly and not through the command. In that case, the first parameter is the 7-character return code, and it will NOT contain the value '*CMD'. The CL now knows that it is being called directly and will not generate escape messages, but will instead pass a value back through the return code to the calling program.

The additional advantage of this is that all the error checking is done in the CL, where it is easiest; there is no complicated processing in any of the programs thay may call it.

Regards,

Sloopy</description>
		<content:encoded><![CDATA[<p>One way to do this is to handle the errors in the CL and return a code to the calling program to tell it what happened.</p>
<p>In our programs, we always include a 7-character return code in our parameter lists for calls. Seven characters allows us to send a word of up to seven sensible characters OR a proper message ID, which the calling program can send.</p>
<p>If a call returns a blank return code, the caller can assume that the function completed correctly.</p>
<p>If a CL program is used as a command processing program, it can still be called directly from a HLL program. To distinguish between the uses, the command definition is created with its first parameter a 7-character constant with the value &#8216;*CMD&#8217;. The CL program recognises this, and will handle errors and return them as escape messages, to be handled by whatever used the command.</p>
<p>If a HLL program calls the CL, it does so directly and not through the command. In that case, the first parameter is the 7-character return code, and it will NOT contain the value &#8216;*CMD&#8217;. The CL now knows that it is being called directly and will not generate escape messages, but will instead pass a value back through the return code to the calling program.</p>
<p>The additional advantage of this is that all the error checking is done in the CL, where it is easiest; there is no complicated processing in any of the programs thay may call it.</p>
<p>Regards,</p>
<p>Sloopy</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- dynamic -->