$SirMsg: Difference between revisions
(Provided examples of %C substitutions) |
(Removed "This argument may also be a literal.") |
||
Line 21: | Line 21: | ||
<tr><th nowrap>%arg1</th> | <tr><th nowrap>%arg1</th> | ||
<td>An optional substitution argument that will replace the first %C, if one is present, in the message | <td>An optional substitution argument that will replace the first %C, if one is present, in the message.</td></tr> | ||
<tr><th nowrap>%arg2</th> | <tr><th nowrap>%arg2</th> | ||
<td>An optional substitution argument that will replace the second %C, if one is present, in the message | <td>An optional substitution argument that will replace the second %C, if one is present, in the message.</td></tr> | ||
<tr><th nowrap>%arg3</th> | <tr><th nowrap>%arg3</th> | ||
<td>An optional substitution argument that will replace the third %C, if one is present, in the message | <td>An optional substitution argument that will replace the third %C, if one is present, in the message.</td></tr> | ||
</table> | </table> | ||
Revision as of 16:59, 8 August 2017
Line of current $SirMsgP procedure
Note: Many $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.
Syntax
%msg = $SirMsg (line_num, %arg1, %arg2, %arg3)
Syntax terms
%msg | A string set to the contents of line_num in the current $SirMsg procedure. |
---|---|
line-num | 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. |
%arg1 | An optional substitution argument that will replace the first %C, if one is present, in the message. |
%arg2 | An optional substitution argument that will replace the second %C, if one is present, in the message. |
%arg3 | An optional substitution argument that will replace the third %C, if one is present, in the message. |
Usage notes
- $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.
Examples
Suppose the current $SirMsg procedure as set by $SirMsgP contains these lines:
MSG0001: Invalid PF key. MSG0002: Processing record number=%C in file=%C. MSG0003: Invalid data in input field.
If this Print statement:
Print $SirMsg(2,$CURREC,$CURFILE)
was in a FOR loop against file HISTORY, on record number 355, this message would print:
MSG0002: Processing record number=355 in file=HISTORY
.
$CURREC replaces the first %C substitution string and $CURFILE replaces the second. Up to three, optional, substitution strings (%C) may be present in one message.
The following statement would print a null string:
Print $SirMsg(4)