$Post
Function
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 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.
- 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.
- 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.
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 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.
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 = 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.