$SirMsg: Difference between revisions
m (1 revision) |
m (1 revision) |
||
Line 18: | Line 18: | ||
<p class="caption">%MSG is set to the contents of line_num in the current <var>$SirMsg</var> procedure.</p> | <p class="caption">%MSG is set to the contents of line_num in the current <var>$SirMsg</var> procedure.</p> | ||
<var>$SirMsgP</var> and <var>$SirMsg</var> allow a programmer to use a <var class="product">Model 204</var> procedure as a message repository. Each line of the procedure corresponds to a message that can be requested by line number with $SirMsg. The advantages of using <var>$SirMsg</var> are: | <var>$SirMsgP</var> and <var>$SirMsg</var> allow a programmer to use a <var class="product">Model 204</var> procedure as a message repository. Each line of the procedure corresponds to a message that can be requested by line number with <var>$SirMsg</var>. The advantages of using <var>$SirMsg</var> are: | ||
<ul> | <ul> |
Revision as of 21:28, 19 October 2012
Line of current $SirMsgP procedure
Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $SirMsg function.
The $SirMsg function is used to retrieve a line from the current $SirMsg procedure as set by $SirMsgP.
$SirMsg accepts one required argument, and it returns a string.
The argument is the number of the line within the current $SirMsg procedure to be returned. A zero returns the name of the current $SirMsg procedure.
If there is no current $SirMsg procedure or the requested line number is invalid (negative or greater than the number of lines in the $SirMsg procedure), $SirMsg returns a null string.
Syntax
<section begin="syntax" /> %MSG = $SirMsg (line_num) <section end="syntax" />
$SirMsgP and $SirMsg allow a programmer to use a Model 204 procedure as a message repository. Each line of the procedure corresponds to a message that can be requested by line number with $SirMsg. The advantages of using $SirMsg are:
- No server space is wasted holding infrequently used error messages.
- The virtual storage holding the messages can be shared among users.
- It simplifies sharing common messages among procedures in a subsystem or online.
Suppose the current $SirMsg procedure as set by $SirMsgP contains these lines:
MSG0001 Invalid PF key. MSG0002 Record not found. MSG0003 Invalid data in input field.
The following statement would print: MSG0002 Record not found
.
PRINT $SirMsg(2)
The following statement would print a null string:
PRINT $SirMsg(4)