Writing $Functions with Your Own Error Messages - Rocket Software
Writing $Functions with Your Own Error Messages - Rocket Software
Writing $Functions with Your Own Error Messages - Rocket Software
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Writing</strong> <strong>$Functions</strong> <strong>with</strong> <strong>Your</strong> <strong>Own</strong> <strong>Error</strong> <strong>Messages</strong><br />
In this next example the procedure retrieves three telephone numbers from three<br />
different records in a Model 204 database and passes them to $INSCHAR from the field<br />
TELNO.<br />
BEGIN<br />
FR WHERE TELNO IS LIKE *<br />
PRINT<br />
PRINT TELNO<br />
PRINT $INSCHAR(TELNO,'-')<br />
END<br />
INCLUDE 0<br />
800755422<br />
*** USER.0001: String length must equal 10 bytes<br />
3037868%62<br />
*** USER.0002: String must be numeric 0-9<br />
8005551212<br />
800-555-1212<br />
MSGCTL Command for User <strong>Messages</strong><br />
The MSGCTL command can be used to change the default action taken when a userdefined<br />
message is issued just as it can be used to change that action for Model 204<br />
defined messages. If you need a CCASNAP to be generated when one of your error<br />
messages is issued, you may want to use the MSGCTL command like this:<br />
MSGCTL USER.0001 SNAPPDL<br />
See the description of the MSGCTL command in the Model 204 Parameter and<br />
Command Reference for further details.<br />
Summary<br />
Without error checking we really did not have a useful $function. Now that we have<br />
added the appropriate error messages and error checking code, we have a complete<br />
$function. It inserts a separator into a character string of numbers and it also can detect<br />
and report errors in that string.<br />
<strong>Rocket</strong> M204 April 2009<br />
© 2009 <strong>Rocket</strong> M204<br />
77 Fourth Avenue, Waltham, MA 02451<br />
4 of 4