$Post: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (add italics)
 
(2 intermediate revisions by one other user not shown)
Line 2: Line 2:


==Syntax==
==Syntax==
<p class="code">$Post({ECB-number[,post-code][,string] | 'QZSIG'})
<p class="code">$Post({<span class="term">ECB-number</span>[,<span class="term">post-code</span>][,<span class="term">string</span>] | 'QZSIG'})
</p>
</p>
<p>Where:</p>
<p>Where:</p>
<ul>
<ul>
<li>ECB-number is a string with a numeric value from one to the <var>[[NECBS parameter|NECBS]]</var> parameter that identifies the ECB to be posted. The ECB-number can be expressed as a numeric literal, a %variable, or a field name.</li>
<li><var class="term">ECB-number</var> is a string with a numeric value from one to the value of the <var>[[NECBS parameter|NECBS]]</var> parameter that identifies the ECB to be posted. The ECB-number can be expressed as a numeric literal, a %variable, or a field name. </li>


<li>post-code is a numeric value between zero and 16,777,215. You can use this optional argument for whatever you wish. If omitted, a default post code of zero is used.
<li><var class="term">post-code</var> is a numeric value between zero and 16,777,215. You can use this optional argument for whatever you wish. If omitted, a default post code of zero is used.
<p>The post code is accessible using the <var>$EcbTest</var> function followed by the <var>$StatusD</var> function for the specified posted ECB.</p>
<p>The post code is accessible using the <var>$EcbTest</var> function followed by the <var>$StatusD</var> function for the specified posted ECB.</p>
<p>Once set, unless explicitly reset to zero, post codes persist whether or not the ECB is posted.</p>
<p>Once set, unless explicitly reset to zero, post codes persist whether or not the ECB is posted.</p>
</li>
</li>


<li>string can be up to 255 bytes long. It can be a numeric, a literal enclosed in quotation marks, a %variable, or a field name.  
<li><var class="term">string</var> can be up to 255 bytes long. It can be a numeric, a literal enclosed in quotation marks, a %variable, or a field name.  
<p>String data is accessible using the <var>$EcbDGet</var> function for the specified ECB.</p>
<p>String data is accessible using the <var>$EcbDGet</var> function for the specified ECB.</p>
<p>Once set, unless explicitly reset to null, data strings persist whether or not the ECB is posted. Depending on the sequence, data strings can be changed by either the <var>$Post</var> or <var>$EcbDSet</var> functions.</p></li>
<p>Once set, unless explicitly reset to null, data strings persist whether or not the ECB is posted. Depending on the sequence, data strings can be changed by either the <var>$Post</var> or <var>$EcbDSet</var> functions.</p></li>
Line 109: Line 109:
<p>
<p>
In the previous code, the <var>$UnPost</var> function on Thread A marks the ECB specified as unposted. Then, Thread A waits at the <code>$WAIT(1)</code> until another thread issues a <code>$Post(1,nnnn)</code>. Thread B posts the ECB number one with <code>$Post(1,32)</code>, at which point Thread A resumes evaluation with <code>PRINT $STATUSD</code> and prints the post code of 32.</p>
In the previous code, the <var>$UnPost</var> function on Thread A marks the ECB specified as unposted. Then, Thread A waits at the <code>$WAIT(1)</code> until another thread issues a <code>$Post(1,nnnn)</code>. Thread B posts the ECB number one with <code>$Post(1,32)</code>, at which point Thread A resumes evaluation with <code>PRINT $STATUSD</code> and prints the post code of 32.</p>
==See also==
The ECB-related $functions are:
<ul>
<li><var>[[$EcbDGet]]</var>
<li><var>[[$EcbDSet]]</var>
<li><var>[[$EcbTest|$EcbTest]]</var>
<li><var>[[$Post]]</var>
<li><var>[[$UnPost]]</var>
<li><var>[[$Wait]]</var>
</ul>


[[Category:SOUL $functions]]
[[Category:SOUL $functions]]

Latest revision as of 17:21, 2 January 2018

$Post indicates that some event has occurred. The thread(s) waiting on the Event Control Block (ECB) can resume processing.

Syntax

$Post({ECB-number[,post-code][,string] | 'QZSIG'})

Where:

  • ECB-number is a string with a numeric value from one to the value of the NECBS parameter that identifies the ECB to be posted. The ECB-number can be expressed as a numeric literal, a %variable, or a field name.
  • post-code is a numeric value between zero and 16,777,215. You can use this optional argument for whatever you wish. If omitted, a default post code of zero is used.

    The post code is accessible using the $EcbTest function followed by the $StatusD function for the specified posted ECB.

    Once set, unless explicitly reset to zero, post codes persist whether or not the ECB is posted.

  • string can be up to 255 bytes long. It can be a numeric, a literal enclosed in quotation marks, a %variable, or a field name.

    String data is accessible using the $EcbDGet function for the specified ECB.

    Once set, unless explicitly reset to null, data strings persist whether or not the ECB is posted. Depending on the sequence, data strings can be changed by either the $Post or $EcbDSet functions.

  • QZSIG is an extended quiesce named ECB. To use it, you need not set the NECBS parameter. QZSIG can be expressed as a literal, a %variable, or a field name. Although QZSIG can be posted, it cannot be unposted. Unposting is handled internally at the end of the extended quiesce. You cannot specify a post code or a string for QZSIG.

Usage

The $Post function posts a specified ECB with an optional post code and an optional associated string. Only an unposted ECB may be posted. If an ECB is already posted, the posted state is indicated by return code 14. The ECB contents and associated string do not change. Any other thread waiting ($Wait) on the specified ECB becomes eligible to resume processing.

Use the $Post, $UnPost, and $Wait functions to coordinate processing between threads.

The following return codes apply to the $Post function

Return code Meaning
0 Success
2 Bad argument specified
3 NECBS parameter is not specified or is zero
4 The first argument is less than one or greater than the NECBS parameter
5 NUSERS is 1
8 No argument specified
9 Checkpointing inactive
10 Post code out of range, 0 to 16,777,215
11 The QZSIG ECB is already posted
12 Invalid argument CPQZ specified or invalid argument following QZSIG
13 Cannot be issued outside of extended quiesce
14 An attempt to post an already posted ECB

Example

On Thread A

BEGIN PRINT $UNPOST(1) PRINT $WAIT(1) PRINT $STATUSD END

On Thread B

BEGIN PRINT $POST(1,32) END

In the previous code, the $UnPost function on Thread A marks the ECB specified as unposted. Then, Thread A waits at the $WAIT(1) until another thread issues a $Post(1,nnnn). Thread B posts the ECB number one with $Post(1,32), at which point Thread A resumes evaluation with PRINT $STATUSD and prints the post code of 32.

See also

The ECB-related $functions are: