SETGRC command: Difference between revisions
m (Automatically generated page update) |
No edit summary |
||
Line 59: | Line 59: | ||
<p>Use SETGRC to test for the success or failure of <var class="product">Model 204</var> command execution when you are working in User Language. </p> | <p>Use SETGRC to test for the success or failure of <var class="product">Model 204</var> command execution when you are working in User Language. </p> | ||
<p>If there are no counting errors in the execution of the preceding command, SETGRC sets a global variable to <var>0</var>. If there are counting errors, SETGRC sets a global variable to <var>1</var>. </p> | <p>If there are no counting errors in the execution of the preceding command, SETGRC sets a global variable to <var>0</var>. If there are counting errors, SETGRC sets a global variable to <var>1</var>. </p> | ||
[[Category: | [[Category: User commands]] | ||
[[Category:Commands]] | [[Category:Commands]] |
Latest revision as of 16:16, 22 March 2017
Summary
- Privileges
- Any user
- Function
- Sets a global variable return code according to the presence or absence of counting errors in the execution of the preceding command
Syntax
SETGRC [rcname] [errstringname]
Where:
rcname | is a global variable that holds the return code. |
---|---|
errstringname | is a global variable that holds the string of the error message associated with the counting error. If multiple messages are issued as a result of the cascade effect of the initial error, the initial error message is retrieved. |
Example
In the following example, SETGRC is followed by IF commands that test the success or failure of SETGRC and include different procedures depending on the value of the SETGTRC return code variable:
COPY PROC ALL TO FILEA SETGRC XRC XMSG IF XRC = 0, YES.PROC IF XRC = 1, NO.PROC
If the value of XRC is 1, the procedure NO.PROC, which does error processing and other recovery work, is included:
PROC NO.PROC BEGIN PRINT 'COPY PROC FAILED - ' WITH $GETG('XMSG') . . . error processing work . . . END END PROCEDURE
If the value of XRC is 0, the procedure YES.PROC is included:
PROC YES.PROC BEGIN PRINT 'PROCEDURES COPIED SUCCESSFULLY' . . . continue doing next logical work . . . END END PROCEDURE
Similarly, you can follow SETGRC with a request that executes different User Language statements depending on the value in the global variable:
COPY PROC ALL TO FILEA SETGRC YRC YMSG BEGIN IF $GETG('YRC') THEN PRINT 'COPY PROC FAILED - ' WITH $GETG('YMSG') . . . other error processing statements . . . ELSE PRINT 'COPY PROC RAN SUCCESSFULLY - PROCESSING CONTINUED' END IF
Usage notes
Use SETGRC to test for the success or failure of Model 204 command execution when you are working in User Language.
If there are no counting errors in the execution of the preceding command, SETGRC sets a global variable to 0. If there are counting errors, SETGRC sets a global variable to 1.