/****************************************** */
/*Code Fragment for REXX CGI Error Reporting*/
/****************************************** */
ADDRESS 'COMMAND'; SIGNAL ON SYNTAX
PARSE Arg Parms
...
IF QueryInput='' THEN
CALL Exit 490,'No input given!<br>'
...
/*******************************************/
/*Rex will jump to this error exit if a */
/*syntax error occurs. It returns the user */
/*ito the line in the exec with the error. */
/*******************************************/
Syntax:
PARSE SOURCE Arch . $Fn .
CALL Exit 499, 'Syntax error on line',
SIGL 'of' $Fn'. Line="'SOURCELINE(SIGL)'"'
...
Exit: PROCEDURE EXPOSE Debug Parms
/* **************************************
| Exit - Assumes Content-type: text/html
| ************************************* */
PARSE ARG Code, Msg
SAY '<title>'GETENV('SCRIPT_NAME')' error' Code'</title>'
SAY '<h2>Error Code' Code 'reported by'
SAY GETENV('SCRIPT_NAME')'.</h2> The WWW utility on'
SAY '<tt>'GETENV('SERVER_NAME')
SAY ':'GETENV('SERVER_PORT')'</tt>that you are using'
...
SAY 'which reports the following error:'
IF Msg/='' THEN SAY '<hr><h1><code>'Msg'</code></h1>'
IF Debug>0 THEN DO
SAY '<hr>The complete environment follows:<p><pre>'
ADDRESS COMMAND "set"
SAY '<br>Command line arguments="'Parms'".'
SAY '</pre>'
END
SAY '<hr>['
SAY '<a HREF="/slac.html">SLAC Home Page</a> |'
SAY '<a HREF="/suggestion/cottrell">Suggestion Box</a> ]'
SAY '<address><a HREF="/owner/zaphod">Zaphod</a></address>'
IF Code=0 THEN RETURN
EXIT /*Code*/