Professional Documents
Culture Documents
B0193ne F
B0193ne F
REV F
I/A Series®
Integrated Control Configurator
Application Programming Interface
November 30, 1998
HOST AP or AW
pdef/olist
Work file
Checkpoint file
Foxboro and I/A Series are registered trademarks of The Foxboro Company.
UNIX is a trademark of X/Open Company LTD.
iii
B0193NE – Rev F Contents
iv
Contents B0193NE – Rev F
v
B0193NE – Rev F Contents
Index .............................................................................................................................. 77
vi
Preface
This document describes the functions and operations of the Integrated Control Configurator
Application Programming Interface (ICCAPI).
The ICCAPI is a package that allows application programs to manipulate the databases that
define compounds and blocks in CPs and CP-like stations. It supports many of the operations
supported by the Integrated Control Configurator.
Revision Information
For Release 6.1.1, the following change was made:
Chapter 4 “Using the ICCAPI”
♦ Corrected example for the ICCPRT Script.
NOTE
The term “CP” is used as a general term to refer to any control station (for
example, gateways), not only the CP10 and CP30 stations.
vii
B0193NE – Rev F Preface
viii
1. Theory of Operation
This section contains information on the features, components, principles of
operation, and data structure of the ICCAPI. Also in this section is a list of the
external interfaces for the ICCAPI: the pdef and olist files define all the possible
block types, their configurable parameters, and their associated default values for
a given release of I/A Series. The ICCAPI Driver Task reads commands, by
default, from stdin, and writes its output, by default, to stderr and stdout.
The Integrated Control and I/O Configurator Application Program Interface (ICCAPI) pro-
vides an interface to applications that need to manipulate the three databases used by the Inte-
grated Control and I/O Configurator (ICC):
♦ CP memory resident database and associated checkpoint file
♦ ICC workfile database
♦ CSA database
With the aid of the ICCAPI, applications can modify the databases in a manner consistent
with the methods used by the ICC. The ICCAPI performs all checks necessary to prevent
duplicate compound or block names. When accessing the databases, the ICCAPI conforms to
the protocol followed by the ICC with regard to locking the checkpoint file and establishing a
connection with the CP.
ICCAPI Components
The ICCAPI has two major components:
♦ A library of functions. An application running on an AP/AW can link into this
library to gain access to the ICCAPI capabilities.
♦ A Driver Task that uses the library, interprets commands from a user-specified
input file, and outputs responses to a user-specified output file.
A set of useful scripts involving the Driver Task is also provided. For example, you
can use the iccprt script to generate reports for any block in a given station. The
source code is supplied to serve as an example of programming with the API driver
task.
1
B0193NE – Rev F 1. Theory of Operation
♦ Automatically creates the required entries in the databases for a CP or library vol-
ume when it detects that a particular session is the initial access of a CP or library
volume.
♦ Supports all current block types, including sequence and PLB blocks.
♦ Checks compound and block parameter names supplied by the user for validity. It
also checks parameter values to the extent that the Configurator does (for example,
it checks that values that are supposed to be numbers contain only numeric char-
acters and values that are supposed to be connections actually look like
connections). Further checking is left to the CP, since the information and logic
needed to perform such checking are in the CP.
♦ Supports manipulation of CPs hosted by the station on which the ICCAPI is run-
ning and of CPs hosted by remote stations.
♦ Does not limit the number of compounds and blocks that can be configured for a
CP or a volume. It is up to the user to keep track of CP resources and to limit
compounds and blocks so as not to overrun those resources.
♦ All function calls to the ICCAPI (except ICCchkpt()) are synchronous and do not
return to the caller until the operation either completes or fails.
♦ Supports several levels of security for a session. These vary from a strictly read-only
level that disallows any changes, to a fully enabled level that allows all operations
supported by the ICCAPI.
♦ Supports a checkpoint file lock override function. Since the ICCAPI Function
Library is used during application development, it is possible that a task using the
library exits without closing a session, leaving the checkpoint file locked.
♦ Supports saving to and loading from disk directories and other mounted devices,
but does not have built-in device mount or device formatting support, nor does it
support saving or loading more than one compound per function call. The caller
must ensure that the storage device is mounted and contains a valid file system
before calling the ICCAPI save/load functions. If more than one compound is to
be saved or loaded, the caller must repeatedly call the appropriate ICCAPI func-
tion. If an error is encountered while loading a compound and its blocks, the
compound is deleted.
♦ Uses the I/A Series err_rpt() facility to report significant events such as checkpoint
file lock overrides to the System Monitor.
♦ The function library and the include files in it are ANSI compliant. All function
names begin with the letters “ICC”, and all constants begin with the letters “ICC”.
♦ All log messages generated by the ICCAPI are formatted with machine readability
(for example, grep) in mind.
♦ The ICCAPI uses the PDEF data from the AP that hosts the CP or volume being
accessed. There is no guarantee that the PDEF data on a given AP matches that on
any other AP, although usually they match.
♦ Connectable parameters may be configured with shared variable names and Bool-
ean parameters.
2
1. Theory of Operation B0193NE – Rev F
External Interface
The ICCAPI interfaces with the following:
♦ Any task that links in the library and calls its functions. A task using the ICCAPI
interfaces with the ICCAPI library using function calls (described later in this doc-
ument) or with the ICCAPI Driver Task using command and response files.
♦ Software Processing. The ICCAPI uses Software Processing routines to obtain sys-
tem configuration information pertinent to configuration operations, and to lock
and unlock the checkpoint file.
♦ Software Manager. The ICCAPI communicates with the Software Manager to per-
form checkpoints of CP databases.
♦ Compound Summary Access (CSA). The ICCAPI uses CSA library calls to deter-
mine whether specific compound and block names exist in the system.
♦ The CP being manipulated. All modifications to the CP database are sent to the
CP DB Installer through IPC messages.
♦ The I/A Series error reporter (err_rpt()). The ICCAPI calls the err_rpt() function
to report significant events to the System Monitor.
♦ Driver Task Input and Output Files. The ICCAPI Driver Task interfaces with the
ICCAPI function library and with its input and output files. Once started, the
Driver Task reads its input command file and interprets the commands it finds
there. It writes any output to its output files.
External Interface 3
B0193NE – Rev F 1. Theory of Operation
HOST AP or AW
Upload from
control station
pdef/olist via Upload task
upon request by
ICC and ICCAPI
Work file
Checkpoint file
Checkpoint occurs
via Software Manager
upon request by
ICC and ICCAPI
CSA, a task running on the I/A Series system, guarantees compound name uniqueness
throughout the system. CSA is updated with the block names for each configured compound.
The work file is created for each control station and volume by the ICC and ICCAPI. It con-
tains all blocks and compounds configured for the station together with the associated param-
eter values.
The ICC and ICCAPI send the blocks and compounds, together with their configurable
parameter values, to the memory in the control station. All block parameters, both the config-
urable and the non-configurable, are stored there.
Principles of Operation
ICCAPI Function Library
Session-Based Operation
Operation of the ICCAPI is based on the concept of a session. Only one CP or library volume
can be accessed during each session. There are specific functions in the ICCAPI to open and
close each session.
A task using the ICCAPI function library may conduct several sessions during each execution
of the task, as long as the sessions are sequential. The ICCAPI does not support more than
one simultaneous session per instance.
4
1. Theory of Operation B0193NE – Rev F
The session open function ensures sole access to a given CP or library volume by locking the
checkpoint file.
During each session, several operations (transactions) may take place, such as showing the
parameters of a compound or block, adding or deleting a block, and so on.
On session close, the ICCAPI performs all necessary processing, including disconnecting
from the CP and unlocking the checkpoint file (no checkpoint is performed if no changes
have been made).
A task using the ICCAPI may exit prematurely, leaving a CP checkpoint file locked, prevent-
ing subsequent access to the CP. For this reason, the ICCAPI allows a lock override operation.
Transactions
The following transactions or operations are supported during an ICCAPI session:
1. Obtain various lists, including the following:
a. Values of all parameters, the standard parameters, or a user-specified subset of
parameters for a single compound or block or for multiple compounds and
blocks
b. Default parameters for a specified block type
c. All the CPs or library volumes in the system:
All the blocks in a specified compound
All the compounds in a CP or library volume
2. Add a compound or block.
3. Delete a compound or block.
4. Copy a block from any CP or library volume in the system.
5. Modify one or more parameters of a compound or block.
6. Checkpoint the CP database.
7. Move a compound within the CP or a block within a compound.
8. Optimize the storage of the workfile.
9. Save a compound to a file in SAVEALL format.
10. Load a compound from a file in SAVEALL format.
11. Initialize the database for a CP or library volume.
12. Upload the database from a CP: a single block, a single compound, or all com-
pounds may be uploaded.
The function calls and Driver Task commands for each of these transaction types are
described later in this document.
Principles of Operation 5
B0193NE – Rev F 1. Theory of Operation
Security Levels
The ICCAPI supports several levels of security for a given session. The desired security level is
specified when the session is opened. The ICCAPI provides no facilities for determining
whether a caller should be able to use a given security level – that is the caller’s responsibility.
The following list shows the security levels:
ICC_SEC_READONLY — read only: no operations that change anything are
allowed.
ICC_SEC_CHKPT — allows operations allowed by ICC_SEC_READONLY and
checkpoint operations.
ICC_SEC_UPLOAD — allows operations allowed by ICC_SEC_CHKPT and lets
the caller perform an upload command.
ICC_SEC_MODIFY — allows operations allowed by ICC_SEC_UPLOAD and lets
the caller modify the parameters of existing compounds and blocks.
ICC_SEC_ALL — allows all ICCAPI operations.
Logging
The ICCAPI has facilities for printing supplementary information about its operations to
file(s). The information is useful in debugging applications using the ICCAPI. Log messages
can be sent to two locations:
♦ Significant events are logged to the System Monitor using the err_rpt() facility.
Events include opening and closing non-read-only sessions, lock overrides, and so
on.
♦ Several levels of logging can be enabled and sent to a file or stream specified by the
calling task.
When the ICCAPI library is initialized, its log file is stderr, and error message logging is dis-
abled.
6
1. Theory of Operation B0193NE – Rev F
The above conventions mean that the caller must provide an array large enough to hold all the
requested parameters for one compound or block.
Database Creation
At session open time, the ICCAPI performs database existence and content verification check-
ing. If it determines that the database disk directory or files do not exist or are incorrect, it cre-
ates a directory and files, as appropriate. The processing is similar to that performed by the
Control Configurator.
The following is the minimum database set:
1. A subdirectory with the name of the CP/volume (/opt/fox/ciocfg/cpname for the
50 series).
2. A workfile with the name of the CP/volume and the extension .wf (cpname.wf).
Principles of Operation 7
B0193NE – Rev F 1. Theory of Operation
3. A compound index O_LIST file with the name of the CP/volume and the exten-
sion .O (cpname.O).
4. A compound with the name of the CP/volume and the string “_ECB” appended
(cpname_ECB or cpname_VECB for a volume) and a block index O_LIST file
for that compound (cpname_ECB_O).
5. A block in the cpname_ECB or cpname_VECB compound with the type ECBP
and the name PRIMARY_ECB.
6. A compound with the name of the CP/volume and the string “_STA” appended
(cpname_STA or cpname_VSTA for a volume) and its block index file
(cpname_STA.O). This compound is placed in front of the cpname_ECB com-
pound.
7. A block in the cpname_STA compound with the type STA and the name
STATION.
Block Order
The ICCAPI checks for valid block ordering when adding, moving, or copying a block.
Each block list is divided into four zones, which must appear in the following order:
1. ECB zone – contains only (and all) ECB blocks. The end of the ECB zone is spec-
ified as -END_ECB_ZONE.
2. CONT1 zone – can contain non-ECB and non-sequence blocks. The end of the
CONT1 zone is specified as -END_CONT1_ZONE.
3. SEQ zone – can contain sequence blocks. The end of the SEQ zone is specified as
-END_SEQ_ZONE. Three sub-zones are enforced within it:
8
1. Theory of Operation B0193NE – Rev F
Error Handling
All ICCAPI functions return zero if no error is detected.
When an error is detected, an ICCAPI function returns a non-zero error class. In addition,
the ICCAPI saves an error number and some associated error text for the lowest level mean-
ingful error. This error number and text can be retrieved by calling the ICCerr() function any
time before the next ICCAPI function is called (exclusive of ICCerr(), of course). In other
words, as soon as the ICCAPI saves an error number and text, that information is latched
until the next ICCAPI public function (except ICCerr()) is called.
In addition, if the ICC_LOG_ERRORS option is set, whenever any ICCAPI function detects
an error, either in its own processing or as an error return from another function, it logs infor-
mation to the ICCAPI log file.
Data Structures
Data Structures used in Function Interface
Parameter Values
Parameter values are passed between the ICCAPI and its callers using an array of strings, each
of which has length ICC_PARAM_LENGTH. For convenience, each string can be defined
using the ICC_PARAM_ITEM data type:
typedef struct icc_param_item
{
char text[ICC_PARAM_LENGTH];
} ICC_PARAM_ITEM;
A typical array, large enough to hold 100 parameters, can be defined as follows:
ICC_PARAM_ITEM param_array[100];
Data Structures 9
B0193NE – Rev F 1. Theory of Operation
10
1. Theory of Operation B0193NE – Rev F
ICC_CONNECTION
array indicates whether the parameter is an array parameter.
connection_type indicates whether the parameter defines a connection for the block
type, and, if so, what type of connection it is:
ICC_CONN_NOT_SET
ICC_CONN_NO_CONNECT
ICC_CONN_OUTPUT
ICC_CONN_INPUT
disp_control indicates whether the parameter is displayable and/or editable:
ICC_DISP_DISPLAY
ICC_DISP_NOT_EDIT
ICC_DISP_NOT_DISPLAY
disp_option indicates whether the parameter is a standard parameter:
ICC_DISPOPT_STD
ICC_DISPOPT_OPT
Each default parameter passed uses one ICC_DEFAULT_ITEM. When multiple parameters
are passed, an array of ICC_PARAM_ITEMs is passed. The memory used is always supplied
by the caller.
Driver Task
Overview
The Driver Task reads commands, by default, from stdin, and writes its output, by default, to
stderr and stdout.
A program using the Driver Task can read the Driver Task’s output and send the Driver Task
more commands during a session, based on the output generated previously during that same
session. To make this possible, the Driver Task is not terminated when it encounters the end
of file condition on the input stream. Instead, it starts a timeout period, during which it waits
for more commands in the input stream. If the Driver Task encounters the EXIT command
in the input stream, if the timeout period expires, or if the Driver Task detects a UNIX signal
that indicates it is about to be terminated, the Driver Task closes the current session and exits.
The default value for the Driver Task input timeout is infinity (indicated by a value of zero). A
Driver Task command allows setting the timeout value to a different number as defined later
in this document.
Driver Task 11
B0193NE – Rev F 1. Theory of Operation
text editor such as vi. The commands and responses are designed to make creation and inter-
pretation as simple as possible.
By default, the Driver Task takes its input from the stdin stream. This can be altered using
normal UNIX redirection conventions or with the -i command line parameter, described later
in this document.
Driver Task output is divided into two categories: data and command. Data output refers to
data obtained through one of the commands that returns lists of data (for example, block
parameters), while command output refers to all other types of output, including success and
failure notifications and error messages.
The command output normally goes to the stderr stream; the data output normally goes to
the stdout stream. These can be altered using UNIX redirection or the -o and -d command
line parameters, described later in this document.
12
1. Theory of Operation B0193NE – Rev F
Driver Task 13
B0193NE – Rev F 1. Theory of Operation
14
2. ICCAPI Function Calls
This section contains information on ICCAPI function calls including general
conventions, CSA functions and ICCAPI functions.
A task using the ICCAPI library must be written so it accesses one CP or library volume at a
time. Each session must be started by a call to ICCopen(). The session can consist of one or
more session-oriented calls, and should be terminated with a call to ICCclose().
General Conventions
Compound/Block Name
The following conventions apply to the functions that require a compound or block name:
1. A string without a colon (:) character is assumed to be the name of a compound.
2. A string with a colon (:) in any position except first and last is assumed to be a
compound:block name.
3. A string with a colon (:) in the first position is assumed to be a block name in the
most recently mentioned compound.
4. A string with a colon (:) in the last position or with multiple colons is invalid.
15
B0193NE – Rev F 2. ICCAPI Function Calls
3. The caller may specify no block position. The ICCAPI inserts the block at an
appropriate default position, as follows:
♦ An ECB block is inserted at the end of the ECB zone.
♦ A non-sequence, non-ECB, block is inserted at the end of the CONT1 zone.
♦ A sequence block is inserted at the end of the appropriate sequence block sub-
zone, according to its type.
♦ A data block is inserted at the end of the DATA zone.
CSA Functions
The following CSA functions return information about compounds and blocks:
CSlblk() – returns a list of the blocks in a specified compound.
CSlcmpd() – returns a list of compounds.
CSblkdef() – returns a list of parameter names for a block type.
CSgetblk() – returns the location and type of a block.
CSgetcmpd() – returns the location of a compound and the number of blocks it has.
ICCAPI Functions
Examples of how to use the ICCAPI functions are located in /opt/fox/ciocfg/api/examples
for Model 50/51 workstations and in /usr/fox/ciocfg/api/examples for AP20 and PW sta-
tions.
16
2. ICCAPI Function Calls B0193NE – Rev F
ICCAPI Functions 17
B0193NE – Rev F 2. ICCAPI Function Calls
SECURITY LEVEL
Not applicable with respect to ability to execute function.
ARGUMENTS None
SECURITY LEVEL
Not required.
18
2. ICCAPI Function Calls B0193NE – Rev F
2. char *user_id
A pointer to a null terminated string that contains text that identifies
the ICCAPI user. This string may not be empty. The first 64 characters
are included with the message sent to the System Error Reporter.
SECURITY LEVEL
Not applicable.
FUNCTION int ICCget(char *name, char *type, int request, char *position,
ICC_PARAM_ITEM *item, int maxlen, int *count, int zones)
ICCAPI Functions 19
B0193NE – Rev F 2. ICCAPI Function Calls
20
2. ICCAPI Function Calls B0193NE – Rev F
returns an error code. In this case, the caller must supply a larger array
to obtain the complete set of desired parameters.
If the ICCAPI is returning the parameters for several compounds
and/or blocks, it places as many complete sets of parameters into the
array as will fit, and does not place a partial set at the end of the array.
Each returned parameter consists of a string like “param = value”.
the name of the compound or block: “name = value” and is followed by
an “END”. If the parameters are for a block, the name line includes the
compound name to which the block belongs.
If ICC_PARAMS_SUBSET is specified and the first entry in the
item[] array has a zero in its first byte, ICCget() returns only the name
of each matching compound or block, and does not return the string
“END”. Thus each returned compound or block uses only one item[]
array entry.
6. int maxlen - input
The number of text strings (array entries) in the structure pointed to by
the item argument.
7. int *count - output
A pointer to an integer variable. On output, the variable is set to the
number of ICC_PARAM_ITEMs filled in.
8. int zones - input
This parameter is used for the I/A Series release 4.0 level product. It
specifies whether the ICCget() function should include block end zone
markers between blocks when appropriate. For the markers to be
included, this argument must be set to 1 and the “name” argument
must be of the form “CPD:*”, where “CPD” is the name of a com-
pound.
This argument is ignored by ICCget() for the release 3.x level product.
SECURITY LEVEL
Allowed for all security levels.
ICCAPI Functions 21
B0193NE – Rev F 2. ICCAPI Function Calls
22
2. ICCAPI Function Calls B0193NE – Rev F
SECURITY LEVEL
Allowed for all security levels.
SECURITY LEVEL
Allowed for all security levels.
ICCAPI Functions 23
B0193NE – Rev F 2. ICCAPI Function Calls
SECURITY LEVEL
Allowed only for the ICC_SEC_ALL security level.
24
2. ICCAPI Function Calls B0193NE – Rev F
with extensions of “.a,” “.b,” “.f,” “.g,” “.h,” “.i,” “.k,” and “.r” must
exist.
For example, if the directory /tmp contains the files
sequence.s
sequence.r
sequence.i
the argument should be /tmp/sequence.
SECURITY Allowed only for the ICC_SEC_MODIFY security level and above.
ICCAPI Functions 25
B0193NE – Rev F 2. ICCAPI Function Calls
SECURITY Allowed only for the ICC_SEC_MODIFY security level and above.
26
2. ICCAPI Function Calls B0193NE – Rev F
SECURITY LEVEL
Allowed only for the ICC_SEC_ALL security level.
ICCAPI Functions 27
B0193NE – Rev F 2. ICCAPI Function Calls
SECURITY LEVEL
Allowed only for the ICC_SEC_MODIFY security level and above.
28
2. ICCAPI Function Calls B0193NE – Rev F
SECURITY LEVEL
Allowed only for the ICC_SEC_ALL security level.
SECURITY LEVEL
Allowed only for the ICC_SEC_ALL level.
ICCAPI Functions 29
B0193NE – Rev F 2. ICCAPI Function Calls
SECURITY LEVEL
Allowed only for the ICC_SEC_ALL security level.
30
2. ICCAPI Function Calls B0193NE – Rev F
SECURITY LEVEL
Allowed for the ICC_SEC_UPLOAD security level and above.
SECURITY LEVEL
Allowed for the ICC_SEC_CHKPT security level and above.
ARGUMENTS None
ICCAPI Functions 31
B0193NE – Rev F 2. ICCAPI Function Calls
SECURITY LEVEL
Allowed for the ICC_SEC_MODIFY security level and above.
SECURITY LEVEL
Allowed for all security levels.
32
2. ICCAPI Function Calls B0193NE – Rev F
SECURITY LEVEL
Allowed only for the ICC_SEC_ALL security level.
ICCAPI Functions 33
B0193NE – Rev F 2. ICCAPI Function Calls
SECURITY LEVEL
No security level checking is performed for this function call.
34
2. ICCAPI Function Calls B0193NE – Rev F
ARGUMENTS None
SECURITY LEVEL
No security level checking is performed for this function call.
ERRORS None
SECURITY LEVEL
No security level checking is performed for this call.
ICCAPI Functions 35
B0193NE – Rev F 2. ICCAPI Function Calls
SECURITY LEVEL
No security level checking is performed for this call.
SECURITY LEVEL
No security level checking is performed for this function call.
36
3. ICCAPI Driver Task Commands
In this section is information on ICCAPI Driver Task Commands and
descriptions of the commands that can appear in the ICCAPI Driver Task
command file.
The Driver Task is a translation interface that translates ASCII commands to ICCAPI func-
tion calls and parameters, and ICCAPI return values and parameters to ASCII result mes-
sages. Available commands and their arguments reflect the ICCAPI function calls. In
addition, several function calls from other libraries (for example, the CSA library) are sup-
ported by Driver Task commands.
Following are descriptions of the commands that can appear in the ICCAPI Driver Task input
command file. Each command is described using the following structure:
FUNCTION The name of the ICCAPI library function call that supports the com-
mand.
ERRORS Description of the errors that can be detected for the command.
37
B0193NE – Rev F 3. ICCAPI Driver Task Commands
NOTE
When a FLSH response is received from the driver, all commands except
CLOSE, OVERRIDE, and EXIT are illegal, and they will be rejected by the driver
with a FLSH response until the driver receives a CLOSE, OVERRIDE, or EXIT
command.
Data Output
For output lines (generated by the GET, GETDEF and LIST commands), each line is sent to
the data output stream (which defaults to stdout).
The output from one command consists of a header line with the name of the compound or
block, data parameter lines, and a tail line consisting of the word “END”. Each data parame-
ter line consists of the parameter name and the parameter value, separated by the string “=”.
For example:
NAME = BLK4
TYPE = PID
PERIOD = 3
PHASE = 1
MEAS = :BLK3.PNT
FBK = :BLK3.OUT
END
Data Input
For input lines (ADD, MODIFY), each line consists of the parameter name and the parame-
ter value, separated by (at least) “=”. White space (tab or space characters) can appear before
or after the parameter name and the parameter value.
All occurrences of the characters carriage return (13) and control-z (26) are ignored and dis-
carded by the Driver Task. This allows files generated on a DOS system to be handled with-
out having to strip these characters.
When the Driver Task encounters a string of the form “$(var)”, it attempts to replace that
string by the value of “var” in the environment.
When array block parameters are input, each array element input must contain the parameter
name and array index (for example, “PARAM[2]”, not “[2]”).
38
3. ICCAPI Driver Task Commands B0193NE – Rev F
Error Handling
If a command line error is detected, the Driver Task terminates with a non-zero error code
(see Chapter 4 “Using the ICCAPI”).
If an error is detected while executing commands from the command input stream, error han-
dling depends on whether the current input is coming from the original input stream speci-
fied on the command line or from a “called” file.
If the input is coming from a called input file, the Driver Task returns immediately to the call-
ing file, ignoring any subsequent commands in the called file.
If the input is coming from the original input stream, the Driver Task attempts to find the
next command. For commands with parameter lists, it ignores lines until an “END” or an
“EXIT” is found or the end of the input stream is reached, whichever comes first. If the erro-
neous command is an OPEN command, the Driver Task ignores lines until the matching
CLOSE is found or the end of the input stream is reached, whichever comes first.
OPEN Command
This command is required to open an ICCAPI session. It uses the ICCopen() function.
FUNCTION ICCopen()
ARGUMENTS 1. cpname
The CP letterbug or the library volume name to be accessed during the
session.
2. { READ | CHKPT | UPLOAD | MODIFY | ALL }
The second argument specifies the security level for the session.
3. user_id_string
User identification string, with maximum length of 256 characters. If
blanks are included, it must be surrounded by double quote characters
(").
NOTES If a session is already open with the target volume or control station, an
error message is displayed. At this point, the only valid commands are
CLOSE, OVERRIDE, and EXIT. Other commands are flushed
(FLSH).
OVERRIDE Command
Unlocks the checkpoint file for the specified CP or volume. It uses the ICCoverride() func-
tion.
FUNCTION ICCoverride()
ARGUMENTS 1. cpname
The CP letterbug or library volume name for which the checkpoint file
should be unlocked.
2. user_id_string
User identification string, with maximum length of 256 characters. If
blanks are included, it must be surrounded by double quote characters
(").
40
3. ICCAPI Driver Task Commands B0193NE – Rev F
CLOSE Command
Closes the current session. It uses the ICCclose() function. Another session may be opened
after closing the current session.
FUNCTION ICCclose()
SYNTAX CLOSE
ARGUMENTS None
GET Command
Lists the parameter values for an existing compound or block to the Driver Task data output
stream. It uses the ICCget() function.
FUNCTION ICCget()
EXAMPLES The following examples illustrate conventions for the GET command:
GET APICMP1 ALL
Get the entire set of parameters for compound APICMP1.
GET APICMP1 STD
Get the standard set of parameters for compound APICMP1.
CLOSE Command 41
B0193NE – Rev F 3. ICCAPI Driver Task Commands
OUTPUT The output for this command always starts with the NAME and TYPE
lines and always ends with the END line. Other parameters requested
are shown following the TYPE line.
NAME = name_value
TYPE = type_value
... (other parameters)
END
GETORDER Command
Lists the compounds of the CP or the blocks of a specified compound in actual processing
order (as opposed to alphabetical order, as shown by the LIST command).
FUNCTION ICCget()
42
3. ICCAPI Driver Task Commands B0193NE – Rev F
ARGUMENTS [ compound ]
If present, this argument specifies the compound for which the list of
blocks is requested.
If absent, just the list of compounds for the opened CP/volume is
returned.
EXAMPLES GETORDER
List all compounds in opened CP/volume.
GETORDER APICMPI
List all blocks in Compound APICMP1.
GETSEQ Command
Lists the sequence code or returns the sequence code files for the specified block (if the block
is a sequence type block).
FUNCTION ICCseqget()
ARGUMENTS 1. Compound_Block
Specifies the name of the block for which the sequence code is
requested.
2. base_path_name
Specifies the disk directory and base file name to be used by the Driver
Task to return the sequence code files. For non SFC/ST sequence
blocks the three code files (.s, .i, and .r) are copied to the specified
directory under the specified file name. For SFC/ST sequence blocks
GETSEQ Command 43
B0193NE – Rev F 3. ICCAPI Driver Task Commands
the eight files (.a, .b, .f, .g, .h, .i, .k, and .r) are copied to the specified
directory under the specified name.
GETDEF Command
This command lists the default parameters for a compound or a specified block type to the
Driver Task data output stream. It uses the ICCgetdef() function.
FUNCTION ICCgetdef()
ARGUMENTS type
Specifies the entity for which default values are requested. It can have
the value “COMPND”, in which case the default parameters for a
compound are listed, or it can be a block type (e.g. “PID”).
OUTPUT The output for this command always starts with the TYPE line and
ends with the END line. For each parameter defined for the compound
or the block type, a line is generated that contains the parameter name,
its default value, its data type, its connection type, its access control
value and its option value.
Although the following example shows the line split over two lines, the
Driver Task outputs all of the data for each parameter on a single line.
type
name = default_value TYPE= data_type CONN= conn_type
CTL= ctl_val OPT= opt_val ARY= ary_val
END
where:
name = the name of the parameter
default_value = the default value of the parameter - it may be blank
data_type = the data type of the parameter, as follows:
44
3. ICCAPI Driver Task Commands B0193NE – Rev F
1 - character
2 - integer
3 - floating point
4 - character string
5 - boolean (values 0 or 1)
6 - long integer (32 bits)
7 - processing period
8 - short integer (16 bits)
9 - packed boolean (16 bits)
10 - packed long boolean (32 bits)
11 - character array
12 - integer array
13 - floating point array
15 - boolean array
16 - long integer array
18 - short integer array
conn_type = the connection type of the parameter, as follows:
1 - not settable
2 - not connectable
3 - output connection
4 - input connection
ctl_val = the display control value of the parameter, as follows:
0 - editable
1 - not editable
opt_val = the display option value of the parameter, as follows:
0 - standard parameter
1 - optional parameter
ary_val = whether the parameter is an array parameter, as follows:
0 - not an array
n - an array with “n” entries
LIST Command
Provides access to various lists that the Driver Task user may find useful. Since the various
classes of requests differ in format and output, they are described in the following sections.
No current session is required for any of the LIST commands.
LIST Command 45
B0193NE – Rev F 3. ICCAPI Driver Task Commands
ARGUMENTS 1. [cpname!]
This optional argument specifies that the list of compounds or blocks
should be limited to stations whose names match “cpname”. The wild
characters “*” and “?” are allowed in this argument.
2. cpd
This argument specifies which compounds should be included in the
list. Wild characters (*/?) are allowed in this argument.
3. [:blk]
This optional argument specifies which blocks should be included in
the list. Wild characters (*/?) are allowed in this argument. If this argu-
ment is absent, only compounds are listed. If it is present, only blocks
are listed.
46
3. ICCAPI Driver Task Commands B0193NE – Rev F
station type.
Unable to get commands/blocks from CSA.
EXAMPLES
LIST -CPS #All CPS
LIST -CPS CP #CP10 Types
LIST -CPS C30 #CP30 Types
LIST -Volumes #All Volumes
LIST Command 47
B0193NE – Rev F 3. ICCAPI Driver Task Commands
ARGUMENTS None
ARGUMENTS [stn_type]
Specifies the type of station for which the block types are requested. If
absent, all known block types are listed. Use the types from the LIST -
STATIONS command.
ADD Command
Adds the specified compound or block, along with the supplied parameters.
FUNCTION ICCadd()
48
3. ICCAPI Driver Task Commands B0193NE – Rev F
3. data lines
These lines specify the values of the parameters for the compound or
block, one per input line. The format of a data line is specified previ-
ously in this document.
NOTES The four main zones are Continuous Zone 1, Sequence Zone 1, Con-
tinuous Zone 2, and Data Zone. To insert blocks at the end of these
zones, use -END_CONT1_ZONE, -END_CONT2_ZONE,
-END_SEQ_ZONE, and -END_DATA_ZONE.
CMPLSEQ Command
Runs the sequence code compiler on the non SFC/ST sequence code file (.s). CMPLSEQ
cannot be used to compile SFC/ST sequence code. The SFC/ST compiler is used to generate
native High Level Batch Language (HLBL) code.
FUNCTION ICCseqcmpl()
ARGUMENTS 1. sequence_block_type
Specifies the type of block the code should be compiled for. The types
are “IND”, “DEP”, “MON”, or “EXC”.
2. base_path_name
Specifies the name of directory and file that contains the sequence code
to be compiled. This argument is passed to the ICCseqcmpl() func-
CMPLSEQ Command 49
B0193NE – Rev F 3. ICCAPI Driver Task Commands
tion, which appends the “.s” file extension. The files created by the
sequence compiler are left in the specified directory.
PUTSEQ Command
Installs sequence code into the specified block.
It is assumed that the specified disk directory contains .s, .i, and .r files (for non SFC/ST
sequence blocks) or .a, .b, .f, .g, .h, .i, .k, and .r files (for SFC/ST sequence blocks) from a
previous CMPLSEQ command or SFC/ST compile.
FUNCTION ICCseqput()
ARGUMENTS 1. block
Specifies the block for which the sequence code is being supplied.
2. base_path_name
Specifies the directory and file name (less the file extension) where the
sequence code is located. The sequence code will be retrieved from this
directory and attached to the block.
GETPLB Command
Retrieves the ladder file for the specified plb type block.
FUNCTION ICCladget()
50
3. ICCAPI Driver Task Commands B0193NE – Rev F
ARGUMENTS 1. blk_name
Specifies the name of the block that contains the ladder file ( .p).
2. base_path_name
Specifies the disk directory and base file name to be used by the Driver
Task to return the ladder file ( .p ). The ladder file is copied to the spec-
ified directory under the specified file name and extension of .p .
PUTPLB Command
Copies the .p file to the directory specified by the blk_name argument and installs the ladder
file for the FBM associated with the specified blk_name.
It is assumed that the specified disk directory contains the .p file. This .p file may or may not
have been compiled previously by the CMPLPLB command. All segment files ( .p’s ) associ-
ated with the FBM are compiled and if there are no compiler errors, the ladder is installed in
the CP.
FUNCTION ICCladput()
ARGUMENTS 1. blk_name
Specifies the name of the block for which the ladder file ( .p) is being
supplied.
2. base_path_name
Specifies the disk directory and base file name (less the file extension)
where the .p file is located.
PUTPLB Command 51
B0193NE – Rev F 3. ICCAPI Driver Task Commands
CMPLPLB Command
Runs the PLB compiler on the .p file in directory specified by the base_path_name. The
compilation is for error checking only. When a compilation is successful then a PUTPLB
command must be executed to install the ladder into the CP.
FUNCTION ICCladcmpl()
ARGUMENTS base_path_name
Specifies the disk directory and base file name (less the file extension)
where the .p file is located. The files created by the PLB compiler are
left in the specified directory.
DELETE Command
Deletes the specified compound or block.
FUNCTION ICCdelete()
52
3. ICCAPI Driver Task Commands B0193NE – Rev F
MODIFY Command
Modifies the specified compound or block, using the supplied parameters.
FUNCTION ICCmodify()
MOVE Command
Moves the specified compound or block to a new processing order position.
FUNCTION ICCmove()
MODIFY Command 53
B0193NE – Rev F 3. ICCAPI Driver Task Commands
NOTES The four main zones are Continuous Zone 1, Sequence Zone 1, Con-
tinuous Zone 2, and Data Zone. To insert blocks at the end of a zone,
use -END_CONT1_ZONE, -END_SEQ_ZONE,
-END_CONT2_ZONE, or -END_DATA_ZONE.
COPY Command
Creates a new block that has the same parameters as a specified block.
FUNCTION ICCcopy()
ARGUMENTS 1. [dest_cpd]:dest_blk
Specifies the compound to which the block is to be added and the
name the block is to be assigned. If the compound part of the name is
missing, it defaults to the most recently mentioned compound name.
2. [src_cpd]:src_blk
Identifies the block that is to be copied. This block does not have to
reside in the open CP/volume. If the compound part of the name is
missing, it defaults to the most recently mentioned compound name
(which will always be the same as the value being used for “dest_cpd”.
3. [ pos_blk ]
This optional argument specifies the position the block should have.
54
3. ICCAPI Driver Task Commands B0193NE – Rev F
NOTES The four main zones are Continuous Zone 1, Continuous Zone 2,
Sequence Zone 1, and Data Zone. To insert blocks at the end of these
zones, use -END_CONT1_ZONE, -END_CONT2_ZONE,
-END_SEQ_ZONE, or -END_DATA_ZONE.
INITIALIZE Command
Initializes the CP/volume database. It ends the current session, if one is in progress.
FUNCTION ICCinitialize()
ARGUMENTS CPNAME
Specifies the name of the CP or volume to be initialized. This argu-
ment is required if no session is in progress, and is invalid if a session is
in progress.
UPLOAD Command
Uploads a specified portion of the database from the CP. This command causes a warning
message if used on a library volume.
FUNCTION ICCupload()
INITIALIZE Command 55
B0193NE – Rev F 3. ICCAPI Driver Task Commands
EXAMPLES UPLOAD
Upload all compounds and blocks from the currently opened CP.
UPLOAD APICMP1
Upload all parameters for Compound APICMP1.
UPLOAD APICMP1:PLB1
Upload only the parameters for the block PLB1.
CHECKPOINT Command
Performs a CP database checkpoint operation. This command is allowed for a library volume,
although it does not do anything.
FUNCTION ICCchkpt()
ARGUMENTS delay
Specifies how long, in seconds, the ICCchkpt() function should delay
while waiting for the checkpoint operation to complete.
0 — no delay; return immediately
>0 — delay for specified services
<0 — default delay = 240 seconds
SHRINK Command
Optimizes storage in the workfile by performing garbage collection.
FUNCTION ICCshrink()
SYNTAX SHRINK
ARGUMENTS None
56
3. ICCAPI Driver Task Commands B0193NE – Rev F
SAVE Command
Saves the specified compound and all its blocks to the specified file directory.
FUNCTION ICCsave()
ARGUMENTS 1. cpd_name
Specifies the compound to be saved.
2. path
Specifies where to create the compound subdirectory in which to save
the data. It must be a mounted file directory.
3. save_name
Specifies the name to be assigned to the compound subdirectory.
LOAD Command
Loads the specified compound and all its blocks from the specified file directory.
FUNCTION ICCload()
ARGUMENTS 1. newname
Specifies the name the compound is to be assigned in the current
CP/volume.
2. loadname
Specifies which compound should be loaded.
3. path
Specifies the file directory from which the load should take place. It
must be a mounted file directory.
SAVE Command 57
B0193NE – Rev F 3. ICCAPI Driver Task Commands
4. [ position ]
Specifies the position where the compound is to be inserted. This posi-
tion is expressed as an existing compound. The new compound will
immediately precede this compound.
ERRORS None.
TIMEOUT Command
This command is used to specify a new command input timeout value. The value is specified
in seconds. If the value is set to 0 (the default setting), the driver waits indefinitely for input.
If the value is set to -1, then the driver does not wait for input at all (that is, input is already
present in another file).
FUNCTION (none)
ARGUMENTS value
The new value, in seconds, for the timeout. If the argument has a value
of zero, the timeout value is “infinity”. If the argument has a value of -
1, the timeout is disabled (the Driver Task never waits for input).
58
3. ICCAPI Driver Task Commands B0193NE – Rev F
LOGOPEN Command
This function is used to initiate internal API logging to the specified file.
FUNCTION ICClogopen()
ARGUMENTS 1. fname
Specifies the name of the file to open for logging. Unless the append
option is specified, this command deletes any previous file by the spec-
ified name.
2. options
Zero or more of the following option keywords:
ARGS print all arguments to corresponding library function
call
PARAMS_IN print all relevant parameters used by library function
call
PARAMS_OUT print all data gathered by library function call as it is
gathered
ERRORS print all intermediate errors encountered by API
CP_MSGS print the protocol used by the API and the control
station
CSA print all data to/from CSA
WARNINGS print all warnings received from the control station
ERR_RPTS print all messages sent to the error reporter
APPEND append any/all the above data to an existing file
MALLOC print all calloc/free function calls
If more than one of the above keywords is specified, they may be sepa-
rated by one or more space, tab or comma characters.
LOGOPEN Command 59
B0193NE – Rev F 3. ICCAPI Driver Task Commands
LOGCLOSE Command
This function is used to terminate logging to current log file, redirecting log messages back to
stderr. This command is invalid if logging is not currently directed to a file as a result of the
LOGOPEN command.
FUNCTION ICClogclose()
SYNTAX LOGCLOSE
ARGUMENTS None.
LOGSET Command
This function is used to set the logging options for the log file. If the command is used with-
out the LOGOPEN command, all messages are sent to stderr.
FUNCTION ICClogset()
ARGUMENTS options
Zero or more of the option keywords described under the LOGOPEN
command.
ERRORS None.
LOGSTAT Command
This function is used to obtain the current logging options for the current log file, if one is
specified, or for stderr.
FUNCTION ICClogflags()
SYNTAX LOGSTAT
ARGUMENTS None.
60
3. ICCAPI Driver Task Commands B0193NE – Rev F
LOGOPTION Command
Enables or disables the logging of various Driver Task messages to the command output
stream (stdout).
ARGUMENTS If no arguments are present, the current logging options are displayed.
option value
Specifies the option to be set and its value. The string “option” must be
one of “ECHO”, “DONE”, “WARN”, or “FAIL”. The string “value”
must be one of “ON” or “OFF”.
EXAMPLES LOGOPTION
Lists currently active options.
LOGOPTION WARN OFF
Turns logging of WARN messages off.
LOGOPTION WARN ON
Turns logging of WARN messages on.
SHELL Command
This function is used to execute an arbitrary Unix command. The string after the SHELL
command keyword is passed to the Unix system() function.
ARGUMENTS string
OUTPUT The output of the Unix command is sent to stdout and stderr accord-
ing to its usual conventions. The Driver Task redirects stderr to the
command output stream and stdout to the data output stream for the
duration of the system() call.
LOGOPTION Command 61
B0193NE – Rev F 3. ICCAPI Driver Task Commands
CALL Command
Allows temporary redirection of Driver Task input to a specified file. Control returns to the
line after the CALL command when an EXIT command is encountered in the file, when the
end of the file is reached, or when an error is detected while executing a command from the
file.
The input command timeout value is set to -1 (disabled, no waiting) by this command, after
first saving the current value so it can be restored when control returns to the line after the
CALL command.
ARGUMENTS file_name
The name of the file to which control should be transferred.
EXIT Command
Terminates the Driver Task if encountered in the base input command stream, and causes a
“return” to the “calling” file if encountered in a “called” file. The “return” causes the saved
input command timeout value to be restored from the value saved when the “called” file was
entered.
SYNTAX EXIT
62
4. Using the ICCAPI
This section contains information on using the ICCAPI including installation,
initialization, utilities, and operation.
Operation
ICCAPI Function Interface
Using the ICCAPI function interface requires the usual steps of editing source files, compiling
the source files, linking the object files, and running the linked image.
Application Build
The following ICCAPI components are used during the above steps:
iccapi.h A header file that defines constants and data structures used in the
ICCAPI function calls. This file should be included in C source files
that call ICCAPI functions.
libiccapi.so The dynamically linkable library file that contains the ICCAPI func-
tions. This file is linked at runtime to an application task making
ICCAPI function calls.
63
B0193NE – Rev F 4. Using the ICCAPI
Utilities
LOAD_ALL Script
This script lets the user perform a “Load All” operation of a specified control station’s com-
pounds and blocks from a specified location. The location may be specified as a directory on a
mounted file system or as the file system’s device name. Refer to “LOAD_ALL/SAVE_ALL
Recommendations” on page 65 for requirements.
64
4. Using the ICCAPI B0193NE – Rev F
SAVE_ALL Script
This script lets the user perform a “Save All” operation of a specified control station’s com-
pounds and blocks to a specified location. The location may be specified as a directory on a
mounted file system or as the file system’s device name.
At a minimum, this script requires enough free disk space in the $OPT partition of the local
hard drive to hold any one compound at a time, from the specified control station. This
requirement is temporary and will be returned upon completion of the script. After each com-
pound is moved to the final destination, its associated data (stored in $OPT) is removed,
before starting the processing of a new compound. Refer to “LOAD_ALL/SAVE_ALL Rec-
ommendations” on page 65 for requirements.
Usage: save_all [-d] <station> <path>
-d debug mode: do not remove command input file to
driver task.
<station> is the Control Station to be saved.
<path> is the directory (or device) to which the data is to be
saved.
LOAD_ALL/SAVE_ALL Recommendations
The V4.2 release of ICCAPI supports the ability to perform saving and loading of the Inte-
grated Control Configurator (CioCfg) databases via Foxboro supplied shell scripts (load_all,
save_all).
The load_all and save_all shell scripts support reading and writing to local AP/AW hard
drives. A remote AP/AW hard drive can be used. To do so, a user must first rmount the
remote AP/AW prior to running the load_all/save_all shell script.
Foxboro recommends users doing Batch Processing (recipes), using Sequence type blocks:
(IND, DEP, TIM, EXC, MON) should use the load_all/save_all shell scripts and perform
SaveAlls/LoadAlls to/from a hard drive. Due to the size and quantity of Sequence blocks and
Sequence Logic, a compound may not fit onto a floppy diskette. SaveAlls stored onto a hard
drive can then be backed up to tape.
Before using the load_all/save_all shell script, consider the following:
♦ The load_all/save_all shell scripts will check to see if there is enough space on the
AP/AW’s LOCAL hard drive to handle the save_all/load_all files. If a remote hard
drive is used for save_alls, the save_all shell script does NOT check and the user is
required to verify that there is enough space on the remote drive.
♦ If a remote AP/AW is to be used for saving to or loading from, the user is required
to MANUALLY rmount the AP/AW prior to running the load_all/save_all shell
script.
Utilities 65
B0193NE – Rev F 4. Using the ICCAPI
ICCPRT Script
This script lets the user produce a report of:
♦ All parameter names and values of all (or a subset of) compounds and blocks in a
specified station or volume
♦ Compounds within a station
♦ Blocks within a specified compound
Usage: iccprt [-p] [-n compound[:block]] [-o outputfile] <station>
-n compound and/or block list to be reported (wildcards are
valid); default is for all compounds.
-o output file to which report will be redirected; default is to
console.
-p generate report on compound and/or block PARAME-
TERS rather than compound and/or block ORDER.
<station> is the Control Station or volume to be reported.
66
4. Using the ICCAPI B0193NE – Rev F
Examples:
List all blocks in Compound APICMP1 to printer:
iccprt -n APICMP1 C10A50
List all blocks in Compound APICMP1 to a file apicmp1.txt:
iccprt -n APICMP1 -o /tmp/apicmp1.txt C10A50
List all block parameters in Compound APICMP:PLB001 to a file apicmp1.txt:
iccprt -p -n APICMP1:PLB001 -o /tmp/apicmp1.txt C10A50
List all compounds and all blocks to a file apicmp1.txt:
iccprt -n \* -o /tmp/apicmp1.txt C10A50
List all parameters in all compounds and all blocks to a file apicmp1.txt:
iccprt -p -n \* -o /tmp/apicmp1.txt C10A50
Utilities 67
B0193NE – Rev F 4. Using the ICCAPI
68
5. Writing Applications Using the
Driver Task
This section contains information on writing applications using the Driver Task
including replacing iccprt and bldcio with ICCAPI and sample implementation.
The Driver Task forms an ASCII parser shell around the API. It accepts ASCII input com-
mands from the keyboard or from a file and generates two types of output: a data output and
a status output. Outputs are routed to stdout and stderr, both of which are the terminal by
default. The two outputs can be written to separate files.
When using the Driver Task in a UNIX shell script, you must consider three top-level compo-
nents:
1. An input command file used to open a session.
2. An intelligent program that can evaluate results and conditionally generate new
commands based on the output of the driver.
3. A close and exit segment.
NOTE
Parameters can be supplied in any order.
69
B0193NE – Rev F 5. Writing Applications Using the Driver Task
Sample Implementation
Listed below is the implementation of the iccprt involving a UNIX script that contains the
first and third components described above, and an AWK program constituting the second
component. The following example shows the code of both the script and the AWK program
used to generate a report that lists blocks, compounds, and their parameters within a station.
UNIX Script
:
#**************************************************************************
# %W% New System, Foxboro Co. %G%
#**************************************************************************
#
# (C) Copyright by Foxboro Company 1993
# All rights reserved: Foxboro Company 1993
#
#**************************************************************************
#
# FILE ID : iccprt
#
# FUNCTION : This script allows the user to produce a report of:
#
# - all parameter names and values of all (or a subset) of
# compounds and blocks in a specified station or volume
#
# - compounds within a station
#
# - blocks within a specified compound
#
# SYNOPSIS : iccprt [-m num] [-n compound[:block]] [-o outputfile] station
# where : -n compound / block set to report on
# (defaults to ALL parameters of ALL
# compounds and blocks; wildcard
# characters are supported)
# -o file to which parameter data will be
# written
# -p report on compound / block parameters
70
5. Writing Applications Using the Driver Task B0193NE – Rev F
if [ -f /venix ]
then
ICCDRVR=/usr/fox/ciocfg/api/iccdrvr.tsk
AWK=awk
else
ICCDRVR=/opt/fox/ciocfg/api/iccdrvr.tsk
AWK=nawk
fi
###########################################################################
# Function to display command usage and exit
###########################################################################
usage_exit ()
{
echo "Usage: $0 [-p] [-n compound[:block]] [-o outputfile] <station>"
echo " -n print parameters for specified compound(s)"
echo " or block(s); default is for all compounds"
echo " -o output file to which all parameter values will"
echo " be written; default is to /dev/tty"
echo " -p report on compound and/or block parameters"
echo " default report is compound order report"
echo " <station> is the Control Station or volume to be reported"
exit 1
}
###########################################################################
# Check command line for correct number of arguments
###########################################################################
if [ $# -lt 1 ]
then
usage_exit
fi
##########################################################################
Check for option flag in command line
###########################################################################
while [ $# -ge 2 ]
do
case $1 in
-n ) SEARCH_LIST=$2
shift 2;;
-o ) DATA_OUTFILE=$2
shift 2;;
-m ) if [ $2 -gt 3 ]
then
SEARCH_COMMAND=getorder
else
SEARCH_COMMAND=get
fi
shift 2;;
Sample Implementation 71
B0193NE – Rev F 5. Writing Applications Using the Driver Task
-p ) SEARCH_COMMAND=get
shift;;
-h ) echo "Obsolete option: ignored"
shift;;
-s ) echo "Obsolete option: ignored"
shift;;
* ) usage_exit;;
esac
done
###########################################################################
# check for variables; set defaults if needed
###########################################################################
if [ -z "$SEARCH_LIST" ]
then
if [ $SEARCH_COMMAND = "getorder" ]
then
SEARCH_LIST=
else
SEARCH_LIST=\*:\*
fi
fi
###########################################################################
# setup local names for the command line arguments
###########################################################################
STATION=$1
USERNAME=iccprt.‘uname -n‘.$1
IN_FILE=/tmp/input$$
###########################################################################
# output the open command to the IN_FILE, for the driver task to start
###########################################################################
###########################################################################
# invoke the driver task / awk pair of commands
# The driver task continues to execute till it sees exit in IN_FILE.
###########################################################################
RETCODE=$?
###########################################################################
# remove the input file to the driver task
###########################################################################
rm -f ${IN_FILE}*
###########################################################################
exit $RETCODE
AWK Program
#**************************************************************************
72
5. Writing Applications Using the Driver Task B0193NE – Rev F
Sample Implementation 73
B0193NE – Rev F 5. Writing Applications Using the Driver Task
74
Appendix A. Driver Task
Commands — Quick Reference
Command Arguments
OPEN cpname {READ | CHKPT | UPLOAD | MODIFY | ALL } <user_id_string>
OVERRIDE cpname <user id string>
INITIALIZE [cpname]
GET {compound | block } { all | std | subset } [TYPE blktype]
GETORDER [compound]
GETSEQ blk_name base_path_name
PUTSEQ blk_name base_path_name
GETPLB blk_name base_path_name
PUTPLB blk_name base_path_name
GETDEF blk_type
LIST [CPNAME!]cpd[:blk]
LIST { -CPS | -VOLUMES } [ type ]
LIST -STATIONS
LIST -TYPES [stn_type]
ADD { compound | block } [position]
MODIFY { compound | block }
COPY [dest_cpd]:dest_blk [src_cpd]:src_blk [pos_blk]
DELETE { compound | block }
MOVE { compound | block } {position}
CMPLSEQ sequence_block_type base_path_name
CMPLPLB base.path_name
UPLOAD [cpd | cpd:* | cpd:blk]
CHECKPOINT delay_in_seconds
SAVE cpd_name path save_name
LOAD newname loadname path [position]
TIMEOUT value
LOGOPEN file_name { ARGS | PARAMS_IN | PARAMS_OUT | ERRORS | CP_MSGS
| CSA | WARNINGS | ERR_RPTS | APPEND }
LOGSET { ARGS | PARAMS_IN | PARAMS_OUT | ERRORS | CP_MSGS | CSA |
WARNINGS | ERR_RPTS | APPEND }
LOGOPTION [option value] [option value] …
LOGCLOSE
75
B0193NE – Rev F Appendix A. Driver Task Commands — Quick Reference
Command Arguments
SHELL string
CALL file_name
CLOSE
EXIT
76
Index
A
ASCII parser shell 69
B
Bldcio utility 69
Block insertion position 15
Blocks
order 8
special 8
C
Characters
case conversion 7
Command
input timer 39
output 37
output stream 37
Components of the ICCAPI 1
Compound
insertion position 15
Compounds
special 8
Control station 4
CSA functions 16–36
D
Data
structures 9
Database
creation 7
Databases
modifying 1
used by the ICC 1
Default
parameter values 10
DONE operation 37
Driver task 1, 37
command output 37
commands 37–62
Input/Output stream processing 11
77
B0193NE – Rev F Index
syntax 63
E
Error handling 9
Establishing a connection with the CP 1
F
FAIL operation 37
Features of the ICCAPI 1
File
example of input command line 64
Files
pdef/olist 3
Function
return values 16
Function calls
ICCAPI 15
Functions
CSA 16–36
library 1
I
I/O stream processing 11
ICC (Integrated Control and I/O Configurator) 1
ICCAPI
block order 8
characters and case conversion 7
command input stream 12
conventions 15
database creation 7
default parameter names 10
default parameter values 10
driver task Input/Output streams 11
error handling 9
external interface 3
function calls 15
function return values 16
load and save considerations 7
logging 6
operation 4–11
parameter information 10
partial list processing 6
security levels 6
special compounds and blocks 8
transactions 5
78
Index B0193NE – Rev F
ICCPRT script 65
Iccprt utility 69
Input command file
example 64
Input file sample 70
Insertion position
compound and block 15
L
Library of functions 1
List processing 6
Load
considerations 7
LOAD_ALL script 64
Locking the checkpoint file 1
Logging 6
O
"olist" files 3
P
Parameter information 10
Parameter values
function interface 9
Parser
ASCII shell 69
"pdef" files 3
Preparing input files to the driver task 69
S
Save
considerations 7
SAVE_ALL script 65
Scripts
ICCPRT 65
LOAD_ALL 64
SAVE_ALL 65
UNIX shell 69
UNIX shell - example 70–73
Security 6
Session 4
Stream processing
I/O 11
String
79
B0193NE – Rev F Index
“$(var)” 38
Syntax
driver task 63
T
Task command output response
DONE 37
FAIL 37
Timer
command input 39
U
UNIX shell script 69
Utilities 64
ICCPRT script 65
LOAD_ALL script 64
SAVE_ALL Script 65
W
Work file 4