$SirMsg: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
m (misc cleanup)
Line 2: Line 2:
<span class="pageSubtitle">Line of current <var>$SirMsgP</var> procedure</span>
<span class="pageSubtitle">Line of current <var>$SirMsgP</var> procedure</span>


<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $SirMsg function.</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $SirMsg function.</p>


The <var>$SirMsg</var> function is used to retrieve a line from the current <var>$SirMsg</var> procedure as set by <var>[[$SirMsgP]]</var>.  
The <var>$SirMsg</var> function is used to retrieve a line from the current <var>$SirMsg</var> procedure as set by <var>[[$SirMsgP]]</var>.  
<var>$SirMsg</var> accepts one required argument, and it returns a string.
The argument is the number of the line within the current <var>$SirMsg</var> procedure to be returned. A zero returns the name of the current <var>$SirMsg</var> procedure.
If there is no current <var>$SirMsg</var> procedure or the requested line number is invalid (negative or greater than the number of lines in the <var>$SirMsg</var> procedure), <var>$SirMsg</var> returns a null string.


==Syntax==
==Syntax==
<p class="syntax">%MSG = $SirMsg (line_num)
<p class="syntax"><span class="term">%msg</span> = $SirMsg (<span class="term">line_num</span>)
</p>
</p>


<p>%MSG is set to the contents of line_num in the current <var>$SirMsg</var> procedure.</p>
===Syntax terms===
<table>
<tr><th>%msg</th>
<td>A string set to the contents of <var class="term">line_num</var> in the current <var>$SirMsg</var> procedure.</td></tr>
 
<tr><th>line-num</th>
<td>The number of the line within the current <var>$SirMsg</var> procedure to be returned. A zero returns the name of the current <var>$SirMsg</var> procedure.
<p>
If there is no current <var>$SirMsg</var> procedure or the requested line number is invalid (negative or greater than the number of lines in the <var>$SirMsg</var> procedure), <var>$SirMsg</var> returns a null string.</p></td></tr>
</table>


==Usage notes==
==Usage notes==
Line 38: Line 41:


The following statement would print: <code>MSG0002 Record not found</code>.
The following statement would print: <code>MSG0002 Record not found</code>.
<p class="code"> PRINT $SirMsg(2)
<p class="code">Print $SirMsg(2)
</p>
</p>


The following statement would print a null string:
The following statement would print a null string:
<p class="code">PRINT $SirMsg(4)
<p class="code">Print $SirMsg(4)
</p>
</p>


[[Category:$Functions|$SirMsg]]
[[Category:$Functions|$SirMsg]]

Revision as of 22:57, 6 October 2015

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)

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.

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 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)