$SirMsg: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 2: Line 2:
<span class="pageSubtitle"><section begin="desc" />Line of current $SirMsgP procedure<section end="desc" /></span>
<span class="pageSubtitle"><section begin="desc" />Line of current $SirMsgP procedure<section end="desc" /></span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $SirMsg function is [[to be entered]].</p>
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $SirMsg function.</p>


The $SirMsg function is used to retrieve a line from the current $SirMsg procedure as set by $SirMsgP.  
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.  
$SirMsg accepts one required argument, and it returns a string.  
Line 11: Line 11:


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.
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==
==Syntax==
<p class="syntax"><section begin="syntax" /> %MSG = $SirMsg (line_num)
<p class="syntax"><section begin="syntax" /> %MSG = $SirMsg (line_num)
Line 18: Line 19:
<p class="caption">%MSG is set to the contents of line_num in the current $SirMsg procedure.</p>
<p class="caption">%MSG is set to the contents of line_num in the current $SirMsg procedure.</p>


$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:


$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:
<ul>
<ul>
<li>No server space is wasted holding infrequently used error messages.  
<li>No server space is wasted holding infrequently used error messages.  
<li>The virtual storage holding the messages can be shared among users.  
<li>The virtual storage holding the messages can be shared among users.  
Line 27: Line 27:
</ul>
</ul>


Suppose the current $SirMsg procedure as set by $SirMsgP contains these lines:


Suppose the current $SirMsg procedure as set by $SirMsgP contains these lines:
<p class="code"> MSG0001 Invalid PF key.
<p class="code"> MSG0001 Invalid PF key.
  MSG0002 Record not found.
  MSG0002 Record not found.
  MSG0003 Invalid data in input field.
  MSG0003 Invalid data in input field.
</p>
</p>
The following statement would print: :lit.MSG0002 Record not found.:elit.
The following statement would print: :lit.MSG0002 Record not found.:elit.
<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>
<p class="code">  
<p class="code">  
<ul>
<li>No authorizers for $function
</ul>
</p>
<p class="caption">Products authorizing $SirMsg
</p>


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

Revision as of 18:32, 8 February 2011

<section begin="desc" />Line of current $SirMsgP procedure<section end="desc" />

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" />

$SirMsg Function

%MSG is set to the contents of line_num in the current $SirMsg procedure.

$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: :lit.MSG0002 Record not found.:elit.

PRINT $SirMsg(2)

The following statement would print a null string:

PRINT $SirMsg(4)