identification division. program-id. forms$demo_timer_ast. ***************************************************************************** * DECforms : Display Time of Day, using Asynchronous output * ***************************************************************************** * * * COPYRIGHT (c) 1990 BY * DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. * * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * TRANSFERRED. * * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * CORPORATION. * * DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. * AUTHOR. Digital Equipment Corporation INSTALLATION. DATE-WRITTEN. 26-Jan-1990 DATE-COMPILED. *++ * * PROGRAM ABSTRACT: * * This program is an example that shows how to asynchronously * (ast) update a field with DECforms. In this program, we * update a field with the current time. However, the method * is generally applicable to updating a field on the screen * with any information -- asynchronously. * *-- * * How It Works * ------------ * * The method used is to enable TWO sessions * to the same form - one for the normal * non-ast form work and the other for the * ast work. * * Once the two sessions are enabled a single * SEND is performed at non-ast level for the * ast session and a timer is started to invoke * an ast-routine after a period of time. * * The normal non-ast work is then started. * In this example a simple RECEIVE loop is * used. * * * Related routines (Each is in a separate file, by the same name): * * forms$demo_timer_ast_routine performs a SEND at ast level * * forms$demo_timer_comp_routine sets up new timer when the * previous ast SEND completes * * forms$demo_timer_check_status checks the return status of * all calls * * forms$demo_timer_set_timer sets up the timer * * * Related form file: * * forms$demo_timer_form.ifdl The form DEMO_TIMER_FORM is here. * It has two form records: AST - for * AST send and NAST for non-ast receive. / data division. working-storage section. *+ * The DECforms definitions *- COPY "sys$library:forms$cob_definitions.lib". 01 ws-local. * Non-ast session id 03 ws-nast-session-id pic x(16). * Non-ast status 03 ws-nast-status pic s9(9) comp. * Device/terminal name for ENABLEs 03 ws-terminal-name pic x(9) value "SYS$INPUT". * Form name for ENABLEs 03 ws-form-name pic x(15) value "DEMO_TIMER_FORM". * Single record marker for RECEIVEs 03 ws-single-record pic s9(9) comp value 1. * AST session id and status * ----------------------------------------------------------- * The definition of ws-ast-data must match the definition * in FORMS$DEMO_TIMER_AST_ROUTINE.COB, since it's shared. * ----------------------------------------------------------- * Shared data: * AST level session id and return status 01 ws-ast-data external. 03 ws-ast-session-id pic x(16). 03 ws-ast-status pic s9(9) comp. * ----------------------------------------------------------- * Non-ast record for non-ast RECEIVEs 01 ws-nast-record. 03 f1 pic x(8). 03 f2 pic x(8). * Ast record for initial non-ast SEND 01 ws-ast-record. 03 ast_time_field pic x(23) value " -Watch this space- ". / procedure division. aa-begin. * Start the two sessions... * Start the non-ast session call "forms$enable" using by value forms$ar_form_table by descriptor ws-terminal-name ws-nast-session-id omitted ws-form-name omitted omitted omitted omitted omitted omitted giving ws-nast-status call "forms$demo_timer_check_status" using ws-nast-status * Start the AST session call "forms$enable" using by value forms$ar_form_table by descriptor ws-terminal-name ws-ast-session-id omitted ws-form-name omitted omitted omitted omitted omitted omitted giving ws-ast-status call "forms$demo_timer_check_status" using ws-ast-status / * SEND to the AST session at non-ast level call "forms$send" using by descriptor ws-ast-session-id "AST" by reference ws-single-record omitted omitted omitted omitted omitted omitted omitted by descriptor ws-ast-record omitted giving ws-nast-status call "forms$demo_timer_check_status" using ws-nast-status * Start a timer for the AST SEND call "forms$demo_timer_set_timer". / nast-receive-loop. * Non-ast RECEIVE loop * RECEIVE the non-ast record call "forms$receive" using by descriptor ws-nast-session-id "NAST" by reference ws-single-record omitted omitted omitted omitted omitted omitted omitted by descriptor ws-nast-record omitted giving ws-nast-status call "forms$demo_timer_check_status" using ws-nast-status * Check for quitting * Quit if both blank if f1 = "" and f2 = "" call "forms$disable" using by descriptor ws-ast-session-id giving ws-nast-status call "forms$demo_timer_check_status" using ws-nast-status stop run end-if * * If we aren't quitting, continue * go to nast-receive-loop. end program forms$demo_timer_ast.