From m204wiki
Jump to navigation Jump to search

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


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


  • 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.


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


On Thread A


On Thread B


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: