HP ACMS For Open VMS Systems Interface Programming
HP ACMS For Open VMS Systems Interface Programming
January 2006
Hewlett-Packard Company
Palo Alto, California
© Copyright 2006 Hewlett-Packard Development Company, L.P.
Confidential computer software. Valid license from HP required for possession, use or copying.
Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software
Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government
under vendor’s standard commercial license.
The information contained herein is subject to change without notice. The only warranties for HP
products and services are set forth in the express warranty statements accompanying such products
and services. Nothing herein should be construed as constituting an additional warranty. HP shall
not be liable for technical or editorial errors, or omissions contained herein.
Motif is a registered trademark of The Open Group.
Oracle is a registered US trademark of Oracle Corporation, Redwood City, California.
Oracle CODASYL DBMS, Oracle CDD/Administrator, Oracle CDD/Repository, Oracle Rdb, Oracle
SQL/Services, Oracle Trace, and Oracle Trace Collector are registered US trademarks of Oracle
Corporation, Redwood City, California.
Printed in the US
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
iii
3 Agent Programs that Coordinate Distributed Transactions
3.1 Starting a Distributed Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3–2
3.2 Rolling Back a Distributed Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . 3–4
3.3 Accessing Remote Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3–5
3.4 Step Procedure in C that Acts as an Agent Program . . . . . . . . . . . . . . . . . 3–8
5 Submitter Services
5.1 Preparing to Call a Task . . . . . . . . . . . . . . . . . . . . . . .......... . . . . . . 5–3
5.2 Calling a Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .......... . . . . . . 5–5
5.2.1 Passing a Transaction ID (TID) . . . . . . . . . . . . . . .......... . . . . . . 5–5
5.2.2 Supplying Workspaces to a Task . . . . . . . . . . . . . .......... . . . . . . 5–6
5.2.3 Supplying the Correct Number of Task Argument Workspaces . . . . . . 5–6
5.2.4 Accessing Task Workspaces . . . . . . . . . . . . . . . . . .......... . . . . . . 5–7
5.3 Canceling a Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . .......... . . . . . . 5–8
5.4 ACMS$CALL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .......... . . . . . . 5–9
5.5 ACMS$CANCEL_CALL . . . . . . . . . . . . . . . . . . . . . . . .......... . . . . . . 5–14
5.6 ACMS$GET_PROCEDURE_INFO . . . . . . . . . . . . . . . .......... . . . . . . 5–16
5.7 ACMS$START_CALL . . . . . . . . . . . . . . . . . . . . . . . . .......... . . . . . . 5–20
5.8 ACMS$WAIT_FOR_CALL_END . . . . . . . . . . . . . . . . .......... . . . . . . 5–25
6 Stream Services
6.1 Overview of Stream Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–2
6.2 ACMS$REPLY_TO_STREAM_IO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–5
6.3 ACMS$WAIT_FOR_STREAM_IO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–7
iv
A Superseded Services and Parameters
A.1 ACMS$CLOSE_RR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–3
A.2 ACMS$CONNECT_STREAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–5
A.3 ACMS$CREATE_STREAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–8
A.4 ACMS$DELETE_STREAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–10
A.5 ACMS$DISCONNECT_STREAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–12
A.6 ACMS$OPEN_RR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–14
A.7 Superseded Parameters of the Task I/O Argument . . . . . . . . . . . . . . . . . . A–17
A.7.1 Argument List for a Task That Performs Request I/O . . . . . . . . . . . . . A–17
A.7.2 Argument List for a Task That Passes Only Stream I/O . . . . . . . . . . . A–17
A.7.3 Argument List with Selection String, Extended Status, and Terminal
I/O Defined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–18
Index
Examples
3–1 A Specialized User-Written Agent . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3–3
3–2 Task Definition that Calls a Procedure Used as an Agent . . . . . . . . . . 3–6
3–3 Task Definition that Calls a Procedure to Update Remote Data . . . . . 3–7
3–4 Step Procedure in C that Acts as an Agent Program . . . . . . . . . . . . . . 3–8
7–1 C Agent Program that Starts a Distributed Transaction . . . . . . . . . . . 7–2
7–2 FORTRAN General-Purpose Agent Program . . . . . . . . . . . . . . . . . . . 7–10
7–3 C Agent Program that Performs Stream I/O or No I/O . . . . . . . . . . . . 7–15
7–4 BLISS Agent Program that Uses Superseded Services . . . . . . . . . . . . 7–20
7–5 Pascal Agent Program that Uses ACMS$WAIT . . . . . . . . . . . . . . . . . . 7–26
Figures
1–1 Agent Programs Submitting Tasks to ACMS . . . . . . . . . . . . . . . . . . . . 1–3
1–2 Stream Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–5
3–1 Using a Step Procedure as an Agent Program . . . . . . . . . . . . . . . . . . . 3–6
4–1 Signing In a Task Submitter to ACMS . . . . . . . . . . . . . . . . . . . . . . . . . 4–2
5–1 Calling a Task in ACMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5–2
5–2 Arguments Passed for a Task Using a Full Task Argument List . . . . . 5–4
5–3 Arguments Passed for a Task Doing No I/O . . . . . . . . . . . . . . . . . . . . . 5–4
6–1 Using Stream Services to Communicate with ACMS . . . . . . . . . . . . . . 6–2
A–1 Arguments Passed for a Task Doing Request I/O . . . . . . . . . . . . . . . . . A–17
A–2 Arguments Passed for a Task Doing Stream I/O . . . . . . . . . . . . . . . . . A–18
A–3 Arguments Passed for a Task Doing Terminal I/O . . . . . . . . . . . . . . . . A–18
v
Tables
1–1 Systems Interface Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–2
2–1 Procedure Parameter Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2–2
3–1 System Services Used in Distributed Transactions . . . . . . . . . . . . . . . 3–1
4–1 SI Initialization Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–2
4–2 SI Exchange I/O Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–2
5–1 Submitter Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5–2
6–1 SI Stream Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–3
A–1 Superseded Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–1
vi
Preface
The ACMS Systems Interface (SI) is a group of system services that enable a
programmer to interface a wide range of external devices and systems with the
HP ACMS for OpenVMS (ACMS) run-time environment. For example, you can
provide a new method of menu selection or an alternate terminal management
system to replace or supplement the default ACMS menu system.
This manual introduces the concept of the ACMS agent program, a program
that invokes a task that executes in an ACMS application. This manual clarifies
and complements information you gain by first reading the manuals in the
Planning and Design as well as the Development and Testing phases of the
documentation life cycle.
Intended Audience
Read this manual if you need a detailed description of and reference information
about the ACMS Systems Interface, referred to in this document as the SI. This
manual is for systems programmers, experienced users, or application designers
with a strong knowledge of ACMS, the HP OpenVMS operating system, and
programming on the OpenVMS operating system.
Document Structure
This manual contains overview information, reference information for calling the
SI services, and examples of agent programs.
Chapter 1 Introduces the SI services, gives a brief description of each, and
describes the function of agent programs.
Chapter 2 Explains the features common to all the SI services and the features
common to the various languages that can call the services.
Chapter 3 Explains the specific SI services that agent programs need to call to
start and end a distributed transaction and to access data on remote
nodes.
Chapter 4 Describes the initialization services and exchange I/O services, and
gives reference information for calling them in agent programs.
Chapter 5 Describes the submitter services and gives reference information for
calling them in agent programs.
Chapter 6 Describes the stream services and gives reference information for
calling them in agent programs.
Chapter 7 Provides a number of agent program examples.
Appendix A Describes superseded exchange I/O and stream services.
vii
Related Documents
The following table lists the books in the HP ACMS for OpenVMS documentation
set.
HP ACMS Version 5.0 for OpenVMS Information about the latest release of the software
Release Notes†
HP ACMS Version 5.0 for OpenVMS Description of installation requirements, the installation
Installation Guide procedure, and postinstallation tasks.
HP ACMS for OpenVMS Getting Overview of ACMS software and documentation.
Started Tutorial for developing a simple ACMS application.
Description of the AVERTZ sample application.
HP ACMS for OpenVMS Concepts Description of how to design an ACMS application.
and Design Guidelines
HP ACMS for OpenVMS Writing Description of how to write task, task group, application, and
Applications menu definitions using the Application Definition Utility.
Description of how to write and migrate ACMS applications on
an OpenVMS Alpha system.
HP ACMS for OpenVMS Writing Description of how to write programs to use with tasks
Server Procedures and how to debug tasks and programs. Description of how
ACMS works with the APPC/LU6.2 programming interface
to communicate with IBM CICS applications. Description of
how ACMS works with third-party database managers, with
Oracle used as an example.
HP ACMS for OpenVMS Systems Description of using Systems Interface (SI) Services to submit
Interface Programming tasks to an ACMS system.
HP ACMS for OpenVMS ADU Reference information about the ADU commands, phrases,
Reference Manual and clauses.
HP ACMS for OpenVMS Quick List of ACMS syntax with brief descriptions.
Reference
HP ACMS for OpenVMS Managing Description of authorizing, running, and managing ACMS
Applications applications, and controlling the ACMS system.
HP ACMS for OpenVMS Remote Description of the features of the Remote Manager for
Systems Management Guide managing ACMS systems, how to use the features, and how to
manage the Remote Manager.
Online help† Online help about ACMS and its utilities.
viii
ACMS Help
ACMS and its components provide the following online help:
• DCL-level help
Enter HELP ACMS at the DCL prompt for complete help about the
ACMS command and qualifiers, and for other elements of ACMS for which
independent help systems do not exist. DCL-level help also provides brief
help messages for elements of ACMS that contain independent help systems
(such as the ACMS utilities) and for related products used by ACMS (such as
DECforms).
• ACMS utilities help
Each of the following ACMS utilities has an online help system:
ACMS Debugger
ACMSGEN Utility
ACMS Queue Manager (ACMSQUEMGR)
Application Definition Utility (ADU)
Application Authorization Utility (AAU)
Device Definition Utility (DDU)
User Definition Utility (UDU)
Audit Trail Report Utility (ATR)
Software Event Log Utility Program (SWLUP)
The two ways to get utility-specific help are:
Run the utility and type HELP at the utility prompt.
Use the DCL HELP command. At the ‘‘Topic?’’ prompt, type @ followed by
the name of the utility. Use the ACMS prefix, even if the utility does not
have an ACMS prefix (except for SWLUP). For example:
Topic? @ACMSQUEMGR
Topic? @ACMSADU
However, do not use the ACMS prefix with SWLUP:
Topic? @SWLUP
Note that if you run the ACMS Debugger Utility and then type HELP, you
must specify a file. If you ask for help from the DCL level with @, you do not
need to specify a file.
• ACMSPARAM.COM and ACMEXCPAR.COM help
Help for the command procedures that set parameters and quotas is a subset
of the DCL-level help. You have access to this help from the DCL prompt, or
from within the command procedures.
• LSE help
ACMS provides ACMS-specific help within the LSE templates that assist
in the creation of applications, tasks, task groups, and menus. The ACMS-
specific LSE help is a subset of the ADU help system. Within the LSE
templates, this help is context-sensitive. Type HELP/IND (PF1-PF2) at any
placeholder for which you want help.
ix
• Error help
ACMS and each of its utilities provide error message help. Use HELP ACMS
ERRORS from the DCL prompt for ACMS error message help. Use HELP
ERRORS from the individual utility prompts for error message help for that
utility.
• Terminal user help
At each menu within an ACMS application, ACMS provides help about
terminal user commands, special key mappings, and general information
about menus and how to select tasks from menus.
• Forms help
For complete help for HP DECforms or TDMS, use the help systems for these
products.
Reader’s Comments
HP welcomes your comments on this manual.
Print or edit the online form SYS$HELP:OPENVMSDOC_COMMENTS.TXT and
send us your comments by:
Internet [email protected]
Mail Hewlett-Packard Company, L.P.
OSSG Documentation Group, ZKO3-4/U08
110 Spit Brook Rd.
Nashua, NH 03062-2698
Conventions
The following conventions are used in this manual:
Ctrl/x A sequence such as Ctrl/x indicates that you must press and
hold the key labeled Ctrl while you press another key or a
pointing device button.
PF1 x A sequence such as PF1 x indicates that you must first press
and release the key labeled PF1 and then press and release
another key or a pointing device button.
Return In examples, a key name enclosed in a box indicates that
you press a key on the keyboard. (In text, a key name is not
enclosed in a box.)
In the HTML version of this document, this convention appears
as brackets rather than a box.
x
... A horizontal ellipsis in examples indicates one of the following
possibilities:
• Additional optional arguments in a statement have been
omitted.
• The preceding item or items can be repeated one or more
times.
• Additional parameters, values, or other information can be
entered.
xi
<lowercase> In command format descriptions, lowercase text in angle
brackets indicates a required clause or phrase.
() In command format descriptions, parentheses indicate that you
must enclose the options in parentheses if you choose more
than one.
[| |] In command format descriptions, vertical bars within square
brackets indicate that you can choose any combination of the
enclosed options, but you can choose each option only once.
{| |} In command format descriptions, vertical bars within braces
indicate that you must choose one of the options listed, but you
can use each option only once.
References to Products
The ACMS documentation set to which this manual belongs often refers to certain
products by abbreviated names:
Abbreviation Product
ACMS HP ACMS for OpenVMS Alpha, and HP ACMS for OpenVMS I64
Ada HP Ada for OpenVMS Alpha Systems, and HP Ada for OpenVMS I64
Systems
BASIC HP BASIC for OpenVMS
C HP C for OpenVMS Alpha Systems, and HP C for OpenVMS I64 Systems
CDD Oracle CDD/Administrator, and Oracle CDD/Repository
COBOL HP COBOL for OpenVMS Alpha Systems, and HP COBOL for OpenVMS
I64 Systems
DATATRIEVE HP DATATRIEVE for OpenVMS Alpha, and HP DATATRIEVE for
OpenVMS I64
DBMS Oracle CODASYL DBMS
DECforms HP DECforms
FORTRAN HP Fortran for OpenVMS Alpha Systems, and HP Fortran for OpenVMS
I64 Systems
OpenVMS The OpenVMS Alpha operating system, and the OpenVMS I64 operating
system
Pascal HP Pascal for OpenVMS Alpha, and HP Pascal for OpenVMS I64
Rdb Oracle Rdb
SQL The SQL interface to Oracle Rdb
xii
1
Overview of the ACMS Systems Interface
Note
Although you can access ACMS from an ALL-IN-1 agent, running the
ALL-IN-1 system from within an ACMS DCL server process may have
severe negative impact on system performance.
This is only a partial list of all the extensions to ACMS that are possible using
the SI. An agent program can be very simple or very complex; it can handle
requests for a single user or multiple users.
An agent program uses the SI services on behalf of one or more task submitters.
You can write an agent program in any language that supports the OpenVMS
calling standard. A task submitter is associated with an OpenVMS user name
that identifies the user to the ACMS system.
The function of the agent program is much like the ACMS command process.
In fact, the ACMS command process is an agent program supplied with ACMS.
An agent program can sign in to ACMS to represent a single task submitter or
multiple task submitters, if necessary. An agent program interacts with the user
or external system and invokes tasks to perform required processing. The method
of interacting with a user can be a menu system on a terminal screen or some
other method.
By default, a task submitter is a DECforms-supported terminal such as the DEC
VT series terminals. However, an agent program can recognize almost anything
as a task submitter—from a person sitting at a terminal to a badge reader,
DECtalk, or a postage scale. Each of these external entities is supported by the
agent program.
Figure 1–1 shows the steps agent programs use to submit tasks to the ACMS
system.
Agent
1
Sign In
Task
2
Initialization
Exchange I/O
3
Submitter
Services
4
Termination
Exchange I/O
5
Sign Out
TAY-0181-AD
The agent program can use task arguments to pass data that is mapped to
workspaces when the task instance begins execution. When the task instance
ends, this data can be updated and can return to the agent program.
In addition, an agent program can control the distributed transaction in
which called tasks participate.
4 The agent program terminates exchange I/O.
5 The agent program signs out.
This sequence of processing by an agent program is similar to that of the ACMS
command process. The primary work of the agent program is in the third phase,
where it calls ACMS tasks.
Agent EXC
Legend:
Stream
TAY-0123-AD
Because the agent program works on behalf of the task submitter, the agent
program creates and connects a stream between itself and the EXC. The EXC is
the interpreter of the task definition.
This chapter describes features common to the SI services and the various
languages that use them. The chapter also explains the reference format used
in the following chapters and describes the ACMS$SIGNAL and ACMS$WAIT
support services.
When a call to a synchronous SI service returns to the calling routine, the service
and all processing are finished. The service returns a completion status value
to indicate the success or failure of the service. For example, an agent program
might call ACMS$SIGN_IN to sign a task submitter in to the ACMS system.
When control returns to the calling module, the agent program checks the return
status to determine whether or not the sign-in service completed successfully.
Using the asynchronous version of the SI services allows an agent program
to perform other processing work while the ACMS system is performing the
processing associated with that service. The asynchronous services return a
status code when the initial call is made to indicate whether or not ACMS
accepted the request to perform that service. ACMS returns a success status to
the calling agent program to indicate that ACMS is now processing the request.
When the processing is complete, ACMS returns another status to the calling
agent program to indicate whether or not the processing completed successfully.
Note
Many of the services rely on asynchronous system traps (ASTs) being
delivered in order to operate. Therefore, components that use these
services should not disable ASTs for long periods of time.
If it was unable to begin processing the request, ACMS returns a failure status
when the initial call is made. For example, ACMS might return a failure status if
it could not read an argument passed to the service. If a call to an asynchronous
service fails and the service returns an error status to the calling agent program,
the service does not take place, and ACMS does not set an event flag or call an
AST completion routine.
The synchronous calling formats differ from the asynchronous calling formats
in that they do not include the trailing _A at the end of the service name. The
asynchronous SI services include four additional, optional arguments that handle
asynchronous completion. Except for these four asynchronous service parameters,
the parameter descriptions and return status messages discussed after the
service formats pertain to both synchronous and asynchronous services. These
four asynchronous service parameters are:
• comp_status.wq.r
• efn.rbu.r
• astadr.szem.r
• astprm.rz.v.
A description of each of these parameters follows:
comp_status
The final completion status of the service. This is a two longword block. The
block is set to zero when the service starts successfully, and the return status
message from the service is ACMS$_PENDING. When the service completes,
the first longword of the block contains the final status. The completion status
contains a nonzero value when the service is finished.
efn
The event flag that is set when the service completes. When the service starts
successfully and returns the ACMS$_PENDING status, the event flag is cleared.
Because ACMS sets the event flag only when the service is done, the agent
program should check the comp_status parameter first for a nonzero value to
verify that the service really ended. See $SYNCH in OpenVMS System Services
Reference Manual.
astadr
The address of an AST routine to be called when the service completes. If the
service started successfully (the return status is ACMS$_PENDING), this AST is
delivered when the service completes.
astprm
The parameter the AST passes to the service completion routine.
To determine the success or failure of a call to an asynchronous SI service, the
agent program must supply the address of a quadword completion status block
that ACMS can use to store the status result. An agent program normally uses
an event flag or an AST completion routine to determine that an asynchronous
service has completed. The agent program might also pass an optional parameter
to the AST completion routine.
For example, the synchronous and asynchronous formats for ACMS$SIGN_IN are
the following:
Format
ACMS$SIGN_IN (submitter_id.wq.r,
[username.rt.dx],
[device.rt.dx],
[cancel_routine.zem.r],
[cancel_param.rz.v])
ACMS$SIGN_IN_A (submitter_id.wq.r,
[username.rt.dx],
[device.rt.dx],
[cancel_routine.zem.r],
[cancel_param.rz.v],
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
2.1.5.1 ACMS$SIGNAL
Note
Do not use event flags if your agent program calls several asynchronous
services at the same time for a single task submitter. ACMS cannot
ensure that ACMS$SIGNAL will return information on the correct service
completion because any of the services could have set the event flag.
Format
ACMS$SIGNAL (id.rq.r)
Parameters
id
The submitter ID returned on the ACMS$SIGN_IN service.
Because the ACMS$SIGNAL service requires a submitter ID as input, the agent
program must explicitly sign in task submitters using the ACMS$SIGN_IN
service, and pass the address of the submitter ID returned by the ACMS$SIGN_
IN service to ACMS$SIGNAL. For example, the ACMS$SIGNAL service might
return an error condition if the submitter ID is invalid.
Note
Because the submitter ID is returned on successful completion of the
ACMS$SIGN_IN service, ACMS$SIGNAL fails after an unsuccessful call
to the ACMS$SIGN_IN service.
Return Status
The return status codes indicating success or failure of the call are:
See Chapter 7 for examples of agent programs that call the ACMS$SIGNAL
service.
2.1.5.2 ACMS$WAIT
Note
An agent program must use the ACMS$WAIT service at mainline level
if it uses these asynchronous services. If an agent program does not use
ACMS$WAIT with these services, it is possible for the service to hang
indefinitely.
• If an agent program selects a task that performs any exchange step using
DECforms or TDMS request I/O, you must use the ACMS$WAIT service
instead of SYS$HIBER or SYS$WAITFR. Set the completion status parameter
to a nonzero value for the equivalent of a SYS$WAKE at mainline level.
Note
You must use ACMS$WAIT in such situations even if .RLB or .FORM files
are manually cached, because ACMS checks the remote .RLB or .FORM
file to make sure that the submitter node has the latest copy.
Format
ACMS$WAIT (comp_status.rq.r)
Parameters
comp_status
The status block that waits for a nonzero value.
Note
ACMS$WAIT waits for only one event flag that is stored in a global location
called ACMS$EFN. The ACMS$EFN symbol is not the value of the event flag.
Rather it is the address of the location where the event flag number is stored.
Therefore, declare ACMS$EFN as an external longword variable, not an external
longword constant. Also, you must pass ACMS$EFN explicitly to all SI services
when you use ACMS$WAIT, because ACMS does not set the event flag implicitly.
Return Status
The first longword of the IOSB is the return status. The return status is the
completion status of the call that was waited for.
ACMS$WAIT may also return the completion status of the relevant asynchronous
service.
For single-threaded agent programs that do not call the ACMS$SIGN_IN service,
the user is signed in automatically during the first call to an SI service, but a
submitter ID is not returned to the user. Thus, the agent program cannot pass a
submitter ID to any subsequent SI services.
The following restrictions apply to single-threaded agent programs that do not
call the ACMS$SIGN_IN service; these agent programs:
• Cannot call tasks that perform HP DECforms I/O
• Must submit tasks under their own user name
• Must not use SYS$INPUT
• May receive ACMS$SIGN_IN errors from the first service called
• Cannot call the ACMS$SIGNAL service
• Must not call ACMS$SIGN_IN service at any time
If an agent program calls the ACMS$SIGN_IN service, it must use the
ACMS$SIGN_IN service for each task submitter that it handles. The agent
program must also pass a submitter ID to all subsequent SI services.
HP recommends that you use settings for the logical name based on the version of DECforms
that the agent uses, as follows:
• DECforms Version 1.4 is used.
Defining the logical name ACMS$DECFORMS_IN_AGENT is not required,
but has no harmful effects. Defining the logical name causes ACMS to load
the FORMS$MANAGER forms manager during initialization, rather than
when the first DECforms call is made.
• DECforms Version 2.1B is used.
Define the logical name ACMS$DECFORMS_IN_AGENT to a TRUE value.
Doing so ensures that ACMS brings CMA into the process if CMA is not
already there.
• DECforms Version 2.2 is used.
If the agent is intended to run in single-user mode, defining the logical
name ACMS$DECFORMS_IN_AGENT has no effect, because CMA is
not in the process. Defining the logical name causes ACMS to load the
FORMS$MANAGER forms manager during initialization, rather than when
the first DECforms call is made.
Define the logical name ACMS$DECFORMS_IN_AGENT only when using
DECforms Version 2.1B or when using DECforms Version 2.2 in multi-user
mode.
2.1.8.2 Starting an Agent Program
If the agent program handles only one task submitter and receives its input from
your terminal (SYS$INPUT), you can start it with the DCL RUN command. For
example:
$ RUN MYAGENT.EXE
For multithreaded agent programs that handle several task submitters or
threads, or agent programs that receive input from a device other than a
terminal, you can invoke the agent image as a detached process. For example:
$ RUN/DETACHED/UIC=[1,4] -
_$ /INPUT=MTAINPUT.DAT -
_$ /OUTPUT=MTAOUTPUT.LOG -
_$ /PROCESS=ACMS_MYAGENT MYAGENT.EXE
This example shows that the agent program receives its input from the file
MTAINPUT.DAT and logs messages in the file MTAOUTPUT.LOG. The next
section describes some additional considerations for writing a multithreaded
agent program.
ACMS$S_STREAM_ID
ACMS$S_SUBMITTER_ID
• Constants other than return status values that are used in service calls
for both input and output. Examples of this type of constant are the item
codes in the item list in the ACMS$GET_PROCEDURE_INFO service. These
constants are resolved at compile time.
• Status values declared as external literals. They are resolved at link time.
Some language interface files contain entry point information. The BLISS require
file, for example, provides keyword macros for all the services.
The following sections discuss how BLISS, C, FORTRAN, MACRO, Pascal, and
PL/I access the services. The last section describes how to use the services with
other languages.
2.2.1 BLISS
The require file SYS$LIBRARY:ACMSBLI.R32 is supplied for BLISS
programmers. The system manager can compile this file into a BLISS library file.
See the BLISS-32 documentation for information on using require files, creating
library files, and using library files.
The require file:
• Contains keyword macros for all the services. The macro name is the service
name prefixed with a dollar sign ($). The keyword macro for ACMS$SIGN_
IN, for example, is $ACMS$SIGN_IN.
• Contains structure definitions for all IDs. Use these IDs in declaration
definitions. The name of the structure is the same as the name given in the
structure layouts listed in Section 2.2.
• Defines constants other than return status values.
2.2.2 C
The text library SYS$LIBRARY:ACMSCC.TLB is supplied for C programmers.
Refer to C documentation for information about using the text library files in
programs.
The text library provides the following modules for agent programs:
• ACMS$SUBMITTER
• ACMS$STREAM
These modules:
• Contain routine definitions for all the SI services as functions returning long
integers.
• Contain structure definitions for all IDs. Use these IDs in declarations. The
name of the structure is the same as that given in the structure list above.
• Define constants other than return status values. These constants are defined
by #DEFINE preprocessor definitions.
2.2.3 FORTRAN
The text library SYS$LIBRARY:ACMSFOR.TLB is supplied for FORTRAN
programmers. See FORTRAN documentation for information on using the text
library files in programs.
The text library provides the following modules for agent programs:
• ACMS$SUBMITTER
• ACMS$STREAM
These modules:
• Contain all the services defined as EXTERNAL INTEGER*4 functions.
• Contain byte arrays for all IDs. The name of the byte array is the same as
the name given in the structure list in Section 2.2. The byte array gives the
programmer one of each of the IDs.
• Define constants other than return status values. These constants are defined
as parameters. For a method of referring to return status values, see the
sample program in Chapter 7 for an example of a FORTRAN agent program
using ACMS$_SENDER_DISCONN.
2.2.4 MACRO
The MACRO library SYS$LIBRARY:ACMSMAC.MLB is supplied for MACRO
programmers. See the MACRO documentation for information on using macro
libraries. SYS$LIBRARY:ACMSMAC.MLB contains the following interface
definition macros for agent programs:
• ACMS$SUBMITTER
• ACMS$STREAM
Use these macros to include the appropriate definitions for the services
used. These macros take one parameter, either <=> or <= =>. The parameter
determines whether the constant definitions are made locally or globally.
Each of these macros:
• Contains the size of the IDs
• Defines constants other than return status values
2.2.5 Pascal
The source file SYS$LIBRARY:ACMSPAS.PAS is supplied for Pascal
programmers. The system manager must process this file into a PASCAL
ENVIRONMENT file. See the Pascal documentation for information on creating
and using environment definitions.
The source file:
• Contains routine definitions for all the services.
• Contains record definitions for all IDs. Use these IDs in declarations. The
name of the record is the same as the name given in the structure list in
Section 2.2.
Note
If you use the nonpositional syntax form of parameter association, you
must use PROCEDURE_ rather than PROCEDURE as the formal
parameter name for ACMS$GET_PROCEDURE_INFO, because
PROCEDURE is a reserved word in Pascal. See VAX Pascal Reference
Manual for more information.
2.2.6 PL/I
The text library SYS$LIBRARY:ACMSPLI.TLB is supplied for PL/I programmers.
See PL/I documentation for information on using text library files in programs.
This text library provides the following modules for agent programs:
• ACMS$SUBMITTER
• ACMS$STREAM
These modules:
• Contain routine definitions for all the services.
• Contain structure definitions for all IDs as BASED variables. Use these IDs
in declarations. The name of the structure is the same as the name given in
the structure list in Section 2.2.
• Define constants other than return status values. These constants are defined
by %REPLACE preprocessor definitions.
Note
The optional TRANSW (wait) system services complete synchronously;
that is, they return to the caller after the request has actually completed.
The action part of the root step must not specify an explicit distributed
transaction step.
The sequencing action in the action part of the root step must be EXIT
TASK, CANCEL TASK, or RAISE EXCEPTION.
You can use the ADU command DUMP GROUP to dump a task group to
determine whether or not a task is composable.
• For an application, the composability rules are the following:
The application must run under ACMS Version 3.2 or higher.
The application must have been rebuilt using ACMS Version 3.2 or
higher.
• For an agent program, the composability rules are the following:
The agent program must use SI services for ACMS Version 3.2 or higher.
Before it starts a task, the agent program must call the $START_TRANS
system service to start a distributed transaction and to obtain a
transaction ID (TID).
The agent program must call the task, passing the TID, by using either of
the following:
* ACMS$START_CALL and ACMS$WAIT_FOR_CALL_END
* ACMS$CALL
The task that is called joins the distributed transaction established by
the $START_TRANS service if the task is composable. If the task that is
called is not composable, it is cancelled.
When the task completes, the agent program can either end or roll back
the distributed transaction by using one of the following:
* $END_TRANS, to end the transaction
* $ABORT_TRANS, to roll back the transaction
The choice between $END_TRANS and $ABORT_TRANS depends on the
final completion status of the task. However, a call to the $END_TRANS
service can fail with an error status if the distributed transaction is rolled
back between the end of the task and the time the agent program calls
the $END_TRANS service. A transaction can roll back in this manner for
a number of reasons; for example, the network communication between
two or more participants in the distributed transaction could fail, or the
ACMS/CANCEL TASK command could be used to cancel the task while it
is still in the pending end-of-transaction state.
is a default distributed transaction in the agent program, the task joins the
distributed transaction.
• For a task not to participate in an active distributed transaction, the agent
program must explicitly pass a TID consisting of zeros. If the agent process
has done a $START_TRANS in the process and the agent program does not
want this task to join the default distributed transaction, this is the only
way to ensure that the task will not participate in an active distributed
transaction.
The following services accept a TID:
ACMS$CALL
ACMS$CALL_A
ACMS$START_CALL
ACMS$START_CALL_A
The calling sequences for these services are listed in Chapter 5.
When an agent program passes a TID to one of these services, ACMS attempts
to pass the TID on to the task. If an agent program tries to pass a TID to a task
that cannot join a distributed transaction, either the ACMS$WAIT_FOR_CALL_
END or the ACMS$CALL service returns ACMS$_TASKNOTCOMP, indicating
that the task is not composable.
If ACMS attempts to pass a TID to a task in an application that does not follow
composability rules, one of the following errors is returned:
• ACMS$_NOTRANSNODE - ACMS does not support transactions on this
application node.
This error is returned when the application is running on a node that has
ACMS Version 3.1 or earlier installed.
• ACMS$_NOTRANSADB - Transactions are not supported in the ACMS
application database (ADB).
This error is returned when the application database has not been rebuilt
with ACMS Version 3.2 or higher.
Example 3–1 illustrates the logic of an agent program that processes records from
a data file and calls tasks as a single distributed transaction.
status = ACMS$START_CALL
< additional processing >
IF .error_condition_detected
THEN
cancel_status = ACMS$CANCEL_CALL
task_status = ACMS$WAIT_FOR_CALL_END
IF .error_condition_detected OR NOT .task_status
THEN
IF .task_status
THEN
cancel_status = $ABORT_TRANS
< task termination processing >
An agent program that starts a distributed transaction can roll back the
transaction by a call to $ABORT_TRANS at any of the following times:
• Before calling a task
Because a task has not been called, the rollback affects only database
interactions that the agent program has performed.
Figure 3–1 illustrates the use of a step procedure as an agent program to call a
task in an application on a remote node.
NODE A NODE B
TASK_1
block work TASK_2
processing with trans block work with trans
call step_procedure_1 call step_procedure_2
commit trans end block
end block
Step_Procedure_2
ACMS$GET_TID
Step_Procedure_1 update local account
ACMS$GET_TID insert local history
update local branch return
update local teller
ACMS$CALL_TASK_2
return
TAY-0248-AD
Example 3–2 contains the task definition that calls the procedure BANKING_
SAMPLE_TXN. The processing step in the task definition starts a distributed
transaction.
Example 3–2 (Cont.) Task Definition that Calls a Procedure Used as an Agent
ACTION IS
SELECT FIRST TRUE OF
(ACMS$L_STATUS = 1): COMMIT TRANSACTION;
(ACMS$L_STATUS = -913): ROLLBACK TRANSACTION;
GOTO STEP BANKING_SAMPLE_PROCESSING;
NOMATCH: ROLLBACK TRANSACTION;
CANCEL TASK;
END SELECT;
EXCEPTION ACTION IS
CANCEL TASK;
OUTPUT_REQUEST:
EXCHANGE
TRANSCEIVE RECORD BANKING_SAMPLE_REC, BANKING_SAMPLE_REC
IN BANKING_SAMPLE_FORM
SENDING BANKING_SAMPLE_WORKSPACE
RECEIVING BANKING_SAMPLE_WORKSPACE;
!+
! Examine the control field. If the request returns Y,
! then leave the task; else, repeat the task.
!-
ACTION IS
IF (BANKING_SAMPLE_WORKSPACE.WORKSPACE_EXIT_SWITCH = "Y") THEN
EXIT TASK;
ELSE
GOTO STEP BANKING_SAMPLE_PROCESSING;
END IF;
Example 3–3 Task Definition that Calls a Procedure to Update Remote Data
REPLACE TASK BANKING_SAMPLE_ACTUPD_TSK /DIAGNOSTIC
WORKSPACE IS BANKING_SAMPLE_WORKSPACE WITH TYPE TASK;
TASK ARGUMENT IS BANKING_SAMPLE_WORKSPACE WITH ACCESS MODIFY;
BLOCK WORK WITH DISTRIBUTED TRANSACTION NO I/O
Example 3–3 (Cont.) Task Definition that Calls a Procedure to Update Remote
Data
BANKING_SAMPLE_PROCESSING:
PROCESSING
CALL BANKING_SAMPLE_ACTUPD_TXN IN BANKING_SAMPLE_ACTUPD_SERVER
USING BANKING_SAMPLE_WORKSPACE;
END BLOCK WORK;
ACTION IS
IF (ACMS$L_STATUS <> 1) THEN
CANCEL TASK RETURNING ACMS$L_STATUS;
END IF;
END DEFINITION;
Note
Steps 10 through 13 are actually substeps within step 6.
10 Specify task name and application name; note that the application is running
on a remote node.
11 Sign in to ACMS.
12 Prepare and get remote procedure information.
13 Pass workspace from agent program to remote task.
/*************************************************************************/
/* */
/* Sample Banking Application */
/* Branch/Teller Update Transaction */
/* -------------------------------- */
/* */
/* This is the server procedure called by the BANKING_SAMPLE_TSK task */
/* to perform local update of branch and teller data and invoke the */
/* remote task, BANKING_SAMPLE_ACTUPD_TASK, for update of an account */
/* on a remote node. */
/*************************************************************************/
#include ssdef
#include stdio
#include descrip
#include string
#include ACMS$SUBMITTER
char txn_time[9],txn_date[7];
$DESCRIPTOR(date_time_dscrptr,"dd-mmm-yyyy hh:mm:ss.hh");
/*********************************************************/
/* Banking Sample Transaction. */
/*********************************************************/
banking_sample_txn(workspace_area)
struct banking_workspace *workspace_area;
{
struct banking_workspace WSBuff;
char ActBranchBuff[5],ActAccountBuff[7];
static struct context_structure context={1,1,16,{0,0,0,0,0},0};
char ErrMsgText[300];
int ErrMsgLength;
int status;
$DESCRIPTOR(ErrMsgBuffDsc,"");
/* Get TID from ACMS and store into SQL context structure */
status = ACMS$GET_TID(&tid); 5
if (!(status & SS$_NORMAL)) return(status);
context.in_tid = tid;
transaction_restart:
/***********************************************/
/* Modify Branch. */
/***********************************************/
/* Perform update on the MONEY field for
appropriate branch in BRANCH relation. */
EXEC SQL USING CONTEXT :context
UPDATE BRANCH B
SET B.BR_MONEY_FIELD =
B.BR_MONEY_FIELD + :WSBuff.workspace_delta
WHERE B.BR_BRANCH = :WSBuff.workspace_branch;
/* End of Transaction. */
workspace_area->workspace_delta = 0;
status = SS$_NORMAL;
return(status);
InitializeACMSRPC()
{
int status;
/* initialize ACMS RPC data structure */
tsk_dscrptr.dsc$a_pointer = "BANKING_SAMPLE_ACTUPD_TSK"; 10
tsk_dscrptr.dsc$w_length = 25;
strcpy(&appl_name[0],"SLVSTR::BANK_SAMPLE_APP");
appl_dscrptr.dsc$a_pointer = &appl_name[0];
appl_dscrptr.dsc$w_length = strlen(&appl_name[0]);
/* Sign-in to ACMS as a task submitter. */
status = ACMS$SIGN_IN(&submitter_id,0,0,0,0); 11
if (!(status & SS$_NORMAL)) {
error_logging("ACMS sign-in error.",status,0,0," "," ",0);
return(status);
}
/* Prepare ACMS$GET_PROCEDURE_INFO item list for remote task */ 12
single_item_list.proc_bufsize = ACMS$S_PROCEDURE_ID;
single_item_list.proc_itmcode = ACMS$K_PROC_PROCEDURE_ID;
single_item_list.proc_retlen = 0;
single_item_list.item_last = 0;
/* Get remote procedure information */
single_item_list.proc_bufaddr = &procedure_id;
status = ACMS$GET_PROCEDURE_INFO (&submitter_id,
&tsk_dscrptr,
&appl_dscrptr,
&single_item_list);
if (!(status & SS$_NORMAL))
{
error_logging("ACMS GET_PROCEDURE_INFO error.",status,
0,0," "," ",0);
return(status);
}
/* Prepare ACMS$CALL() argument list for remote task */
arg_list.count = 4;
arg_list.sel_str = 0;
arg_list.ext_sts = 0;
arg_list.tsk_io = 0;
arg_list.ws_1 = &wksp_dscrptr; 13
return(1);
}
Agent ACMS
Sign In
ACC ACMSUDF.DAT
Initialization
Task Exchange I/O
Submitter
ACMSDDF.DAT
Services
Termination
Exchange I/O
SYSUAF.DAT
Sign Out
TAY-0124-AD
Only users authorized with the ACMS User Definition Utility (UDU) can gain
access to ACMS. Also, if the task uses a terminal or other device for I/O, the
terminal or device must be authorized with the ACMS Device Definition Utility
(DDU). See HP ACMS for OpenVMS Managing Applications for more information
about authorizing users and devices with UDU and DDU.
Table 4–2 shows the SI exchange I/O services. You must use these services for
any task that uses DECforms (FORM I/O).
The exchange I/O services and reference material for calling them in agent
programs are discussed in Section 4.3 and Section 4.4.
• If the agent program signs in under its own user name or without passing a
user name, the ACMS$SIGN_IN service completes successfully and returns
the message:
ACMS$_SIGNIN_NOAUTH, Sign in completed successfully without
authentication.
Although this user name is signed in to ACMS, the user cannot select tasks
from any ACMS application until the ACMS system is started.
The following pseudocode shows how an agent program can handle both
situations:
Signin_status = ACMS$SIGN_IN
if signin_status eql ACMS$_SIGNIN_NOAUTH
then
sign_out the submitter
if signin_status eql ACMS$_SIGNIN_NOAUTH or ACMS$_NOSYSTEM
then
[exit the agent
or
retry "n" times]
Note
An agent program must sign a user in to ACMS with a "username"
argument to ACMS$SIGN_IN in capital letters.
4.6 ACMS$INIT_EXCHANGE_IO
Specifies the type of I/O the agent program or device can perform. ACMS$INIT_
EXCHANGE_IO is called by the agent program and returns an exchange I/O ID.
For submitters that enable TDMS, a call to ACMS$INIT_EXCHANGE_IO opens
a TDMS channel.
Note
If an agent program enables stream I/O and associates it with a
submitter, the agent program must call ACMS$WAIT_FOR_STREAM_IO
for all tasks (except tasks that do no terminal I/O), whether or not the
task performs stream I/O.
Format
ACMS$INIT_EXCHANGE_IO
(submitter_id.rq.r,
exchange_io_id.wq.r,
[io_enable_flags.rl.r],
[item_list.rx.r],
[io_capabilities_flags.wl.r])
ACMS$INIT_EXCHANGE_IO_A
(submitter_id.rq.r,
exchange_io_id.wq.r,
[io_enable_flags.rl.r],
[item_list.rx.r],
[io_capabilities_flags.wl.r],
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
submitter_id
The submitter ID corresponding to a signed-in submitter (user). This ID is
returned by the ACMS$SIGN_IN service. No default submitter ID is allowed.
exchange_io_id
This ID keeps track of the type of I/O the submitter is performing. This ID is
passed to the call or start call service as the third argument in the task argument
list.
The exchange_io_id parameter must be supplied. This value is returned upon
successful completion of the call.
io_enable_flags
These flags indicate which type of I/O the agent program wishes to perform.
If this flag is not supplied, the agent program can call a task that performs
DECforms and TDMS I/O, but it cannot use the Request Interface.
To use TDMS, the default value of the io_enable_flags argument initializes the
agent program. If it is certain that tasks will never use TDMS I/O, disable TDMS
to conserve resources. If the ACMS$V_IO_DISABLE_TDMS flag is set on the
call to ACMS$INIT_EXCHANGE_IO, TDMS is disabled for the agent process.
Because TDMS is completely disabled in the agent process, if a task that uses
TDMS for I/O is selected, it is canceled.
To use DECforms, the default value of the io_enable_flags argument initializes
the agent program. If you are certain that you will never use DECforms, it is
advisable to disable DECforms in order to conserve resources. If the ACMS$V_
IO_DISABLE_DECFORMS flag is set on the call to ACMS$INIT_EXCHANGE_
IO, HP DECforms is disabled for the agent process. Because HP DECforms is
completely disabled in the agent process, if a task that uses HP DECforms for I/O
is selected, it is canceled.
To use the Request Interface (RI), you must set the ACMS$V_IO_ENABLE_
SYNC_RI flag on the call to ACMS$INIT_EXCHANGE_IO. In some cases, it may
be desirable to disable HP DECforms and TDMS. For example, if the device is
not supported by HP DECforms or TDMS, disabling HP DECforms and TDMS
can conserve resources. Further information regarding the RI is in HP ACMS for
OpenVMS Writing Applications.
Stream I/O is implicitly enabled by passing a connect ID in the item list.
item_list
This is the address of an item list describing the information requested. An
item list is an OpenVMS data type that is used to pass information to and from
a service. Item lists are made up of one or more item descriptors. The list of
item descriptors must be terminated by an item code of 0. Detailed information
regarding item lists is in OpenVMS Programming Interfaces: Calling a System
Routine.
Possible item codes are:
• ACMS$K_TDMS_CHANNEL
To obtain TDMS channel codes, set up an item list with an entry whose item
code is ACMS$K_TDMS_CHANNEL. The buffer is a longword that receives
the channel number.
• ACMS$K_CONNECT_ID
If you wish to use stream I/O in the agent program, you need to provide an
entry in the item list. The buffer is a quadword that receives the connect ID.
The connect ID returned by the service is used to wait for and reply to stream
I/O operations. See Chapter 6 for further details regarding stream I/O.
io_capabilities_flags
This flag is a longword containing bits indicating which I/O methods are
successfully initialized. The following bits are defined:
• ACMS$V_DECFORMS_AVAILABLE
This bit is set if HP DECforms is successfully initialized. If DECforms is not
installed on the system, or was disabled, the bit is clear.
• ACMS$V_TDMS_AVAILABLE
This bit is set if TDMS is successfully initialized. If TDMS is not installed on
the system, or was disabled, the bit is clear.
• ACMS$V_STREAM_AVAILABLE
This bit is set if the stream services are successfully initialized.
• ACMS$V_RI_AVAILABLE
This bit is set if ACMS has successfully enabled the RI.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Return Status
The following list summarizes each error returned by ACMS$INIT_EXCHANGE_
IO.
The return status codes indicating success or failure of the call follow:
4.7 ACMS$SIGN_IN
Format
ACMS$SIGN_IN (submitter_id.wq.r,
[username.rt.dx],
[device.rt.dx],
[cancel_routine.zem.r],
[cancel_param.rz.v])
ACMS$SIGN_IN_A (submitter_id.wq.r,
[username.rt.dx],
[device.rt.dx],
[cancel_routine.zem.r],
[cancel_param.rz.v],
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
submitter_id
The submitter identification that is output by the ACMS$SIGN_IN service.
username
The OpenVMS user name of the submitter signing in. The default is the agent
program’s user name. The ACMS Central Controller (ACC) makes sure that the
user name exists in ACMSUDF.DAT. If the user name specified is different from
the agent program’s user name, ACC verifies that the agent program’s user name
is privileged by checking the agent program definition in the ACMSUDF.DAT
database file.
Note
An agent program must sign a user in to ACMS with a capitalized
"username" argument to ACMS$SIGN_IN.
device
The terminal device name that you supply if the task performs I/O to the
terminal. The device name can be a physical device name or a logical name.
The default is NL:. ACC makes sure that the device name exists in the
ACMSDDU.DAT database file.
cancel_routine
The routine called (at AST level) when the submitter is canceled. If this
parameter is omitted, the agent program receives no notification when the
submitter is canceled. Any further operations by this submitter fail. When this
parameter is used, the agent program receives notification when the submitter is
canceled, after which the following parameters are passed to the cancel routine:
• cancel_param
The cancel user parameter that was passed with ACMS$SIGN_IN. This is
passed by value, rather than by reference.
• submitter_id
The address of the two-longword identification of the submitter being
canceled. This is the address of the submitter_id passed by ACMS$SIGN_IN.
• reason
The longword indicating the reason for the user cancellation. The possible
reasons are:
ACMS$_ACMS_GONE—the ACMS system has stopped
ACMS$_SUB_CANCELED—the submitter was canceled by an operator
request
This is passed by value, rather than by reference.
cancel_param
The value to be passed to the cancel routine.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Return Status
The return status codes indicating the success or failure of the call are:
Note
Special situations exist if an agent program attempts to sign a submitter
in when the ACMS system is not started. See Section 4.2 for guidelines
on handling these situations.
4.8 ACMS$SIGN_OUT
Format
ACMS$SIGN_OUT (submitter_id.rq.r,
[cancel_flag.rlu.r])
ACMS$SIGN_OUT_A (submitter_id.rq.r,
[cancel_flag.rlu.r],
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
submitter_id
The identification of the task submitter signing out. This ID is assigned in the
ACMS$SIGN_IN service.
cancel_flag
The address of the flag that specifies whether or not to cancel active calls. If
the low bit of this flag is set, active calls are canceled and the sign-out routine
completes successfully. If this flag is not set or is not passed and there are calls
active, the sign-out routine fails.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for discussion of these
parameters.
Return Status
The return status codes indicating the success or failure of the call follow:
4.9 ACMS$TERM_EXCHANGE_IO
Format
ACMS$TERM_EXCHANGE_IO (exchange_io_id.rq.r)
ACMS$TERM_EXCHANGE_IO_A (exchange_io_id.rq.r,
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
exchange_io_id
The ID returned from an ACMS$INIT_EXCHANGE_IO call. You must supply
this parameter.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Return Status
The following list summarizes each error returned by this service. The return
status codes indicating success or failure of the call are:
• $CLREF
• $DCLAST
• ACMS$CLOSE_RR_A
• ACMS$DELETE_STREAM_A
• ACMS$DISCONNECT_STREAM_A
• TSS$CLOSE
• FORMS$DISABLE
This chapter describes how an agent program calls the submitter services to
submit ACMS tasks. The chapter also provides reference material for using these
services. The calls are listed in alphabetical order in the reference section of the
chapter.
Once a task submitter is signed in, an agent program can use the submitter
services to call an ACMS task on behalf of the task submitter. The submitter
services allow the agent program to:
• Find the information necessary to call a task
• Start a task
• Cancel a task, if necessary
• Wait for a task to complete
Figure 5–1 shows an agent program calling a task in ACMS. Using the submitter
services to invoke the task, the agent program can work on behalf of one or more
task submitters.
Agent ACMS
Sign In .ADBs
Task .TDBs
Initialization
Exchange I/O
Submitter
Services EXC
Termination
Exchange I/O
Servers
Sign Out
TAY-0125-AD
Table 5–1 lists the submitter services in the order in which you might use them
and gives a brief description of each. (Reference material in this chapter lists
these services in alphabetical order.)
Figure 5–2 Arguments Passed for a Task Using a Full Task Argument List
Selection String
Extended Status
Exchange I/O ID
Workspace Argument 1
Workspace Argument 2
TAY-0126-AD
Figure 5–3 is an example of an argument list for a task that does not perform I/O
and supplies two task argument workspaces to a task.
Selection String
Extended Status
Task Argument 1
Task Argument 2
TAY-0128-AD
Note
The TID parameter does not exist in versions prior to ACMS Version
3.2. In versions of ACMS prior to Version 3.2, the position of the TID
parameter was reserved to HP. If you used this parameter for customer
code in the past, the code behaves unpredictably with ACMS Versions 3.2
and higher.
When an agent program passes a TID to one of these services, ACMS attempts
to pass the TID on to the task. A TID can be passed to a task only if the task
is composable. Chapter 2 discusses passing a TID to a composable task in more
detail.
If there is no default value defined, ACMS fills the workspace with zeros.
The task can modify the contents of this workspace, and ACMS returns the
modifications to the agent program when the task completes executing.
You can optimize the performance of ACMS and the agent program by specifying
the read and write access instead of modify access whenever possible. Specifying
read access for the task workspace can provide performance gains if ACMS does
not need to return updated data to the agent program when the task completes.
Specifying write access for the task workspace provides performance gains if the
agent program does not need to send data from the agent program to the task in
the application.
The modify access type is the default for the TASK ARGUMENTS clause.
Although modify access is less efficient in terms of performance when passing
large records, it may be the best option if you are passing small workspaces
and are interested in ease of use. Defining the task workspace with modify
access allows data to be passed back and forth in a single workspace. In general,
using modify access is more efficient for small database records; as record size
increases, performance decreases.
The ACMS$CALL and ACMS$START_CALL services pass workspaces by
descriptor. The application execution controller checks the length of the
workspace when starting the task.
See HP ACMS for OpenVMS Writing Applications and HP ACMS for OpenVMS
ADU Reference Manual for more information on defining tasks that can
accept workspace arguments from an agent program. See the syntax for
the ACMS$CALL and ACMS$START_CALL services later in this chapter for
information on providing argument lists to tasks in an ACMS application.
5.4 ACMS$CALL
Submits an ACMS task. This service completes when the task ends. If you
use the asynchronous ACMS$CALL_A service, it is also necessary to call the
ACMS$WAIT service. See Chapter 2 for an explanation of the ACMS$WAIT
service.
If application reprocessing is required, the agent program must use the
ACMS$GET_PROCEDURE_INFO service before calling ACMS$CALL.
Format
ACMS$CALL ([submitter_id.rq.r],
procedure_id.rq.r,
[arguments.rz.r],
[tid.ro.r])
ACMS$CALL_A ([submitter_id.rq.r],
procedure_id.rq.r,
[arguments.rz.r],
[tid.ro.r],
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
submitter_id
The submitter ID corresponding to a signed-in submitter. The submitter ID is
returned on the ACMS$SIGN_IN service.
This parameter is optional for agent programs that do not use ACMS$SIGN_IN.
Use of the default submitter feature, however, is not recommended for new
development. See Section 2.1.6 and Section 2.1.7 for a discussion of this point.
procedure_id
The procedure ID of the task to call. You obtain this procedure ID by calling the
ACMS$GET_PROCEDURE_INFO service.
arguments
The list of arguments to pass, if any. (See Section 5.1 for more information about
using the argument list.)
This is a standard OpenVMS argument list that contains:
• selection_string.rt.dx
An agent program passes data to the ACMS$SELECTION_STRING system
workspace in a task using the selection string argument. Initialize the
selection string argument in the argument list with the address of an
OpenVMS string descriptor that references the selection string data.
The selection string argument is optional. If the agent program does not
pass any information to the ACMS$SELECTION_STRING workspace,
the agent program must set this argument to zero. When an agent
program does not supply a selection string argument, ACMS initializes
the ACMS$SELECTION_STRING workspaces with spaces.
• extended_status.wt.dx
When ACMS ends a task, it returns the message text associated with the
task’s final completion status back to the agent program. To access the
message text after a task has completed, initialize the extended status
argument with the address of an OpenVMS string descriptor into which
ACMS can store the data.
The extended status argument is optional. If the agent program does not
need to access the task’s completion status message text, set this argument to
zero. If you do not supply the address of a string descriptor in this argument,
ACMS does not return the message text from the application to the agent
program.
Note
The extended status string cannot be filled if the application execution
controller (EXC) cannot start a task (for example, if the EXC terminates
abnormally, if a DECnet link terminates, or if EXC runs out of virtual
memory). The extended status string also cannot be filled if the submitter
services detect an error — for example, if the submitter services receive
an invalid procedure argument list, there is an internal error, or a task
ends because the EXC terminated abnormally before completing the task.
• I/O argument
There are several ways to pass I/O information to a task. The preferred
method is to pass the exchange I/O ID as the I/O argument. ACMS supports
the use of the other methods for compatibility with previously-developed
agent programs.
The methods of passing I/O information to the task are:
exchange_io_id.rq.r
The I/O argument can be an exchange I/O ID returned from the
ACMS$INIT_EXCHANGE_IO service.
terminal_name.rt.dx
The I/O argument can also be a terminal specification for tasks that
perform request I/O or terminal I/O.
stream_id.rq.r
For stream I/O tasks, you can initialize this argument with the address of
the stream ID.
For tasks that do not perform I/O, you can set this argument to zero. If
the agent program does not pass any workspaces to the task, it can omit
this argument.
• workspaces
You supply workspaces to tasks in the fourth and successive arguments of
the task’s argument list. The workspace supplied in the fourth argument
is used to initialize the first task argument workspace defined in the TASK
ARGUMENTS clause in the task definition. The fifth argument is used to
initialize the second workspace defined as a task argument in the TASK
ARGUMENTS clause, and so on. Workspaces are passed to the task by
descriptor. Therefore, initialize each workspace argument with the address
of an OpenVMS string descriptor that references the workspace data. The
tid
The transaction ID (TID) that the $START_TRANS service returns.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Note
If an agent program attempts to supply more workspace arguments to a task
than there are TASK ARGUMENT workspaces defined for that task, then
the ACMS$CALL and ACMS$START_CALL services complete and return
the ‘‘%ACMS-F-ERRREADARG, Error during task initialization: cannot
read an argument in argument list’’ error. The agent program can use the
ACMS$GET_PROCEDURE _INFO service to determine the correct number of
TASK ARGUMENT workspaces defined for the task.
Return Status
The return status codes indicating success or failure of the call follow:
5.5 ACMS$CANCEL_CALL
Cancels a task that was started by the task submitting agent program. This
service only cancels tasks that were started with ACMS$START_CALL. The
agent program must also use the ACMS$WAIT_FOR_CALL_END service with
this service to get notification of the call canceling.
Use ACMS$CANCEL_CALL to cancel tasks when a terminal user presses Ctrl/Y .
ACMS expects a task to be canceled when the terminal user presses Ctrl/Y (or
Ctrl/C , if the server is not running a task that enables a Ctrl/C handler). If an
agent program does not cancel any active tasks when Ctrl/Y is pressed, then Ctrl/Y
cancels are disabled and the tasks run to completion.
Note
The effect of this call might not be immediate or successful, due to the
asynchronous nature of ACMS.
Format
ACMS$CANCEL_CALL ([submitter_id.rq.r],
call_id.rq.r,
[reason_code.rlu.r])
ACMS$CANCEL_CALL_A ([submitter_id.rq.r],
call_id.rq.r,
[reason_code.rlu.r],
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
submitter_id
The identification of the task submitter calling the task. The ACMS$SIGN_IN
service returns this ID. This parameter is optional for agent programs that
do not use ACMS$SIGN_IN. Use of the default submitter feature, however, is
not recommended for new development. See Section 2.1.6 and Section 2.1.7 for
discussions of this point.
call_id
The identification returned by ACMS$START_CALL. The call must be started by
the same submitter as the one using the ACMS$CANCEL_CALL service.
reason_code
The reason code contains the reason for the cancel request. The parameter is
passed to the application execution controller. The default is the following:
ACMS$_CALL_CANCELLED: the task was canceled by the task
submitter.
The reason code is the extended status of the call and the completion status
returned on the ACMS$WAIT_FOR_CALL_END service.
Return Status
The return status codes indicating success or failure of the call follow:
5.6 ACMS$GET_PROCEDURE_INFO
Finds and returns the procedure ID for the task, the number of workspace
arguments the agent program can pass to a task in an ACMS application, and
the I/O method (forms, terminal, request, stream, or none).
If application reprocessing is necessary, use ACMS$GET_PROCEDURE_
INFO before using ACMS$CALL, ACMS$CALL_A, ACMS$START_CALL, or
ACMS$START_CALL_A.
Format
ACMS$GET_PROCEDURE_INFO ([submitter_id.rq.r],
procedure.rt.dx,
package.rt.dx,
item_list.rx.r)
ACMS$GET_PROCEDURE_INFO_A ([submitter_id.rq.r],
procedure.rt.dx,
package.rt.dx,
item_list.rx.r,
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
submitter_id
The identification of the task submitter that the ACMS$SIGN_IN service returns.
This parameter is optional for agent programs that do not use ACMS$SIGN_IN.
Use of the default submitter feature, however, is not recommended for new
development. See Section 2.1.6 and Section 2.1.7 for discussions of this point.
procedure
The name of the task for which you want to find information. The name passed
must be in capital letters, but can include trailing blanks.
package
The name of the application from which you want to select the task. The name
passed must be in capital letters, but can include trailing blanks. However, if the
package parameter is a logical name, then the equivalence name or names cannot
contain trailing blanks.
item_list
The list of one or more item descriptors that describe the task I/O method,
WAIT/DELAY information, or procedure ID. An item descriptor has the following
format:
31 0
Item Code Buffer Length
Buffer Address
Return Length Address
TAY-0210-AD
• Buffer length
The length of the buffer pointed to by the buffer address.
• Item code
The symbolic name defining the requested information.
• Buffer address
The address of a buffer to receive the requested information.
• Return length address
The address of the word to receive the length of the information returned. If
you specify this address as zero, no length is returned.
The possible item codes are:
• ACMS$K_PROC_PROCEDURE_ID
The quadword procedure ID associated with the input task name and
application name. The buffer to receive the information returned by
ACMS$K_PROCEDURE_ID is equal in length to ACMS$S_PROCEDURE_ID,
eight bytes. The agent program uses the procedure ID to identify a task when
the agent program calls the task using the ACMS$CALL or ACMS$START_
CALL service. The procedure ID becomes invalid when either the application
stops or all the task submitters who selected tasks in the application sign out.
If the ACMS$CALL or ACMS$START_CALL services use a procedure ID
that has changed, they receive the ACMS$_NOSUCH_PKG error message.
When an agent program receives this error, it can call the ACMS$GET_
PROCEDURE_INFO service to get the new procedure ID for the task.
• ACMS$K_PROC_IO_METHOD
The I/O method used by the task. ACMS$K_PROC_IO_METHOD returns a
longword. This value can be one of the following symbols:
ACMS$K_IO_TERMINAL
The task uses the terminal directly. The task cannot be selected remotely.
ACMS$K_IO_DECFORMS
The task performs HP DECforms request I/O in exchange steps. The task
can be selected remotely.
ACMS$K_IO_REQUEST
The task either performs TDMS request I/O in exchange steps or uses the
RI. The task can be selected remotely.
ACMS$K_IO_STREAM
The task uses ACMS stream I/O. The agent program may have to do I/O
work for this task. The task can be selected remotely.
ACMS$K_IO_NONE
The task does not do any I/O. The agent program does not do I/O work for
this task. The task can be selected remotely.
• ACMS$K_PROC_WAIT_DELAY_ACTION
The wait/delay action defined for this task. ACMS$K_PROC_WAIT_DELAY_
ACTION returns a longword. The value can be one of the following symbols:
ACMS$K_WAIT
Return Status
The return status codes indicating success or failure of the call follow:
5.7 ACMS$START_CALL
Submits an ACMS task. This service completes when the task has been
submitted. It returns a call ID to the agent program.
Before using ACMS$START_CALL or ACMS$START_CALL_A, the agent
program must use the ACMS$GET_PROCEDURE_INFO service to get the
task procedure ID and the task I/O method. Because ACMS$START_CALL only
starts the task, you must use it with the ACMS$WAIT_FOR_CALL_END service,
which waits for the task to end.
If the task being called performs stream I/O, the agent program must create a
stream using the ACMS$INIT_EXCHANGE_IO service before calling the task.
This service creates the stream, connects to it, and returns a connect ID to the
agent program. See Chapter 6 for details regarding stream creation.
An agent program must also call the ACMS$WAIT service when it uses the
asynchronous service ACMS$START_CALL_A. See Chapter 2 for a complete
explanation of the ACMS$WAIT service.
Format
ACMS$START_CALL ([submitter_id.rq.r],
procedure_id.rq.r,
call_id.wq.r,
[arguments.rz.r],
[tid.ro.r])
ACMS$START_CALL_A ([submitter_id.rq.r],
procedure_id.rq.r,
call_id.wq.r,
[arguments.rz.r],
[tid.ro.r ],
[comp_status.wq.r ],
[efn.rbu.r ],
[astadr.szem.r ],
[astprm.rz.v ] )
Parameters
submitter_id
The identification of the task submitter calling the task. The ACMS$SIGN_IN
service returns this ID.
This parameter is optional for agent programs that do not use ACMS$SIGN_IN.
Use of the default submitter feature, however, is not recommended for new
development. See Section 2.1.6 and Section 2.1.7 for discussions of this point.
procedure_id
The identification of the procedure to call. The agent program obtains the
procedure ID by calling the ACMS$GET_PROCEDURE_INFO service.
call_id
The identification that is produced by this service. The ACMS$WAIT_FOR_
CALL_END and the ACMS$CANCEL_CALL services use this ID later.
arguments
The list of arguments to pass. (See Section 5.1 for more information about using
the argument list.)
This is a standard OpenVMS argument list that contains:
• selection_string.rt.dx
An agent program passes data to the ACMS$SELECTION_STRING system
workspace in a task using the selection string argument. Initialize the
selection string argument in the argument list with the address of an
OpenVMS string descriptor that references the selection string data.
The selection string argument is optional. If the agent program does not
pass any information to the ACMS$SELECTION_STRING workspace,
the agent program must set this argument to zero. When an agent
program does not supply a selection string argument, ACMS initializes
the ACMS$SELECTION_STRING workspaces with spaces.
• extended_status.wt.dx
When ACMS ends a task, it returns the message text associated with the
task’s final completion status back to the agent program. To access the
message text after a task has completed, initialize the extended status
argument with the address of an OpenVMS string descriptor into which
ACMS can store the data.
The extended status argument is optional. If the agent program does not
need to access the task’s completion status message text, set this argument to
zero. If you do not supply the address of a string descriptor in this argument,
ACMS does not return the message text from the application to the agent
program.
Note
The extended status string cannot be filled if the application execution
controller (EXC) cannot start a task — for example, if the EXC terminates
abnormally, if the DECnet link terminates, or if EXC runs out of virtual
memory. The extended status string also cannot be filled if the submitter
services detect an error — for example, if the submitter services receive
an invalid procedure argument list, there is an internal error, or a task
ends because the EXC terminated abnormally before completing the task.
• I/O argument
There are several ways to pass I/O information to a task. The preferred
method is to pass the exchange I/O ID as the I/O argument. ACMS supports
the use of the other methods for compatibility with previously-developed
agent programs.
The methods of passing I/O information to the task are:
exchange_io_id.rq.r
The I/O argument can be an exchange I/O ID returned from the
ACMS$INIT_EXCHANGE_IO service.
terminal_name.rt.dx
The I/O argument can also be a terminal specification for tasks that
perform request I/O or terminal I/O.
stream_id.rq.r
For stream I/O tasks, you can initialize this argument with the address of
the stream ID.
For tasks that do not perform I/O, you can set this argument to zero. If
the agent program does not pass any workspaces to the task, it can omit
this argument.
• workspaces
You supply workspaces to tasks in the fourth and successive arguments of
the task’s argument list. The workspace supplied in the fourth argument
initializes the first task argument workspace defined in the TASK
ARGUMENTS clause of the task definition. The fifth argument initializes the
second workspace defined as a task argument in the TASK ARGUMENTS
clause, and so on. Workspaces are passed to the task by descriptor. Therefore,
initialize each workspace argument with the address of an OpenVMS string
descriptor that references the workspace data. The read, write, or modify
access to each workspace is determined by the TASK ARGUMENTS clause in
the task:
workspace_n.rt.dx
workspace_n.wt.dx
workspace_n.mt.dx
Workspace arguments are optional. If you do not want to supply one or more
workspaces to a task, initialize the corresponding arguments in the task’s
argument list to zero. If you do not supply data to a workspace defined in a
task as a task argument, ACMS initializes that workspace with the default
contents from the .TDB or with zeros.
See Section 5.1 and Section 5.2 for detailed information on how to pass a
workspace to a task. See the VR_AGENT.C program and the VR_FAST_
CHECKIN_TASK.TDF task definition in the ACMS$EXAMPLES directory for
an example of an agent program calling a task.
tid
The transaction ID (TID) that the $START_TRANS service returns.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Note
If an agent program attempts to supply more workspace arguments to a task
than there are TASK ARGUMENT workspaces defined for that task, then
the ACMS$CALL and ACMS$START_CALL services complete and return
the ‘‘%ACMS-F-ERRREADARG, Error during task initialization: cannot
read an argument in argument list’’ error. The agent program can use the
ACMS$GET_PROCEDURE _INFO service to determine the correct number of
TASK ARGUMENT workspaces defined for the task.
Return Status
The return status codes indicating success or failure of the call follow:
5.8 ACMS$WAIT_FOR_CALL_END
Waits for a task to complete. This service waits only for tasks that were started
with ACMS$START_CALL. This service also reports access errors that occurred
after the task was submitted.
When using the asynchronous ACMS$WAIT_FOR_CALL_END_A service, an
agent program must also use the ACMS$WAIT service. See Chapter 2 for a
complete explanation of the ACMS$WAIT service.
Note
Access control list (ACL) checking for ACMS tasks is done after the task
has been submitted. Access errors are reported in the completion status
returned in the ACMS$WAIT_FOR_CALL_END service.
Format
ACMS$WAIT_FOR_CALL_END ([submitter_id.rq.r],
call_id.rq.r )
ACMS$WAIT_FOR_CALL_END_A ([submitter_id.rq.r],
call_id.rq.r,
[ comp_status.wq.r ],
[ efn.rbu.r ],
[ astadr.szem.r ],
[ astprm.rz.v ] )
Parameters
submitter_id
The identification of the task submitter calling the task. This ID is returned on
the ACMS$SIGN_IN service.
This parameter is optional for agent programs that do not use ACMS$SIGN_IN.
Use of the default submitter feature, however, is not recommended for new
development. See Section 2.1.6 and Section 2.1.7 for discussions of this point.
call_id
The call ID for which this service is waiting. The ACMS$START_CALL service
returns this ID.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Return Status
The return status codes indicating success or failure of the call follow:
This chapter discusses how to use streams between ACMS and an agent program.
This chapter also provides reference material for calling the stream services in
agent programs.
Streams are ACMS communication channels that permit ACMS to communicate
with devices not supported by HP DECforms or TDMS. In most instances, you
can now use the Request Interface (RI) to communicate with unsupported devices.
Stream services are still useful, however, if:
• You have multithreaded agents and asynchronous processing
• You send large amounts of data in one direction only
Note
Stream services are supported but will not be developed further in
subsequent versions of ACMS.
ACMS can use streams to communicate with agents. Agents can communicate
with unsupported devices.
You use ACMS$INIT_EXCHANGE_IO to create and connect a stream. See
Section 4.6 for details regarding ACMS$INIT_EXCHANGE_IO.
You use ACMS$TERM_EXCHANGE_IO to disconnect a stream and delete a
stream. See Section 4.9 for details regarding ACMS$TERM_EXCHANGE_IO.
You use ACMS$WAIT_FOR_STREAM_IO and ACMS$REPLY_TO_STREAM_IO
to wait for and reply to messages from the EXC.
Note
If an agent program enables stream I/O and associates it with a
submitter, the agent program must call ACMS$WAIT_FOR_STREAM_IO
for all tasks (except tasks that do no terminal I/O), whether or not the
task performs stream I/O.
Figure 6–1 shows an agent program using a stream to communicate with ACMS.
Agent ACMS
Sign In .ADBs
Task .TDBs
Initialization
Exchange I/O
Submitter
Services EXC
Stream
Services
Servers
Termination
Exchange I/O
Sign Out
Legend:
Stream
TAY-0131-AD
When a task performs stream I/O, the block step for that task must use the
WITH STREAM I/O phrase. Also, if the task performs stream I/O, the agent
program must call the task using either the ACMS$START_CALL service or the
asynchronous ACMS$CALL_A service. The EXC performs stream I/O for a task
when it encounters the READ, READ WITH PROMPT, and WRITE clauses in the
exchange step of a task definition. For example:
BLOCK WORK
WITH STREAM I/O
task1_exchange1:
EXCHANGE IS
READ ACMS$DATA_WORKSPACE;
task1_process1:
PROCESSING IS
CALL procedure-name USING ACMS$DATA_WORKSPACE;
task1_exchange2:
EXCHANGE IS
WRITE ACMS$DATA_WORKSPACE;
END BLOCK;
The EXC is the active end of the stream because it interprets the task definition
and sends and requests information from the agent program. The agent program
is the passive end of the stream because it does not initiate any communication,
but waits for and reacts to requests from the EXC.
The agent program calls the ACMS$WAIT_FOR_STREAM_IO service to wait for
a request from the EXC. After processing the information, the agent program
calls the ACMS$REPLY_TO_STREAM_IO service to respond to the request.
Before any communication can begin, however, the agent program must initialize
a stream. Earlier versions of ACMS used four other stream services. These
earlier services have been superseded. The superseded services are:
• ACMS$CONNECT_STREAM
• ACMS$CREATE_STREAM
• ACMS$DELETE_STREAM
• ACMS$DISCONNECT_STREAM
ACMS supports these services for agent programs that have already been
developed. In new agent programs, however, use ACMS$INIT_EXCHANGE_IO
and ACMS_TERM_EXCHANGE_IO. Whenever practical, replace superseded
services with ACMS$INIT_EXCHANGE_IO and ACMS_TERM_EXCHANGE_IO.
Superseded services are discussed in Appendix A.
6.2 ACMS$REPLY_TO_STREAM_IO
Format
ACMS$REPLY_TO_STREAM_IO (connect_id.rq.r,
io_id.wq.r,
[io_status.rl.r])
ACMS$REPLY_TO_STREAM_IO_A (connect_id.rq.r,
io_id.wq.r,
[io_status.rl.r],
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
connect_id
The identification of the stream you are replying to. The ACMS$INIT_
EXCHANGE_IO service returns this connect ID.
io_id
The identification of the message you are replying to. The ACMS$WAIT_FOR_
STREAM_IO service returns this ID.
io_status
The agent program must provide a success value if it wishes to complete the
exchange and allow the task to continue. The agent program must provide a
failure value if the agent program has detected an error and wishes to cancel the
exchange and cancel the task.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Return Status
The return status codes indicating success or failure of the call follow:
6.3 ACMS$WAIT_FOR_STREAM_IO
Waits for I/O messages. This service completes when the Application Execution
Controller (EXC) executes a READ or WRITE clause in the task definition. If an
agent program enables stream I/O and associates it with a submitter, the agent
program must call ACMS$WAIT_FOR_STREAM_IO for all tasks (except tasks
that do no terminal I/O), whether or not the task performs stream I/O.
When ACMS$WAIT_FOR_STREAM_IO returns the status code ACMS$_
SENDER_DISCONN, the EXC has disconnected from the stream. The agent
program then calls ACMS$WAIT_FOR_CALL_END to wait for the end of the
task.
Format
ACMS$WAIT_FOR_STREAM_IO (connect_id.rq.r,
output_object.wz.r,
input_object.wz.r,
io_id.wq.r,
[cancel_routine.zem.r],
[cancel_param.rz.v])
ACMS$WAIT_FOR_STREAM_IO_A (connect_id.rq.r,
output_object.wz.r,
input_object.wz.r,
io_id.wq.r,
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v],
[cancel_routine.zem.r],
[cancel_param.rz.v])
Parameters
connect_id
The identification of the stream on which you are waiting for data requests. The
ACMS$INIT_EXCHANGE_IO service returns this connect ID.
output_object
The message sent over the stream from the Application Execution Controller
(EXC) to the agent program.
This is a pointer to a string descriptor containing either a prompt or output
information from the EXC. The agent program can use this output as a terminal
prompt (if the task uses a terminal) or, for example, as a key to get a record from
a file. If there is no output, the parameter contains a zero; otherwise, it contains
the address of the string descriptor.
input_object
The address of the message to send over the stream from the agent program to
the EXC.
io_id
The identification that this service returns. ACMS$REPLY_TO_STREAM_IO
later uses this ID to distinguish which I/O request to reply to.
cancel_routine
When you use the cancel_routine parameter in an agent, the agent program is
notified if the ACMS EXC requests to cancel the current stream I/O operation. If
the cancel_routine parameter is omitted, the agent program is not notified of the
EXC request to cancel the stream I/O. The cancel_routine executes at AST level
and is passed the following parameters:
• cancel_param
The cancel parameter that was passed with the ACMS$WAIT_FOR_
STREAM_IO service.
• connect_id
The address of the two-longword identification of the current stream
connection. ACMS$INIT_EXCHANGE_IO passes this ID.
• io_id
The address of the two-longword identification of the stream I/O request to
cancel.
After receiving cancel notification, the agent program responds to the cancellation
by calling ACMS$REPLY_TO_STREAM_IO. Until the agent program calls
ACMS$REPLY_TO_STREAM_IO, ACMS cannot cancel the task.
cancel_param
The value to be passed to the cancel routine.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Return Status
The return status codes indicating success or failure of the call follow:
/**************************************************************/
/* */
/* Version: 01 */
/* Authors: HP */
/* */
/**************************************************************/
/**************************************************************/
/* F U N C T I O N A L D E S C R I P T I O N */
/* */
/* */
/* VR_AGENT is an ACMS agent program that acts like an ATM */
/* where you type in your reservation number and odometer */
/* reading, drop the keys in a slot, and walk away. The */
/* system bills you later for the amount you owe. The */
/* agent uses QIOs to get the data, starts a distributed */
/* transaction, then calls a task to do the work. The task */
/* consists of a nonparticipating step that validates the */
/* reservation number, a step that queues a task to do the */
/* actual checkin work, and a step that writes a history */
/* record. If the task succeeds, the agent commits the */
/* transaction. If the task fails, the agent aborts the */
/* the transaction and notifies the user of the problem. */
/* The agent is also responsible for handling errors, such */
/* as transaction timeouts. */
/* */
/**************************************************************/
/*************************************************/
/* */
/* Include’s / Define’s / Macros Required */
/* */
/*************************************************/
#include descrip
#include iodef
#include rmsdef
#include ssdef
#include stdio
#include stsdef
#include ACMS$SUBMITTER
#include ACMS$STREAM
#define MAX_RESERVATION 10
#define MAX_ODOMETER 6
#define MAX_RETRY 5
#define TRUE 1
#define FALSE 0
#define CANCEL ’C’
#define check_status(stat) if (!(stat & 1)) LIB$STOP(stat)
/*****************************/
/* */
/* Declare Global Data */
/* */
/*****************************/
globalvalue ACMS$_NOSUCH_PKG;
globalvalue ACMS$_SRVDEAD;
globalvalue ACMS$_TRANSTIMEDOUT;
globalvalue RDB$_DEADLOCK;
globalvalue RDB$_LOCK_CONFLICT;
globalvalue RDMS$_DEADLOCK;
globalvalue RDMS$_LCKCNFLCT;
globalvalue RDMS$_TIMEOUT;
typedef struct {
short int bufsize;
short int itmcode;
int bufadr;
int retlen;
} item;
typedef int quadword[2];
struct fast_check_in_blk {
int reservation_id;
int return_odometer_reading;
quadword actual_return_date;
} fast_check_in_wksp;
struct io_stat_blk {
short int status ;
short int msg_len ;
int unused;
} iosb;
struct {
item pr_id;
int terminator;
} task_info_list;
int status, *tid[ 4 ], argument_list[ 5 ];
short chan;
char task_status[ 80 ];
$DESCRIPTOR(task_status_desc, task_status);
$DESCRIPTOR(task_name_desc, "VR_FAST_CHECKIN_TASK");
$DESCRIPTOR(appl_name_desc, "VR_APPL");
struct dsc$descriptor_s fast_check_in_wksp_desc;
struct ACMS$SUBMITTER_ID submitter_id;
struct ACMS$PROCEDURE_ID procedure_id;
struct ACMS$CALL_ID call_id;
main ()
/**************************************************************************/
/* */
/* Get procedure information to see if the application is running. */
/* */
/* While the application is up and running, prompt user for */
/* reservation ID and odometer reading. */
/* */
/* If the user enters the data, process the fast checkin transaction. */
/* */
/* If the user aborts, then notify the user that the transaction was */
/* not processed. */
/* */
/**************************************************************************/
{
for (;;)
{
status = initialization ();
check_status(status);
status = ACMS$GET_PROCEDURE_INFO(&submitter_id,
&task_name_desc,
&appl_name_desc,
&task_info_list);
while (status & STS$M_SUCCESS)
{
status = get_data (); 1
if (status & STS$M_SUCCESS)
status = process_this_transaction();
else if (status == RMS$_EOF)
status = report_user_abort();
check_status(status);
status = ACMS$GET_PROCEDURE_INFO(&submitter_id,
&task_name_desc,
&appl_name_desc,
&task_info_list);
}
if (status == ACMS$_NOSUCH_PKG)
status = application_not_running();
check_status(status);
status = termination ();
check_status(status);
}
}
initialization ()
/************************************************/
/* */
/* Assign channel and sign user in to ACMS. */
/* Set up descriptors, task info list, and */
/* argument lists for later processing */
/* */
/************************************************/
{
$DESCRIPTOR(terminal, "SYS$COMMAND");
status = SYS$ASSIGN (&terminal, &chan,0,0);
if (status & STS$M_SUCCESS)
status = ACMS$SIGN_IN(&submitter_id, 0, 0);
if (status & STS$M_SUCCESS)
{
fast_check_in_wksp_desc.dsc$w_length = sizeof(fast_check_in_wksp);
fast_check_in_wksp_desc.dsc$a_pointer = &fast_check_in_wksp;
fast_check_in_wksp_desc.dsc$b_dtype = DSC$K_DTYPE_T;
fast_check_in_wksp_desc.dsc$b_class = DSC$K_CLASS_S;
task_info_list.pr_id.bufsize = ACMS$S_PROCEDURE_ID;
task_info_list.pr_id.itmcode = ACMS$K_PROC_PROCEDURE_ID;
task_info_list.pr_id.bufadr = &procedure_id;
task_info_list.pr_id.retlen = 0;
task_info_list.terminator = 0;
argument_list[ 0 ] = 4;
argument_list[ 1 ] = 0;
argument_list[ 2 ] = &task_status_desc;
argument_list[ 3 ] = 0;
argument_list[ 4 ] = &fast_check_in_wksp_desc;
}
return status;
}
get_data ()
/*********************************************************/
/* */
/* Prompt for reservation ID and odometer reading. */
/* */
/* For the purpose of this example, it is expected */
/* that input will consist of numeric characters & */
/* that the user will enter leading zeroes. */
/* */
/* e.g., Reservation ID 000123456 */
/* Odometer Reading 05575 */
/* */
/* Validation will be done to ensure this; the */
/* user can abort by entering "Cancel." */
/* */
/*********************************************************/
{
short input_complete;
char reservation[ MAX_RESERVATION ];
char odometer[ MAX_ODOMETER ];
$DESCRIPTOR(reservation_desc, reservation);
$DESCRIPTOR(odometer_desc, odometer);
$DESCRIPTOR(input_reservation_id, "Input Reseveration Id ’Cancel’ to Exit: ");
$DESCRIPTOR(input_odometer, "Input Odometer Reading ’Cancel’ to Exit: ");
input_complete = FALSE;
while (input_complete == FALSE)
{
printf("\n");
status = SYS$QIOW (0,
chan,
IO$_READPROMPT|IO$M_CVTLOW,
&iosb,
0, 0,
&reservation,
reservation_desc.dsc$w_length,
0, 0,
input_reservation_id.dsc$a_pointer,
input_reservation_id.dsc$w_length);
process_this_transaction()
/********************************************************************/
/* */
/* Start transaction. Call the task. Commit if successful. */
/* Abort if failure. Retry if timed out. Notify user whether */
/* transaction succeeded or failed. */
/* */
/********************************************************************/
{
short retry, trans_completed;
retry = 0;
trans_completed = FALSE;
trans_completed = TRUE;
}
else
{
if ((status == ACMS$_TRANSTIMEDOUT) ||
(status == ACMS$_SRVDEAD) ||
(status == RDB$_DEADLOCK) ||
(status == RDMS$_DEADLOCK) ||
(status == RDB$_LOCK_CONFLICT) ||
(status == RDMS$_LCKCNFLCT) ||
(status == RDMS$_TIMEOUT))
++retry;
else
retry = MAX_RETRY;
call_return_task()
/******************************************************************/
/* */
/* Call the task. Error handling will be done by the calling */
/* task. */
/* */
/******************************************************************/
{
status = ACMS$START_CALL (&submitter_id,
&procedure_id,
&call_id,
argument_list,
tid);
if (status & STS$M_SUCCESS)
status = ACMS$WAIT_FOR_CALL_END (&submitter_id,
&call_id);
return status;
}
notify_failure ()
/*******************************************************************/
/* */
/* Failure returned from called task is displayed to the user. */
/* */
/*******************************************************************/
{
printf("\n");
status = SYS$QIOW (0,
chan,
IO$_WRITEVBLK,
&iosb,
0, 0,
task_status_desc.dsc$a_pointer,
task_status_desc.dsc$w_length,
0, 0, 0, 0);
return status;
}
application_not_running()
/*************************************************************/
/* */
/* Display application not running and wait 60 seconds. */
/* */
/*************************************************************/
{
float wait_time = 10.0;
$DESCRIPTOR(appl_not_up_msg, "Application not Available at this time" );
printf("\n");
status = SYS$QIOW (0,
chan,
IO$_WRITEVBLK,
&iosb,
0, 0,
appl_not_up_msg.dsc$a_pointer,
appl_not_up_msg.dsc$w_length,
0, 0, 0, 0);
notify_success()
/*************************************************************/
/* */
/* Display transaction has been successfully completed. */
/* */
/*************************************************************/
{
$DESCRIPTOR(success_queued_msg, "Transaction Successfully Queued ");
printf("\n");
status = SYS$QIOW (0,
chan,
IO$_WRITEVBLK,
&iosb,
0, 0,
success_queued_msg.dsc$a_pointer,
success_queued_msg.dsc$w_length,
0, 0, 0, 0);
report_user_abort()
/******************************************************/
/* */
/* Display operation canceled at user’s request. */
/* */
/******************************************************/
{
$DESCRIPTOR(user_abort_msg, "Fast Checkin Has Been Canceled by user ");
printf("\n");
status = SYS$QIOW (0,
chan,
IO$_WRITEVBLK,
&iosb,
0, 0,
user_abort_msg.dsc$a_pointer,
user_abort_msg.dsc$w_length,
0, 0, 0, 0);
termination ()
/****************************************************/
/* */
/* Deassign channel and sign user out of ACMS */
/* */
/****************************************************/
{
status = SYS$DASSGN(chan);
if (status & STS$M_SUCCESS)
status = ACMS$SIGN_OUT(&submitter_id);
return status;
}
INTEGER*4 status
INTEGER*4 LIB$SYS_TRNLOG, LIB$GET_INPUT, LIB$PUT_OUTPUT
C
C Variable declarations for ACMS$SIGN_IN
C
CHARACTER*10 terminal_name
INTEGER*4 terminal_name_desc (2)
C
C Variable declarations for ACMS$GET_PROCEDURE_INFO
C
LOGICAL select_task
LOGICAL need_task_info
C
INTEGER*4 io_method
CHARACTER*31 application_name
CHARACTER*31 task_name
INTEGER*4 task_name_desc (2)
INTEGER*4 task_name_len
C
INTEGER*2 task_info_list (14)
EQUIVALENCE ( task_info_list (1), itm_io_bufsize )
INTEGER*2 itm_io_bufsize
EQUIVALENCE ( task_info_list (2), itm_io_itmcode )
INTEGER*2 itm_io_itmcode
EQUIVALENCE ( task_info_list (3), itm_io_bufadr )
INTEGER*4 itm_io_bufadr
EQUIVALENCE ( task_info_list (5), itm_io_retlen )
INTEGER*4 itm_io_retlen
C
EQUIVALENCE ( task_info_list (7), itm_proc_bufsize )
INTEGER*2 itm_proc_bufsize
EQUIVALENCE ( task_info_list (8), itm_proc_itmcode )
INTEGER*2 itm_proc_itmcode
EQUIVALENCE ( task_info_list (9), itm_proc_bufadr )
INTEGER*4 itm_proc_bufadr
EQUIVALENCE ( task_info_list (11), itm_proc_retlen )
INTEGER*4 itm_proc_retlen
C
EQUIVALENCE ( task_info_list (13), itm_last )
INTEGER*4 itm_last
C
C Variable declarations for ACMS$START_CALL
C
INTEGER*4 argument_list (4)
CHARACTER*255 selection_string
CHARACTER*80 status_string
INTEGER*4 selection_string_desc (2)
INTEGER*4 status_string_desc (2)
C***************************************************************************
C
C Sign in to ACMS, including terminal so that tasks ACMS can authenticate
C the terminal and the submitter can select tasks that use the terminal.
C
status = LIB$SYS_TRNLOG (’TT’, , terminal_name)
IF (.NOT. status) THEN
CALL LIB$SIGNAL (%VAL (status) )
END IF
C
C Initialize the submitter to do exchange I/O on behalf of the tasks that it
C selects. This submitter is written to do any kind of exchange I/O except
C stream I/O or I/O involving the ACMS Request Interface (RI).
C
status = ACMS$INIT_EXCHANGE_IO ( submitter_id, exchange_io_id )
IF (.NOT. status) THEN
CALL LIB$SIGNAL (%VAL (status) )
END IF
C
C Construct the item list to get information about the task
C
itm_io_bufsize = 4
itm_io_itmcode = ACMS$K_PROC_IO_METHOD
itm_io_bufadr = %LOC (io_method )
itm_io_retlen = 0
itm_proc_bufsize = ACMS$S_PROCEDURE_ID
itm_proc_itmcode = ACMS$K_PROC_PROCEDURE_ID
itm_proc_bufadr = %LOC ( procedure_id )
itm_proc_retlen = 0
C
itm_last = 0
C
C Loop for task selections, until user types EXIT instead of application name
C
select_task = .TRUE.
DO WHILE (select_task)
C
C Loop until we get a good application/task name.
C
need_task_info = .TRUE.
DO WHILE (need_task_info)
C
C Ask for application name and task name.
C
status = LIB$GET_INPUT (application_name, ’Application name: ’)
IF (.NOT. status) THEN
CALL LIB$SIGNAL ( %VAL (status) )
ELSE
IF (application_name .EQ. ’EXIT’) THEN
select_task = .FALSE.
GO TO 2000
END IF
END IF
C
C Wait for task to complete.
C
status = ACMS$WAIT_FOR_CALL_END (submitter_id,
1 call_id)
IF (.NOT. status) THEN
CALL LIB$SIGNAL (%VAL (status) )
END IF
C Display final status for task.
C
IF ((status_string .NE. ’ ’) .AND.
1 (status_string .NE. ’Task completed normally’)) THEN
CALL LIB$PUT_OUTPUT (status_string)
END IF
C
C We come here when the user wishes to exit the agent program.
C
2000 END DO
C
C Sign the submitter out.
C
status = ACMS$SIGN_OUT ( submitter_id )
IF (.NOT. status) THEN
CALL LIB$SIGNAL (%VAL (status) )
END IF
C
END
#define SUCCESS 1
#define TRUE 1
#define FALSE 0
#define NULL 0
/** define structure for item list **/
struct item {
short int bufsize;
short int itmcode;
char *bufadr;
int retlen;
};
main()
{
/*
* External routines
*/
int LIB$GET_INPUT();
int LIB$PUT_OUTPUT();
/*
* Variables for ACMS IDs
*/
struct ACMS$SUBMITTER_ID submitter_id;
struct ACMS$EXCHANGE_IO_ID exchange_io_id;
struct ACMS$CONNECT_ID connect_id;
struct ACMS$PROCEDURE_ID procedure_id;
struct ACMS$IO_ID io_id;
/*
* Variables for ACMS$INIT_EXCHANGE_IO
*/
struct item init_exch_io_list[2] =
{ ACMS$S_CONNECT_ID, ACMS$K_CONNECT_ID, &connect_id, 0,
0, 0 }; /* zero the last longword (2 words) for list termination */
int io_enable_flags;
Example 7–3 (Cont.) C Agent Program that Performs Stream I/O or No I/O
/*
* Variable declarations for ACMS$GET_PROCEDURE_INFO
*/
int io_method;
char task_name_string[39], appl_name_string[255];
$DESCRIPTOR(task_name_desc,task_name_string);
$DESCRIPTOR (appl_name_desc,appl_name_string);
$DESCRIPTOR (appl_prompt_desc,"Application name: ");
$DESCRIPTOR (task_prompt_desc,"Task name: ");
/*
* Item list structure to be used in ACMS$GET_PROCEDURE_INFO
*
* There are 2 elements specified in this item list:
* 1) 4 bytes of data for ACMS$K_PROC_IO_METHOD, to be
* returned in variable io_method.
* 2) 8 bytes data for ACMS$K_PROC_PROCEDURE_ID, to be
* returned in variable procedure_id.
* (This code omits the return length variable address, which
* could be specified to receive the actual length of data
* returned for each item.)
* Other possible items include:
* - ACMS$K_PROC_WORKSPACE_COUNT to receive count of TASK ARGUMENTS
* which the task could accept from the agent program
* - ACMS$K_PROC_WAIT_DELAY_ACTION to receive the wait/delay
* action specified in the task definition
*/
/*
* Variable declarations for ACMS$WAIT_FOR_STREAM_IO
*/
globalvalue int ACMS$_SENDER_DISCONN;
int sender_disconn;
short int processing_io;
char *input_string_addr, *output_string_addr;
/*
* Miscellaneous variables
*/
int status;
short int i, all_spaces;
/**************************************************************/
/*
* Sign in to ACMS, no terminal IO, only stream IO
*/
status = ACMS$SIGN_IN (&submitter_id);
if ((status & 1) != SUCCESS) LIB$SIGNAL (status);
Example 7–3 (Cont.) C Agent Program that Performs Stream I/O or No I/O
/*
* Set up the agent program to do only stream I/O in exchange steps.
*/
io_enable_flags = ACMS$M_IO_DISABLE_TDMS + ACMS$M_IO_DISABLE_DECFORMS;
status = ACMS$INIT_EXCHANGE_IO ( &submitter_id,
&exchange_io_id,
&io_enable_flags,
&init_exch_io_list );
if ((status & 1) != SUCCESS) LIB$SIGNAL (status);
/*
* Get the procedure ID for the task
* - prompt the user for the task name
* - prompt the user for application logical name
* (These strings should be entered in upper case
* or converted to upper case.)
* - then call ACMS$GET_PROCEDURE_INFO
*/
status = LIB$GET_INPUT ( &task_name_desc, &task_prompt_desc );
if ((status & 1) != SUCCESS) LIB$SIGNAL (status);
/*
* Set up the argument list for the task
*/
argument_list[0] = 3;
argument_list[1] = &selection_string_desc;
argument_list[2] = &status_string_desc;
argument_list[3] = &exchange_io_id;
/*
* Now start the task. This agent program does not supply TASK
* ARGUMENTS. If TASK ARGUMENTS were used, they would require
* the task_info_list structure to be expanded to include the item
* ACMS$K_PROC_WORKSPACE_COUNT, which returns the number of TASK
* ARGUMENTS (if any) declared in the task definition. This agent
* program would then build descriptors pointing to C variables
* corresponding to the number of arguments to be supplied. Then
* argument_list[4] would be supplied the address of the
* first argument descriptor, argument_list[5] the address of the
* second argument descriptor. argument_list[0] would be amended to
* reflect the total argument count = 3 + NUMBER_OF_TASK_ARGUMENTS
* supplied to the task by the agent program.
*/
Example 7–3 (Cont.) C Agent Program that Performs Stream I/O or No I/O
/*
* Process the stream task with the following algorithm:
*
* - wait for notification to begin the I/O (WAIT_FOR_STREAM_IO
* completes)
* - do the I/O
* - reply that the I/O is finished (REPLY_TO_STREAM_IO)
* - wait for more notification - if there is no more I/O, the
* sender will disconnect and we will be finished
*/
while (processing_io)
{
status = ACMS$WAIT_FOR_STREAM_IO (&connect_id,
&output_string_addr,
&input_string_addr,
&io_id);
if ((status & 1) != SUCCESS)
{
processing_io = FALSE;
if (status != sender_disconn)
LIB$SIGNAL (status);
}
else
{
/*
* We have been notified to do the I/O - do it
*/
if ((output_string_addr != NULL) && (input_string_addr == NULL))
{
status = LIB$PUT_OUTPUT (output_string_addr);
if ((status & 1) != SUCCESS) LIB$SIGNAL (status);
}
if (input_string_addr != NULL)
{
if (output_string_addr == NULL)
status = LIB$GET_INPUT (input_string_addr);
else
status = LIB$GET_INPUT (input_string_addr,
output_string_addr);
if ((status & 1) != SUCCESS) LIB$SIGNAL (status);
}
Example 7–3 (Cont.) C Agent Program that Performs Stream I/O or No I/O
/*
* Tell the application that we are done with
* the I/O
*/
status = ACMS$REPLY_TO_STREAM_IO (&connect_id,
&io_id);
if ((status & 1) != SUCCESS) LIB$SIGNAL (status);
} /* end of successful WAIT_FOR_STREAM_IO */
} /* end while loop */
/*
* Wait for the task to complete
*/
status = ACMS$WAIT_FOR_CALL_END (&submitter_id, &call_id);
if ((status & 1) != SUCCESS) LIB$SIGNAL (status);
/*
* Terminate the exchange I/O for the submitter
*/
status = ACMS$TERM_EXCHANGE_IO (&exchange_io_id);
/*
* Sign the submitter out
*/
status = ACMS$SIGN_OUT (&submitter_id);
if ((status & 1) != SUCCESS) LIB$SIGNAL (status);
/*
* Display the final status
*/
all_spaces = TRUE;
for (i = 0; (i < 80) && (status_string[i] != NULL) && all_spaces; i++)
if (status_string[i] != ’ ’)
all_spaces = FALSE;
if (!all_spaces)
LIB$PUT_OUTPUT (status_string);
}
Note
Example 7–4 is provided for the convenience of programmers who need
to maintain agent programs written for earlier versions of ACMS. Do not
use the techniques shown in this example when developing new agent
programs.
!
! External References
!
EXTERNAL ROUTINE
LIB$SYS_TRNLOG,
LIB$GET_EF,
LIB$FREE_EF,
LIB$GET_INPUT,
LIB$PUT_OUTPUT,
STR$UPCASE;
EXTERNAL LITERAL
ACMS$_SENDER_DISCONN,
ACMS$_NORMAL;
!
! Library Files
!
LIBRARY ’SYS$LIBRARY:STARLET’;
LIBRARY ’SYS$LIBRARY:ACMSBLI’;
ROUTINE agent_main =
!
! Agent’s main routine
!
BEGIN
LOCAL
status,
sub_id: ACMS$SUBMITTER_ID,
!
! Variable declarations for ACMS$GET_PROCEDURE_INFO_A
!
task_name: BLOCK [ DSC$K_D_BLN, BYTE],
application_name: BLOCK [ DSC$K_D_BLN, BYTE],
io_method,
task_info_list: $ITMLST_DECL ( ITEMS = 2 ),
have_task_info,
!
! Variable declarations for ACMS$START_CALL_A
!
proc_id: CMS$PROCEDURE_ID,
task_id: ACMS$CALL_ID,
argument_list: VECTOR [4,LONG],
selection_string: BLOCK [ DSC$K_D_BLN, BYTE],
status_string: BLOCK [ DSC$K_D_BLN, BYTE],
terminal_name: BLOCK [ DSC$K_D_BLN, BYTE],
!
! Variable declarations for Stream Services
!
stream_id: ACMS$STREAM_ID,
connect_id: ACMS$CONNECT_ID,
io_id: ACMS$IO_ID,
output_string_addr: REF BLOCK [4, BYTE],
input_string_addr: REF BLOCK [4, BYTE],
processing_io,
Example 7–4 (Cont.) BLISS Agent Program that Uses Superseded Services
!
! Variable declarations for asychronous service arguments
!
comp_status_block: VECTOR [ 2, LONG ],
event_flag;
LITERAL
TRUE = 1 EQL 1,
FALSE = 0 EQL 1;
BIND
comp_status = comp_status_block [ 0 ];
!
! Initialize dynamic string descriptors
!
$INIT_DYNDESC ( task_name );
$INIT_DYNDESC ( application_name );
$INIT_DYNDESC ( selection_string );
$INIT_DYNDESC ( status_string );
$INIT_DYNDESC ( terminal_name );
status = LIB$GET_EF ( event_flag );
IF NOT .status THEN SIGNAL ( .status );
status = LIB$SYS_TRNLOG ( %ASCID’TT’, 0, terminal_name );
IF .status NEQ SS$_NORMAL THEN SIGNAL ( .status );
!
! Sign in to ACMS
!
status = $ACMS$SIGN_IN_A (SUBMITTER_ID = sub_id,
DEVICE = terminal_name,
COMP_STATUS = comp_status,
EFN = event_flag );
IF NOT .status
THEN
SIGNAL (.status)
ELSE
BEGIN
$WAITFR ( EFN = .event_flag );
IF NOT .comp_status THEN SIGNAL ( .comp_status );
END;
!
! Set up item list
!
$ITMLST_INIT ( ITMLST = task_info_list,
( ITMCOD = ACMS$K_PROC_PROCEDURE_ID,
BUFSIZ = ACMS$S_PROCEDURE_ID,
BUFADR = proc_id ),
( ITMCOD = ACMS$K_PROC_IO_METHOD,
BUFSIZ = %UPVAL,
BUFADR = io_method ) );
have_task_info = FALSE;
!
! Loop until we get a good application/task name
!
DO
BEGIN
!
! Ask for application name and task name.
! Convert names to all caps for comparisons in ACMS.
!
status = LIB$GET_INPUT (application_name, %ASCID ’Application name: ’);
IF NOT .status THEN SIGNAL (.status);
Example 7–4 (Cont.) BLISS Agent Program that Uses Superseded Services
status = STR$UPCASE (application_name, application_name);
IF .status NEQ SS$_NORMAL THEN SIGNAL ( .status );
!
! Ask ACMS if task is known and get its ID
!
status = $ACMS$GET_PROCEDURE_INFO_A ( SUBMITTER_ID = sub_id,
PROCEDURE = task_name,
PACKAGE = application_name,
ITEM_LIST = task_info_list,
EFN = event_flag,
COMP_STATUS = comp_status );
IF NOT .status
THEN
SIGNAL ( .status )
ELSE
BEGIN
$WAITFR ( EFN = .event_flag );
IF .comp_status EQL ACMS$_NORMAL
THEN
have_task_info = TRUE
ELSE
SIGNAL ( .comp_status );
END;
END
UNTIL .have_task_info;
!
! Get the selection string
!
status = LIB$GET_INPUT (selection_string, %ASCID ’Selection string: ’);
IF NOT .status THEN SIGNAL (.status);
!
! If the I/O method is stream, then setup the stream
!
IF .io_method EQL ACMS$K_IO_STREAM
THEN
BEGIN
Example 7–4 (Cont.) BLISS Agent Program that Uses Superseded Services
IF NOT .status
THEN
SIGNAL (.status)
ELSE
BEGIN
$WAITFR ( EFN = .event_flag );
IF NOT .comp_status THEN SIGNAL ( .comp_status );
END;
Example 7–4 (Cont.) BLISS Agent Program that Uses Superseded Services
!
! If the task I/O method is stream, process the stream I/O in the following
! loop
IF .io_method EQL ACMS$K_IO_STREAM
THEN
BEGIN
processing_io = TRUE;
WHILE .processing_io DO
BEGIN
status = $ACMS$WAIT_FOR_STREAM_IO_A
( CONNECT_ID = connect_id,
OUTPUT_OBJECT = output_string_addr,
INPUT_OBJECT = input_string_addr,
IO_ID = io_id,
COMP_STATUS = comp_status,
EFN = event_flag );
IF NOT .status
THEN
SIGNAL (.status)
ELSE
BEGIN
$WAITFR ( EFN = .event_flag );
IF .comp_status EQL ACMS$_SENDER_DISCONN
THEN
processing_io = FALSE
THEN
SIGNAL ( .comp_status )
ELSE
BEGIN
!
! See what kind of EXCHANGE was in the task defintion
!
IF .output_string_addr NEQ 0 AND .input_string_addr EQL 0
THEN
!
! Exchange step was a WRITE
!
BEGIN
status = LIB$PUT_OUTPUT (.output_string_addr);
IF NOT .status THEN SIGNAL (.status);
END;
IF .input_string_addr NEQ 0
THEN
IF .output_string_addr EQL 0
THEN
!
! Exchange step was a READ
!
BEGIN
status = LIB$GET_INPUT (.input_string_addr);
IF NOT .status THEN SIGNAL (.status);
END
ELSE
!
! Exchange step was a READ WITH PROMPT
!
BEGIN
status = LIB$GET_INPUT (.input_string_addr,
.output_string_addr );
IF NOT .status THEN SIGNAL (.status);
END;
Example 7–4 (Cont.) BLISS Agent Program that Uses Superseded Services
!
! Reply to the I/O request
!
status = $ACMS$REPLY_TO_STREAM_IO_A
(CONNECT_ID = connect_id,
IO_ID = io_id,
EFN = event_flag );
IF NOT .status
THEN
SIGNAL (.status)
ELSE
BEGIN
$WAITFR ( EFN = .event_flag );
IF NOT .comp_status THEN SIGNAL ( .comp_status );
END;
END; ! End of successful wait_for_stream_io completion
END; ! End of successful wait_for_stream_io starting
END; ! End of stream processing loop
END; ! End of stream task
!
! Wait for task to complete
!
status = $ACMS$WAIT_FOR_CALL_END_A (SUBMITTER_ID = sub_id,
CALL_ID = task_id,
COMP_STATUS = comp_status,
EFN = event_flag );
IF NOT .status
THEN
SIGNAL (.status)
ELSE
BEGIN
$WAITFR ( EFN = .event_flag );
IF NOT .comp_status THEN SIGNAL ( .comp_status );
END;
!
! If a stream was used, disconnect it and delete it
!
IF .io_method EQL ACMS$K_IO_STREAM
THEN
BEGIN
status = $ACMS$DISCONNECT_STREAM_A (CONNECT_ID = connect_id,
COMP_STATUS = comp_status,
EFN = event_flag );
IF NOT .status
THEN
SIGNAL (.status)
ELSE
BEGIN
$WAITFR ( EFN = .event_flag );
IF NOT .comp_status THEN SIGNAL ( .comp_status );
END;
Example 7–4 (Cont.) BLISS Agent Program that Uses Superseded Services
TYPE
uword = [WORD] 0..65535; { Unsigned word }
ubyte = [BYTE] 0..255; { Unsigned byte }
pstring = PACKED ARRAY [1..pstring_length] OF CHAR;
{ descriptor datatype }
desc_type = [BYTE(8)]
RECORD
length : [POS(0)] uword;
dtype : [POS(16)] ubyte;
class : [POS(24)] ubyte;
ptr : [POS(32),UNSAFE] INTEGER;
END;
quad = PACKED ARRAY [0..1] OF [UNSAFE] INTEGER;
nodes = (eku,nku,wku,ul,cmu);
arg_list = PACKED ARRAY [0..3] OF [UNSAFE] INTEGER;
VAR
submitter_id : ACMS$SUBMITTER_ID;
exchange_io_id: ACMS$EXCHANGE_IO_ID;
status : [unsafe] INTEGER;
status_block : ARRAY[eku..cmu] OF quad;
selection_string : ARRAY[eku..cmu] of desc_type;
padded_application_name : pstring;
padded_task_name : pstring;
status_string : ARRAY[eku..cmu] of desc_type;
argument_list: ARRAY[eku..cmu] OF arg_list;
i : nodes;
BEGIN
WITH temp DO
BEGIN
length := 0;
class := dsc$k_class_d;
dtype := dsc$k_dtype_t;
ptr := 0;
END;
init_dyndesc := temp;
END ; { function init_dyndesc}
BEGIN { call_task}
{ Build get procedure info list }
WITH proc_list.list DO
BEGIN
buffer_length := acms$s_procedure_id;
item_code := acms$k_proc_procedure_id;
buffer_address := iaddress(procedure_id);
ret_length_adr := 0;
END ; {with proc_list}
proc_list.term := 0;
{ Get procedure_id via acms$get_procedure_info }
status := $ACMS$GET_PROCEDURE_INFO(SUBMITTER_ID := submitter_id,
PACKAGE := application_name,
procedure_ := task_name,
item_list := proc_list);
IF not odd(status) THEN SIGNAL(status);
BEGIN { main }
{ Init argument list for calls }
FOR i := eku TO cmu DO
BEGIN
status_string[i] := init_dyndesc;
selection_string[i] := init_dyndesc;
argument_list[i][0] := 3; {Number of argument in list}
argument_list[i][1] := IADDRESS(selection_string[i]);
argument_list[i][2] := IADDRESS(status_string[i]);
argument_list[i][3] := IADDRESS(exchange_io_id);
END;{for}
call_task(SUBMITTER_ID := submitter_id,
application_name := padded_application_name,
task_name := padded_task_name,
argument_list := argument_list[eku],
status_block := status_block[eku]);
padded_application_name := PAD ( ’NKU::TRANSACTIONS’, ’ ’, pstring_length );
call_task(SUBMITTER_ID := submitter_id,
application_name := padded_application_name,
task_name := padded_task_name,
argument_list := argument_list[nku],
status_block := status_block[nku]);
padded_application_name := PAD ( ’WKU::TRANSACTIONS’, ’ ’, pstring_length );
call_task(SUBMITTER_ID := submitter_id,
application_name := padded_application_name,
task_name := padded_task_name,
argument_list := argument_list[wku],
status_block := status_block[wku]);
padded_application_name := PAD ( ’UL::TRANSACTIONS’, ’ ’, pstring_length );
call_task(SUBMITTER_ID := submitter_id,
application_name := padded_application_name,
task_name := padded_task_name,
argument_list := argument_list[ul],
status_block := status_block[ul]);
The first part of this appendix describes six services used in earlier versions
of ACMS and provides reference material for calling these services in agent
programs. These six services have been replaced by ACMS$INIT_EXCHANGE_
IO and ACMS$TERM_EXCHANGE_IO. You need to use the new services and
arguments for all agent programs that call tasks that perform DECforms I/O.
The new services simplify systems interface programming and simplify program
maintenance. Use them with TDMS, RI, and stream services as well as with HP
DECforms. For information regarding the new services, see Chapter 4.
ACMS supports the superseded services for agent programs that are already
implemented. It also supports the superseded task I/O arguments. In new agent
programs, however, use the ACMS$INIT_EXCHANGE_IO and ACMS$TERM_
EXCHANGE_IO services. Whenever practical, change the superseded services
to ACMS$INIT_EXCHANGE_IO and ACMS_TERM_EXCHANGE_IO in existing
agent programs.
Do not mix the new services and the superseded services indiscriminately. Any
attempt to use a superseded service to close a call opened with the new service
results in an invalid status message. Any attempt to use the new service to close
a call opened with a superseded service results in a status message of invalid.
The second part of the appendix describes parameters that were passed into the
task I/O argument of the ACMS$CALL and ACMS$START_CALL services in
versions of ACMS earlier than Version 3.2. Beginning with ACMS Version 3.1,
instead of passing a device name or stream ID to the task I/O argument, use the
exchange I/O ID for tasks that perform request I/O, stream I/O, or terminal I/O.
Table A–1 lists the superseded services and gives a brief description of each.
The rest of this appendix contains reference material for using the superseded
services. The services appear in alphabetical order.
A.1 ACMS$CLOSE_RR
Note
This service has been superseded. ACMS supports this service for existing
applications using TDMS. Use the ACMS$TERM_EXCHANGE_IO service
in new applications.
Format
ACMS$CLOSE_RR ([channel.rlu.r],
[nullarg])
ACMS$CLOSE_RR_A ([channel.rlu.r],
[nullarg],
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
channel
The TDMS channel returned from a previous ACMS$OPEN_RR call. The agent
program must supply this parameter.
nullarg
Place-holding argument. This argument is reserved for HP’s use.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Return Status
This list summarizes each error returned by this service. Attempts to use
ACMS$CLOSE_RR to close a channel opened with ACMS$INIT_EXCHANGE_
IO result in a status message of invalid. Also, invalid status returns from
TSS$CLOSE might be returned to the agent program. See the reference section
of the VAX TDMS Reference Manual for more information on TSS$CLOSE.
The return status codes indicating success or failure of the call follow:
A.2 ACMS$CONNECT_STREAM
Note
This service has been superseded. ACMS supports this service for
applications that have already been implemented. To simplify the
writing of agent programs, and to simplify program maintenance, use the
ACMS$INIT_EXCHANGE_IO service in new applications.
Format
ACMS$CONNECT_STREAM (stream_id.rq.r,
mode.rl.r,
connect_id.wq.r,
[submitter_id.rq.r])
ACMS$CONNECT_STREAM_A (stream_id.rq.r,
mode.rl.r,
connect_id.wq.r,
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v],
[submitter_id.rq.r])
Parameters
stream_id
The identification of the stream to which you want to connect. This ID is returned
by ACMS$CREATE_STREAM.
mode
The mode of this stream connection must always be set to ACMS$K_STRM_
PASSIVE.
connect_id
The identification that is returned by this service to identify this stream
connection. This ID is used later by ACMS$DISCONNECT_STREAM,
ACMS$WAIT_FOR_STREAM_IO, and ACMS$REPLY_TO_STREAM_IO.
submitter_id
This ID is used to associate the stream ID with the submitter. The submitter_id
argument is optional. You must use this parameter if the agent program calls an
ACMS task that performs DECforms, TDMS, or terminal I/O, and that task calls
another task that performs stream I/O.
Return Status
The return status codes indicating success or failure of the call follow:
A.3 ACMS$CREATE_STREAM
Note
ACMS$CREATE_STREAM has been superseded. ACMS supports this
service for applications that have already been implemented. To simplify
the writing of agent programs and to simplify program maintenance, use
the ACMS$INIT_EXCHANGE_IO service in new applications.
Format
ACMS$CREATE_STREAM (mode.rl.r,
stream_id.wq.r)
ACMS$CREATE_STREAM_A (mode.rl.r,
stream_id.wq.r,
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
mode
The mode of the stream must always be set to ACMS$K_STRM_
BIDIRECTIONAL.
stream_id
The stream identification that is returned by this service. The ID is passed to
any task that connects to this stream.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Return Status
The return status codes indicating success or failure of the call follow:
A.4 ACMS$DELETE_STREAM
Note
This service has been superseded. ACMS supports this service for
applications that have already been implemented. To simplify the
writing of agent programs and to simplify program maintenance, use the
ACMS$TERM_EXCHANGE_IO service in new applications.
Format
ACMS$DELETE_STREAM (stream_id.rq.r,
[flags.rl.r])
ACMS$DELETE_STREAM_A (stream_id.rq.r,
[flags.rl.r],
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
stream_id
The identification of the stream you want to delete. This is the ID returned by
ACMS$CREATE_STREAM.
flags
You can set a bit in the flag, ACMS$M_STRM_DISCONNECT, to specify what to
do on a stream deletion.
ACMS$M_STRM_DISCONNECT disconnects all connections to this stream. If
you do not set this bit, the stream is not deleted until all connections to the
stream are disconnected.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Return Status
The return status codes indicating success or failure of the call follow:
A.5 ACMS$DISCONNECT_STREAM
Note
This service has been superseded. ACMS supports this service for
applications that have already been implemented. To simplify the
writing of agent programs and to simplify program maintenance, use the
ACMS$TERM_EXCHANGE_IO service in new applications.
Format
ACMS$DISCONNECT_STREAM (connect_id.rq.r,
[flags.rl.r])
ACMS$DISCONNECT_STREAM_A (connect_id.rq.r,
[flags.rl.r],
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
connect_id
The identification of the stream you want to disconnect. This is the ID returned
by the ACMS$CONNECT_STREAM service.
flags
Reserved.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Return Status
The return status codes indicating success or failure of the call follow:
A.6 ACMS$OPEN_RR
For previously implemented tasks that use TDMS, you call ACMS$OPEN_RR
to open a TDMS channel and associate it with a submitter ID. Subsequent task
selections for that submitter use the channel for all task request I/O, including
remote request I/O. For previously implemented tasks that use the ACMS
Request Interface (RI), you call ACMS$OPEN_RR to prepare the agent process
to do the I/O. ACMS$OPEN_RR must be closed with ACMS$CLOSE_RR. If an
attempt is made to close it with ACMS$TERM_EXCHANGE_IO, an invalid status
is returned.
Note
This service has been superseded. ACMS supports this service for
applications that have already been implemented. To simplify writing
agent programs, and to simplify program maintenance, use the
ACMS$INIT_EXCHANGE_IO service in new applications.
Format
ACMS$OPEN_RR (device.rt.dx,
channel.wlu.r,
[submitter_id.rq.r],
[flags.rl.r],
[nullarg])
ACMS$OPEN_RR_A (device.rt.dx,
channel.wlu.r,
[submitter_id.rq.r],
[flags.rl.r],
[nullarg],
[comp_status.wq.r],
[efn.rbu.r],
[astadr.szem.r],
[astprm.rz.v])
Parameters
device
The name of the terminal the channel opens.
channel
An output parameter naming the TDMS channel that is open. This parameter
can later be used as an input parameter to the ACMS$CLOSE_RR service. The
agent program can use this channel for its own TDMS calls.
submitter_id
The submitter ID corresponding to a signed-in submitter (user). This ID is
returned by the ACMS$SIGN_IN service. This parameter defaults to a quadword
that is equal to zero.
flags
TDMS is enabled by default. The ACMS$OPEN_RR remote request service does
not enable the agent program to call tasks that use DECforms.
If agent programs use the ACMS Request Interface (RI), it is necessary to set the
ACMS$V_FORCE_AGENT_IO flag. In ACMS Version 3.0, agent programs that
did not set this flag could still use the RI in a distributed environment, though
they could not use the RI if it selected tasks from an application on the same
node. Starting with ACMS Version 3.1, agent programs without this flag do not
work in a distributed environment.
If only the RI is used, TDMS can be disabled to conserve resources. If the agent
program sets the ACMS$M_DISABLE_TDMS flag on the call to ACMS$OPEN_
RR, TDMS is disabled for the agent process, indicating that the agent program
uses only the RI. Because TDMS is completely disabled in the agent process,
TDMS is not used even if a task uses TDMS I/O and an .RLB file exists to
perform the request.
nullarg
The nullarg parameter is a place-holding argument. This argument is reserved
for HP’s use.
The parameters comp_status.wq.r, efn.rbu.r, astadr.szem.r, and astprm.rz.v
are asynchronous service arguments. See Chapter 2 for a discussion of these
parameters.
Return Status
The following list summarizes each error returned by this service. Invalid
status returns from TSS$CLOSE might be returned to the agent program. See
the reference section of VAX TDMS Reference Manual for more information on
TSS$CLOSE.
The return status codes indicating success or failure of the call follow:
Note
This method has been superseded by implementation of the exchange
I/O ID feature. This figure is included for reference for agent programs
that have already been developed. Use the exchange I/O ID in new agent
programs.
Extended Status
Terminal Name
Task Argument 2
TAY-0127-AD
A.7.2 Argument List for a Task That Passes Only Stream I/O
Figure A–2 shows an argument list that passes only a stream ID. The figure
illustrates how to set the selection string and extended status parameters to zero
when the agent program does not use these arguments.
Note
This method has been superseded by implementation of the exchange
I/O ID feature. This figure is included for reference for agent programs
that have already been developed. Use the exchange I/O ID in new agent
programs.
Stream
ID
TAY-0129-AD
A.7.3 Argument List with Selection String, Extended Status, and Terminal I/O
Defined
Figure A–3 shows an argument list that has the selection string, extended status,
and terminal I/O defined.
Note
This method has been superseded by implementation of the exchange
I/O ID feature. This figure is included for reference for agent programs
that have already been developed. Use the exchange I/O ID in new agent
programs.
Selection String
Extended Status
Terminal Name
TAY-0130-AD
ACMS$OPEN_RR
A programming format, A–14
return status, A–15
$ABORT_TASK
ACMS$REPLY_TO_STREAM_IO, 6–2t
to roll back distributed transaction, 3–2
programming format, 6–5
$ABORT_TRANS, 3–4
return status, 6–6
to roll back distributed transaction, 3–4
ACMS$SIGNAL, 2–6
ACC ACMS$SIGN_IN, 4–2t, 4–3, 4–10
See ACMS Central Controller cancel routine, 4–3
Access control list, 5–5, 5–25 cancel routine parameter, 4–10
ACMS$CALL, 5–2t, 5–5 parameters, 4–10
accepts TID, 3–3 programming format, 4–10
agent program uses to call task, 3–2 return status, 4–11
programming format, 5–9 submitter ID, 4–3, 4–10
return status, 5–11 ACMS$SIGN_OUT, 4–2t, 4–5
ACMS$CALL_A cancel flag parameter, 4–5
accepts TID, 3–3 programming format, 4–13
return status, 5–11 return status, 4–13
ACMS$CANCEL ACMS$START_CALL, 5–2t, 5–5
return status, 5–15 accepts TID, 3–3
ACMS$CANCEL_CALL, 3–4, 5–2t, 5–5, 5–14 agent program uses to call task, 3–2
programming format, 5–14 programming format, 5–20
ACMS$CHECK, 2–12 return status, 5–23
deassigning, 2–13 ACMS$START_CALL_A
ACMS$CLOSE_RR accepts TID, 3–3
programming format, A–3 ACMS$TERM_EXCHANGE_IO, 4–2t, 4–5
return status, A–3 Exchange I/O ID, 4–5
ACMS$CONNECT_STREAM programming format, 4–15
programming format, A–5 return status, 4–15
return status, A–6 ACMS$WAIT, 2–8
ACMS$CREATE_STREAM, 5–3 Pascal agent program example, 7–26e
programming format, A–8 ACMS$WAIT_FOR_CALL_END, 5–2t, 5–5
return status, A–8 agent program uses to call task, 3–2
ACMS$DECFORMS_IN_AGENT programming format, 5–25
process logical name, 2–11 return status, 5–26
ACMS$DELETE_STREAM using with ACMS$START_CALL, 5–20
programming format, A–10 ACMS$WAIT_FOR_STREAM_IO, 6–2t
return status, A–11 programming format, 6–7
ACMS$DISCONNECT_STREAM return status, 6–9
programming format, A–12 use with ACMS$CREATE_STREAM, A–8
return status, A–12 ACMS$_NOTRANSADB, 3–3
ACMS$GET_PROCEDURE_INFO, 5–2t, 5–3 ACMS$_NOTRANSNODE, 3–3
programming format, 5–16 ACMS$_TASKNOTCOMP, 3–3
return status, 5–18 ACMS Central Controller
ACMS$INIT_EXCHANGE_IO, 4–2t, 4–4 function during sign in, 4–1
Exchange I/O ID, 4–4 verifying device names, 4–10
programming format, 4–6 verifying user names, 4–10
return status, 4–8
Index–1
ACMSDDF.DAT Agent program (cont’d)
See Device definition file starts distributed transaction, 7–1
ACMSPKG$_INVARGTYPE, 5–3 submitting tasks, 1–3f
ACMSUDF.DAT supplying
See User definition file exchange I/O ID, 5–21
Agent extended status, 5–21
multi-user, 2–11 I/O method, 5–21
RI item descriptors, 5–17
preparing to use with HP DECforms, 2–11 selection string, 5–21
single-user, 2–11 workspaces to tasks, 1–4, 5–6
user-written terminating a stream, 6–1t
preparing to use with HP DECforms, 2–11 terminating HP DECforms sessions, 4–15
Agent process user name, 4–10
definition of, 1–1 using
Agent program stream services, 6–1f
authorizing the user name of, 4–3, 4–10 superseded stream services, A–1f
BLISS agent program using superseded waiting for
services, 7–20e, 7–26e stream I/O, 6–2t, 6–7
C agent program performing stream I/O, 7–15e task completion, 5–2t, 5–5, 5–25
calling DECdtm services, 1–4 ALL-IN-1
calling tasks, 1–4, 5–1, 5–2t, 5–5, 5–9, 5–20 using with ACMS, 1–1
canceling tasks, 5–2t, 5–5, 5–14 Application
causing ACMS malfunction, 1–4 getting information for, 5–3, 5–16
coded in high-level languages, 2–13 Application Execution Controller
connecting a stream, 1–5f, 6–1t and superseded stream services, A–1
coordinate distributed transactions, 3–1 and the stream services, 6–1
creating a stream, 6–1t function during task execution, 5–2
debugging with ACMS$CHECK, 2–12 performing stream I/O, 6–2, 6–7
definition of, 1–1 Arguments
deleting a stream, 6–1t methods for passing, 5–3
disconnecting a stream, 6–1t supplying workspaces to ACMS in, 5–3
finding application information, 5–3, 5–16 AST
finding task information, 5–16 See Asynchronous service
FORTRAN general-purpose agent program, Asynchronous service
7–10e AST parameters, 2–3
function of, 1–2 AST routine address, 2–4
handling exchange I/O, 4–6 completion status, 2–3
handling remote request I/O, A–15 disabling ASTs, 2–3
I/O capabilities, 4–7 event flag, 2–4
initializing a stream, 6–1t parameters, 2–3
initializing HP DECforms, 4–6 with multithreaded agent programs, 2–10
initializing with ACMS$SIGN_IN, 4–10 Authorization
invoking, 2–11 of agent programs, 4–3
item list, 4–7
multithreaded, 2–10 B
Pascal agent program, 7–26e
passing task information, 5–3 BLISS
privileges, 4–3 agent program using superseded services,
processing sequence, 1–4 7–20e, 7–26e
providing TDMS channels with superseded keyword macros, 2–14
services, A–3, A–14 library file, 2–14
replying to stream I/O, 6–2t, 6–5 using with the SI, 2–14
services Block steps
ACMS$SIGN_OUT, 4–13 defining stream I/O in, 6–2
signing in task submitters, 4–1f, 4–10 Buffer address
signing out task submitters, 4–13 for ACMS$GET_PROCEDURE_INFO, 5–17
single-threaded, 2–10
starting, 2–12
Index–2
Buffer length
for ACMS$GET_PROCEDURE_INFO, 5–17
Byte arrays
D
service ID structures in FORTRAN, 2–15 Debugging agent program
ACMS$CHECK, 2–12
DECdtm services
C used to commit a distributed transaction, 1–4
C used to start a distributed transaction, 1–4
agent program in, 7–1 DECforms
agent program performing stream I/O, 7–15e initializing, 4–6
text library, 2–14 with RI agent, 2–11
using with the SI, 2–14 with user-written agent, 2–11
Call ID, 5–5, 5–14 Definitions
length, 2–13 ACMS$CHECK logical, 2–12
structure layout, 2–13 for BLISS, 2–14
use with ACMS$START_CALL, 5–20 for C programmers, 2–14
use with ACMS$WAIT_FOR_CALL_END, 5–25 for FORTRAN programmers, 2–15
Calls for MACRO programmers, 2–15
to tasks, 5–9 for Pascal programmers, 2–15
Canceling for PL/I programmers, 2–16
tasks, 5–2t, 5–5, 5–14 Descriptors
Cancel parameter, 4–10, 4–13 item, 5–17
Command Process string, 6–5, 6–7
and the SI, 1–1 Device
similarities to agent program, 1–2 access to ACMS over streams, 1–5
user-written, 1–1 authorizing in ACMS, 4–3
Communication calling tasks from, 1–4
over streams, 1–4, 6–1f non-DECforms, 1–1
Composable task passing I/O ID to a task, 5–3
rules for, 3–1 passing terminal name to a task, 5–3
Connect ID supplying name to ACMS, 4–10
length, 2–14 Device definition
structure layout, 2–13 authorizing terminals in device definition file,
use with ACMS$CONNECT_STREAM, A–5 4–3
use with ACMS$DISCONNECT_STREAM, NL device name, 4–3
A–12 Distributed application, 1–1, 1–5
use with ACMS$INIT_EXCHANGE_IO, 6–1t Distributed transactions
use with ACMS$REPLY_TO_STREAM_IO, 6–5 canceling, 3–4
use with ACMS$WAIT_FOR_STREAM_IO, 6–7 coordinating
Constants by SI, 1–1
defining for from agent program, 3–1
BLISS, 2–14 rolling back, 3–4
C, 2–14
FORTRAN, 2–15 E
MACRO, 2–15
other languages, 2–16 EFN
Pascal, 2–15 See Event flag
PL/I, 2–16 $END_TASK
used by services, 2–14 to end distributed transaction, 3–2
Errors
CP
handling
See Command Process
ACMS$SIGNAL service (SI), 2–6
messages, 2–2
Event flag, 2–4
Exchange I/O
ID, 5–9, 5–21
supplying to a task, 5–21
Index–3
Exchange I/O (cont’d) Interfaces (cont’d)
ID returned from ACMS$INIT_EXCHANGE_ to ACMS over streams, 1–5
IO, 4–4 using stream services, 1–4
performed by an agent program, 4–6 Item codes
services, 4–5 for ACMS$GET_PROCEDURE_INFO, 5–17
ACMS$INIT_EXCHANGE_IO, 4–6 Item descriptors, 5–16, 5–17
ACMS$INIT_EXCHANGE_IO, 4–2t, 4–4 Item list
ACMS$TERM_EXCHANGE_IO, 4–15 I/O flag, 4–7
ACMS$TERM_EXCHANGE_IO, 4–2t, 4–5
specifying, 4–4
Exchange steps
K
clauses for stream I/O, 6–2 Keywords
Extended status, 5–3, 5–9, 5–21 macros, 2–14
F L
FORTRAN Languages
general-purpose agent program, 7–10e using with the SI, 2–16
text library, 2–15 Logical names
using with the SI, 2–15 for RI agents with DECforms, 2–11
for user-written agents with DECforms, 2–11
H
HP DECforms
M
terminating sessions, 4–15 MACRO
library, 2–15
using with the SI, 2–15
I Menu
I/O interfacing, 1–1, 1–4
capabilities of an agent program, 4–7 Messages
ID sent in string descriptors, 6–7
length, 2–14 Modules
passing to a task, 5–3 supplied for C, 2–14
structure layout, 2–13 supplied for FORTRAN, 2–15
supplying to a task, 5–3 Multithreaded agent program
use with ACMS$REPLY_TO_STREAM_IO, context with, 2–10
6–5 error isolation, 2–10
use with ACMS$WAIT_FOR_STREAM_IO, invoking, 2–12
6–7 programming considerations, 2–10
method using asynchronous services, 2–10
finding, 5–2, 5–16 using separate I/O channels, 2–10
item descriptor for, 5–17 Multi-user agent, 2–11
programming, 5–3
supplying to a task, 5–3, 5–21
Include file
O
definitions for Pascal, 2–15 Output string descriptors, 6–7
Initialization services, 4–1f, 4–2t, 4–5
ACMS$SIGN_IN, 1–2t, 4–2t P
ACMS$SIGN_OUT, 1–2t, 4–2t
agent programs Parameters
ACMS$SIGN_IN, 4–10 notation for procedure, 2–1
ACMS$SIGN_OUT, 4–13 Pascal
superseded, A–1 agent program using ACMS$WAIT, 7–26e
Input using with the SI, 2–15
string descriptors, 6–7 PL/I
Interfaces using with the SI, 2–16
menu, 1–1
non-DECforms, 1–1
Index–4
Privileges Services
agent program, 4–3 IDs (cont’d)
Procedures procedure ID, 5–20
ID for server ID, 5–22
finding, 5–16 stream ID, 6–2t
use with ACMS$START_CALL, 5–20 structure definitions for BLISS, 2–14
structure definitions for C, 2–14
Process
structure layout, 2–13
See Agent program
submitter ID, 4–10, 4–13, 5–9, 5–14, 5–16,
5–20, 5–25
R parameter notation used, 2–1
Records SI
definitions See Systems Interface
for Pascal, 2–15 Sign In/Out services
Remote ACMS$SIGN_IN, 4–3
request ACMS$SIGN_OUT, 4–5
performed by an agent program, A–15 Signing in
Replying to stream I/O, 6–2t, 6–5 See also Initialization services
Request I/O task submitters, 4–1f, 4–3, 4–10
defining, 1–4 Signing out
Request Interface, 1–5 See also Initialization services
agent task submitters, 4–5, 4–13
preparing to use with HP DECforms, 2–11 Single-threaded agent program
I/O flag, 4–7 programming considerations, 2–10
Require file Single-user agent, 2–11
supplied for BLISS, 2–14 Standards
Resources for using the SI services, 2–1
freed after submitter finishes, 4–5 Starting
Return an agent program, 2–11
See also Status, return tasks, 5–2t
length address $START_TRANS
for ACMS$GET_PROCEDURE_INFO, to start distributed transaction, 3–2
5–17 Status
Return status access errors, 5–5, 5–25
See Status, return ACMS$CALL, 5–11
Routine definitions ACMS$CALL_A, 5–11
for C, 2–14 ACMS$CANCEL, 5–15
for Pascal, 2–15 ACMS$CLOSE_RR, A–3
for PL/I, 2–16 ACMS$CONNECT_STREAM return status,
A–6
S ACMS$CREATE_STREAM return status, A–8
ACMS$DELETE_STREAM return status, A–11
Selection strings, 5–3, 5–9, 5–21 ACMS$DISCONNECT_STREAM return status,
Servers A–12
IDs ACMS$GET_PROCEDURE_INFO, 5–18
used with ACMS$START_CALL, 5–22 ACMS$INIT_EXCHANGE_IO, 4–8
Services ACMS$OPEN_RR, A–15
See also Initialization services ACMS$REPLY_TO_STREAM_IO return status,
See also Stream services 6–6
See also Submitter, services ACMS$SIGN_IN, 4–11
submitter See Submitter, services ACMS$SIGN_OUT, 4–13
IDs ACMS$START_CALL, 5–23
byte arrays for FORTRAN, 2–15 ACMS$TERM_EXCHANGE_IO, 4–15
call ID, 5–14, 5–20, 5–25 ACMS$WAIT_FOR_CALL_END, 5–26
connect ID, 6–2t, 6–5, 6–7 ACMS$WAIT_FOR_STREAM_IO return status,
defining structure for PL/I IDs, 2–16 6–9
I/O ID, 6–5, 6–7 cancel message, 2–3
length of, 2–13
Index–5
Status (cont’d) Submitter
completion events, 2–3 ID (cont’d)
extended, 5–3, 5–9, 5–21 use with ACMS$CALL, 5–9
return use with ACMS$CANCEL_CALL, 5–14
severity levels, 2–2 use with ACMS$CLOSE_RR, A–3
returned use with ACMS$GET_PROCEDURE_INFO,
for asynchronous services, 2–2 5–16
on an ACMS malfunction, 1–4 use with ACMS$INIT_EXCHANGE_IO,
on cancel routine, 4–5 4–6
Stream use with ACMS$OPEN_RR, A–14
I/O use with ACMS$SIGN_OUT, 4–13
C agent program example, 7–15e use with ACMS$START_CALL, 5–20
defining, 1–4 use with ACMS$TERM_EXCHANGE_IO,
Streams 4–15
See also Stream, I/O use with ACMS$WAIT_FOR_CALL_END,
authorizing the I/O device for, 4–3 5–25
connecting, 1–5f, 6–1t use with single-threaded agent programs,
creating, 5–3, 6–1t 2–10
defining I/O in a BLOCK step, 5–3, 6–2 services, 5–1f, 5–2t, 5–3
deleting, 6–1t ACMS$CALL, 5–2t, 5–5, 5–9
disconnecting, 6–1t ACMS$CANCEL_CALL, 5–2t, 5–5, 5–14
finding the stream ID, 5–16 ACMS$GET_PROCEDURE_INFO, 5–2t,
ID 5–3, 5–16
length, 2–13 ACMS$START_CALL, 5–2t, 5–5, 5–20
structure layout, 2–13 ACMS$WAIT_FOR_CALL_END, 5–2t,
use with ACMS$CONNECT_STREAM, 5–5, 5–25
A–5 Superseded services, A–1
use with ACMS$CREATE_STREAM, A–8 ACMS$CLOSE_RR, A–3
use with ACMS$DELETE_STREAM, A–10 ACMS$OPEN_RR, A–14
use with ACMS$INIT_EXCHANGE_IO, BLISS agent program example, 7–20e, 7–26e
6–1t Superseded stream services
item descriptor value for I/O, 5–17 ACMS$DELETE_STREAM, A–10
main uses of, 1–4 Superseded task submitters
passing the stream ID, 5–3 communicating with tasks, A–1
replying to messages on, 6–2t Synchronous service
supplying device name to ACMS, 4–10 completion status, 2–2
terminating, 6–1 disabling ASTs, 2–3
waiting for messages on, 6–2t, 6–7 System services
Stream services, 6–1, 6–2t for distributed transactions, 3–1
ACMS$REPLY_TO_STREAM_IO, 6–2t, 6–5 Systems Interface
ACMS$WAIT_FOR_STREAM_IO, 6–2t, 6–7, ACMS$WAIT_FOR_CALL_END, 5–25
A–8 and the command process, 1–1
superseded asynchronous service parameters, 2–3
ACMS$CONNECT_STREAM, A–5 calling ACMS tasks, 1–4
ACMS$CREATE_STREAM, A–8 calls
WAIT_FOR_STREAM_IO, A–5 ACMS$CALL, 5–9
Strings ACMS$CANCEL_CALL, 5–14
descriptors, 6–5, 6–7 ACMS$CLOSE_RR, A–3
selection, 5–3, 5–21 ACMS$CONNECT_STREAM, A–5
Structure definitions ACMS$CREATE_STREAM, A–8
for C, 2–14 ACMS$DELETE_STREAM, A–10
for PL/I, 2–16 ACMS$DISCONNECT_STREAM, A–12
for service IDs, 2–13 ACMS$GET_PROCEDURE_INFO, 5–16
Submitter ACMS$INIT_EXCHANGE_IO, 4–6
ID ACMS$OPEN_RR, A–14
assigned during ACMS$SIGN_IN, 4–3 ACMS$REPLY_TO_STREAM_IO, 6–5
length, 2–13 ACMS$SIGN_IN, 4–10
structure layout, 2–13 ACMS$SIGN_OUT, 4–13
Index–6
Systems Interface Tasks
calls (cont’d) submitters (cont’d)
ACMS$START_CALL, 5–20 outside the ACMS environment, 1–1
ACMS$TERM_EXCHANGE_IO, 4–15 signing in to ACMS, 4–3, 4–10
ACMS$WAIT_FOR_CALL_END, 5–25 signing out of ACMS, 4–5, 4–13
ACMS$WAIT_FOR_STREAM_IO, 6–7 superseded services, A–3, A–14
asynchronous and synchronous, 2–2 terminating exchange I/O, 4–5
programming, 2–1 waiting for completion of, 5–2t, 5–5, 5–25
common features of the services, 2–1 Terminal
creating streams, 1–4 DECforms sessions, 4–6
definition of, 1–1 HP DECforms termination, 4–15
description of services, 1–2t I/O
exchange I/O services, 4–5 authorizing the I/O device, 4–3
features common to programming languages, defining, 1–4
2–13 finding the terminal name, 5–16
function of agent program, 1–2 item descriptor symbol, 5–17
initialization services, 4–5 passing exchange I/O ID, 5–3
length of service IDs, 2–13 supplying device name to ACMS, 4–10
main uses for, 1–1 providing HP DECforms sessions to, 4–5
purpose, 1–1 TDMS channels with superseded services, A–3,
return status severity levels, 2–2 A–14
service call specification, 2–1 Terminal Data Management System
service ID structure layout, 2–13 providing channels to, with superseded services,
standards for using, 2–1 A–14
stream services, 6–1 providing channels to with superseded services,
submitter services, 5–1 A–3
superseded services, A–1 Terminating
synchronous services, 2–2 a stream, 6–1t
use with high-level languages, 2–13 exchange I/O, 4–5
using Text library
BLISS, 2–14 modules
C, 2–14 for C, 2–14
FORTRAN, 2–15 for FORTRAN, 2–15
MACRO, 2–15 for PL/I, 2–16
other languages, 2–16 TID
Pascal, 2–15 agent program passing to task, 5–3
PL/I, 2–16 passing
using SI services, 5–5
services that accept, 3–3
T
Transaction ID
Task I/O method, 5–9, 5–21 See TID
Tasks TRANSW
calling, 1–3f, 4–3, 5–1, 5–2t, 5–5, 5–9, 5–20 "Wait" system services (synchronous), 3–1
calling with the SI, 1–1
canceling, 5–2t, 5–5, 5–14
communicating over a stream, 6–1 U
defined with stream I/O, 6–2 User
definitions definition file
request I/O, 1–4 authorizing agent programs, 4–3
stream I/O, 1–4, 6–2 User Definition Utility
passing adding an agent program, 4–3
workspaces to, 5–7 User names
preparing to call, 5–2, 5–3, 5–16 authorizing for access to ACMS
submitters as agent programs, 4–3
authorizing in ACMS, 4–3 User-written agent
calling tasks, 1–4, 5–1 preparing to use with HP DECforms, 2–11
communicating with tasks, 6–1
exchange I/O, 4–6, 4–15
Index–7
W
Waiting
for stream I/O, 6–2t, 6–7
for task completion, 5–2t, 5–25
WAIT_FOR_STREAM_IO
use with ACMS$CONNECT_STREAM, A–5
Workspaces
list of arguments, 5–3
supplying
to ACMS, 5–3, 5–6
to an ACMS task, 1–4
Index–8