© robertzenuk@newsgroup

Trapping syntax errors is often problematic with compiled programs. This little example demonstrates how you can get your program to communicate the error causing record in the return code.



/* rexx
*/
EXITRC = 0
signal on syntax name trap /* trap syntax errors */
/* some code */

do xxxxx                   /* blantant syntax error */

/* some code */
shutdown: exit(EXITRC)
trap: EXITRC = sigl        /* set RC to bad line */
signal shutdown            /* signal the exit code */

back to Help in Daily Life