Cobol 74 Vol2
Cobol 74 Vol2
Cobol 74 Vol2
Announcement
o New Release • Revision o Update o New Mail Code
Title
This announces a retitling and reissue of the ClearPath HMP NX and A Series COBOL ANSI-74 Programming
Reference Manual Volume 2: Product Interfaces. No new technical changes have been introduced since the
HMP 1.0 and SSR 43.2, release in June 1996.
COBOL ANSI-74
Programming
Reference Manual
Volume 2
Product Interfaces
Printed in USA
Priced Item 8600 0130–302
The names, places, and/or events used in this publication are not intended to correspond to any
individual, group, or association existing, living, or otherwise. Any similarity or likeness of the names,
places, and/or events with the names of any individual, living or otherwise, or that of any group or
association is purely coincidental and unintentional.
NO WARRANTIES OF ANY NATURE ARE EXTENDED BY THIS DOCUMENT. Any product or related
information described herein is only furnished pursuant and subject to the terms and conditions of a
duly executed agreement to purchase or lease equipment or to license software. The only warranties
made by Unisys, if any, with respect to the products described in this document are set forth in such
agreement. Unisys cannot accept any financial or other responsibility that may be the result of your
use of the information in this document or software material, including direct, special, or consequential
damages.
You should be very careful to ensure that the use of this information and/or software material complies
with the laws, rules, and regulations of the jurisdictions with respect to which it is used.
The information contained herein is subject to change without notice. Revisions may be issued to
advise of such changes and/or additions.
Correspondence regarding this publication should be forwarded to Unisys Corporation either by using
the Business Reply Mail form at the back of this document or by addressing remarks to Software
Product Information, Unisys Corporation, 25725 Jeronimo Road, Mission Viejo, CA 92691–2792
U.S.A.
iv 8600 0130–302
Contents
8600 0130–302 v
Contents
vi 8600 0130–302
Contents
Index ............................................................................................................. 1
8600 0130–302 ix
Contents
x 8600 0130–302
Tables
3–1. COMS Data Types and COBOL74 Usage ................................................. 3–6
3–2. Input Header Fields ................................................................................ 3–7
3–3. Output Header Fields ............................................................................. 3–9
3–4. Transmission Indicators for Identifier-1 .................................................... 3–24
3–5. Service Function Mnemonics .................................................................. 3–27
8600 0130–302 xi
Tables
7–1. SDF Plus Program with a Remote File Interface ........................................ 7–30
7–2. Using SDF Plus with a COMS Interface .................................................... 7–33
Purpose
This manual is the second volume of a two-volume reference set. While the COBOL ANSI-
74 Programming Reference Manual, Volume 1: Basic Implementation provides the
syntax and general usage of COBOL74, the COBOL ANSI-74 Programming Reference
Manual, Volume 2: Product Interfaces contains information on using COBOL74 to write
application programs that interface with the following products
Scope
For each product, Volume 2 presents information on
This implementation of standard COBOL74 is based on, and compatible with, the
American National Standard, X3.23-1974.
8600 0130–302 xv
About This Reference Manual
COBOL is an industry language and is not the property of any company or group of
companies, or of any organization or group of organizations.
The authors and copyright holders of the copyrighted material used herein have
specifically authorized the use of this material, in whole or in part, in the COBOL
specifications. These authors or copyright holders are the following:
• FLOW-MATIC, programming for the UNIVAC I and II, Data Automation Systems,
copyrighted in 1958, by Sperry Rand Corporation
• IBM Commercial Translator, form No. F 28-8013, copyrighted in 1959 by the
International Business Machines Corporation
• FACT, DSI 27 A5260-2760, copyrighted in 1960 by Minneapolis-Honeywell
Such authorization extends to the reproduction and use of COBOL specifications in
programming manuals or similar publications.
Audience
The information in this manual is intended for application programmers who are
programming in COBOL74 and require the capabilities of one or more products.
Prerequisites
To use this manual, you should be familiar with COBOL74, the product or products being
used, and the programming concepts for the products.
This manual is structured so that you only need to look at the sections that apply to your
needs. The first section summarizes the extensions used with each product. After this
introductory section, a separate section is provided for each product. This volume
contains information that complements Volume 1 and the manuals that describe the
interfaced products. For a discussion of those products, refer to the documentation for
each product. A list of this documentation is provided in “Related Product Information”
later in this preface. For the usage of COBOL74 not specific to the products in this volume,
refer to Volume 1.
Many of the discussions in this volume use COBOL74 code to illustrate an aspect of a
product interface. Most examples do not include line numbers; it is assumed that the first
character of a line of source code is located in the appropriate column. Complete program
examples have line numbers to provide continuity for programs that span several pages.
Acronyms are spelled out the first time they occur in the manual.
The syntax for the language extensions is described in COBOL notation; for a complete
explanation of COBOL format notation, refer to Volume 1.
Organization
This volume is organized into nine sections. The first section is an introduction to program
interfaces, and each subsequent section describes a program interface for a specific
product. Appendixes are included to provide related information. An index is provided at
the end of the volume. A brief description of the contents of the manual follows.
The following documents are included with the software release documentation and
provide general reference information:
• The Glossary includes definitions of terms used in this document.
• The Documentation Road Map is a pictorial representation of the Product
Information (PI) library. You follow paths through the road map based on tasks you
want to perform. The paths lead to the documents you need for those tasks. The Road
Map is available on the PI Library CD-ROM. If you know what you want to do, but
don't know where to find the information, start with the Documentation Road Map.
• The Information Availability List (IAL) lists all user documents, online help, and
HTML files in the library. The list is sorted by title and by part number.
The following documents provide information that is directly related to the primary
subject of this publication.
Screen Design Facility Plus (SDF Plus) Installation and Operations Guide
This guide explains how to use SDF Plus to create and maintain a user interface. It gives
specific instructions for installing SDF Plus, using the SDF Plus forms, and installing and
running a user interface created with SDF Plus.
xx 8600 0130–302
Section 1
Introduction to COBOL74 Program
Interfaces
COBOL74 program interfaces have been developed for each of the following products:
general extensions might appear in this volume to provide context and to illustrate their
use with specific products.
The following information briefly describes the extensions used only with specific
products. The extensions for each product are presented alphabetically. Detailed
discussions of the extensions are provided in the appropriate sections of this volume.
ADDS Extensions
The following extensions have been developed for the ADDS interface. Detailed
information on the extensions is provided in Section 2, “Using the ADDS Program
Interface.”
Extension Explanation
DIRECTORY clause Uniquely identifies an entity in the data dictionary when used
with an entity name and optional version number.
File description (FD) Provides information about the physical structure and record
names of a file.
INVOKE ALL clause Invokes the entire structure, including record descriptions of a
specified file from the dictionary.
VERSION clause Uniquely identifies an entity in the dictionary when used with an
entity name and optional directory.
COMS Extensions
The following extensions have been developed for the COMS interface. Detailed
information on the extensions is provided in Section 3, “Using the COMS Program
Interface.”
Extension Explanation
COMS header declaration Provides information about the message for input or output.
ENABLE statement Initializes the interface between COMS and a program, and
opens a COMS direct window to a station not currently
attached to COMS.
DMSII Extensions
The following extensions have been developed for the DMSII interface. Detailed
information on each extension is provided in Section 4, “Using the DMSII Program
Interface.”
Extension Explanation
ASSIGN statement Establishes the relationship between a record in a data set and
a record in the same or another data set.
Extension Explanation
CREATE statement Initializes the user work area of a data set record.
Database equation Enables the database to be specified at run time, and allows
access to databases under different usercodes and on packs
not visible to a task.
Data management (DM) Enable read-only access to the count, record type, and
attributes population information in a record.
Data set reference entry Specifies the structures that are to be invoked from the
declared database.
DELETE statement Finds a specific record, and then locks and deletes it.
DMSTATUS database status Indicates whether an exception condition has occurred and
word identifies the exception.
DMSTRUCTURE function Determines the structure number of a data set, set, or subset
programmatically. This data management structure function
can be used to analyze exception condition results.
DMTERMINATE statement Halts a program with a fault when an exception occurs that the
program does not handle.
Extension Explanation
FIND statement Transfers a record to the work area associated with a data set
or global data.
GENERATE statement Creates a subset in one operation. All subsets must be disjoint
bit vectors.
OPEN statement Opens a database for subsequent access and designates the
access mode.
REMOVE statement Finds a record, and then locks it and removes it from the
subset.
SECURE statement Locks a record in such a way that other programs can read
the record but not update it.
SET statement Alters the current path or changes the value of an item in the
current record.
Extension Explanation
Transaction record control Inquires about record control items in a transaction record for
item reference read-only access.
Transaction record variable Associates the records for a given transaction with the
declaration transaction base.
SDF Extensions
The following extensions have been developed for the SDF interface. Detailed information
about the extensions is provided in Section 6, “Using the SDF Program Interface.” Related
extensions are described in Section 2, “Using the ADDS Program Interface,” and Section 3,
“Using the COMS Program Interface.”
Extension Explanation
FORM-KEY function Enables access to an internal binary number of a form name for
programmatic uses. This function is required for using SDF with
COMS.
REDEFINES clause Enables formlibraries invoked into a program to redefine the same
record area as the first formlibrary.
SAME RECORD AREA clause Enables all form descriptions in the formlibrary to be invoked as
redefinitions of the first form in the formlibrary.
Extension Explanation
Form record number Provides a means of performing I/O operations on form record
attribute libraries to enable individual form records to be specified at run
time.
FROM DICTIONARY clause Invokes an SDF Plus form record library from the dictionary.
READ FORM statement Causes a form record to be read from a specified remote file and
stored in a specified buffer.
Extension Explanation
REDEFINES clause Enables multiple form record libraries to have the same record
area.
SAME RECORD AREA clause Enables all form record descriptions in the form record library to
be invoked as redefinitions of the first form record description in
the form record library.
SEPARATE RECORD AREA Invokes each form record in the form record library as a separate
clause data description with its own record area.
Transaction number attribute Provides a means of performing I/O operations on form record
libraries to enable individual transactions to be specified at run
time.
WRITE FORM statement Writes the contents of a form record to a specified remote file.
WRITE FORM TEXT Causes the contents of a text array to be written to a remote file.
statement
SIM Extensions
The following extensions have been developed for the SIM interface. Detailed information
on the extensions is provided in Section 8, “Using the SIM Program Interface.”
Extension Explanation
ABORT-TRANSACTION Causes a program to revert to the point in time just before the
statement BEGIN-TRANSACTION statement was executed.
APPLY INSERT statement Applies to the database all multiple-statement update INSERT
statements between the START INSERT and APPLY INSERT
statements.
APPLY MODIFY statement Applies to the database all multiple-statement update MODIFY
statements between the START MODIFY and APPLY MODIFY
statements.
Extension Explanation
CALL SYSTEM statement Obtains text that describes the current exception, and gives
information about multiple exceptions. DMEXCEPTIONMSG,
DMEXCEPTIONINFO, and DMNEXTEXCEPTION are the clauses
used with this statement.
Database declaration Specifies the name and type of database that is used in a
query.
DELETE statement Causes the entities in the specified class that meet the
selection requirements to be deleted from the database.
Entity reference variable Declares an entity reference variable in a USAGE clause. This
declaration variable, which contains an explicit reference to a database
entity, can be used to compare and assign entity-valued
attribute values (EVAs) without selecting and retrieving the
entities involved.
Extension Explanation
INCLUDE clause and Adds values to multivalued attributes (MVAs). This attribute
INCLUDE statement assignment is in the form of a statement when used in a
multiple-statement update.
MODIFY statement Updates existing entities in the specified class by using the
accompanying attribute assignments.
OPEN statement Opens a database for access and specifies the access mode.
Query declaration Specifies the name of the query and the classes or items used
in the query.
RESERVE clause Notifies the compiler that SIM keywords are handled as
reserved words for the program.
RETRIEVE statement Retrieves the query and makes the entities available to the
program.
SELECT statement Selects a set of entities from a database and associates the
set with the query.
SET statement Alters the level value in a retrieval involving transitive closure.
Extension Explanation
START INSERT statement Describes the type of selection, if any, and associates a query
name with the statement. This statement precedes a multiple-
statement update insertion.
START MODIFY statement Describes the selection and associates a query name with the
statement. This statement precedes a multiple-statement
update to the database.
The Advanced Data Dictionary System (ADDS) is a centralized storage system used to
create and maintain data descriptions. With ADDS, you can manipulate data, define
complex data structures, and update and report on entities or structures in the data
dictionary.
The program interface for ADDS enables you to invoke entities such as files, records,
record collections, and databases. It also provides the following options:
• Using the DICTIONARY compiler control option to include only entities with a
particular status in the dictionary in your program
• Using the INVOKE clause to assign alias identifiers to file and data names to be used
in the program
• Using the DICTIONARY statement with the PROGRAM-NAME option to allow
tracking to occur where ADDS has already specified program tracking
• Allowing entity tracking to occur where ADDS has already specified both entity and
program tracking
You can use ADDS to define Data Management System II(DMSII) databases. If you are
running ADDS in the InfoExec environment with Semantic Information Manager (SIM),
you can also use ADDS to define SIM databases.
For information on DMSII, see Section 4, “Using the DMSII Program Interface.” For
information on SIM, refer to Section 8, “Using the SIM Program Interface.” For
information on using the ADDS product refer to the InfoExec ADDS Operations Guide.
If you have created formlibraries using the Screen Design Facility (SDF) and stored them
in an ADDS dictionary, you can access these formlibraries just as you would other entities.
Using SDF with ADDS provides some additional capabilities: form and formlibrary
creation, automatic form painting using entities previously defined in ADDS, use of the
ADDS prefixing and synonym features, and entity tracking for programs. For more
information on SDF, refer to Section 6, “Using the SDF Program Interface.” For
information on ADDS prefixing, synonym, and entity tracking features, refer to the
InfoExec ADDS Operations Guide.
If you have created form record libraries using the Screen Design Facility Plus (SDF Plus)
and stored them in an ADDS dictionary, you can access these form record libraries just as
you would other entities. For more information, refer to Section 7, “Using the SDF Plus
Program Interface.”
The information on the following pages explains how to write a program using the
extensions developed for ADDS. Each extension is covered individually, with a
description of its purpose or use, the syntax, an explanation, and an example. Two sample
programs are shown at the end of this section. For an alphabetized list of the extensions,
refer to Section 1, “Introduction to COBOL74 Program Interfaces.”
You can define a program entity in ADDS and use the DICTIONARY compiler control
syntax in your program to restrict invocation of entities to those with a particular status.
Entities with historical status cannot be invoked by the COBOL74 compiler. You can
invoke entities with historical status if you first change their status. Refer to the InfoExec
ADDS Operations Guide for information on status and for the rules ADDS uses to search
for an entity.
General Format
The general format for the DICTIONARY compiler control option is as follows:
ä å
³ PRODUCTION ³
DICTIONARY = ã ïïïïïïïïïï â
ïïïïïïïïïï ³ TEST ³
æ ïïïï ç
PRODUCTION
This format element ensures that only PRODUCTION status data dictionary entities are
invoked. There is no default value.
TEST
This format element ensures that only TEST status data dictionary entities are invoked.
There is no default value.
Example
The following example shows the DICTIONARY compiler control option used to invoke
entities that are defined in ADDS with a PRODUCTION status:
VERSION Clause
ADDS creates a unique version number for every entity that you define. The VERSION
clause identifies the version number of the record description.
[ VERSION is literal-1 ]
ïïïïïïï
literal-1
The version number is a numeric literal that can be up to 6 digits in length and can contain
any value from 1 to 999999. Literal-1 must be a valid version number of the entity in the
data dictionary.
Example
The following example specifies 2 as the version:
DIRECTORY Clause
The DIRECTORY clause specifies the directory under which the entity is stored in the data
dictionary. Refer to the InfoExec ADDS Operations Guide for detailed information about
directories.
The DIRECTORY syntax replaces the former USER clause. The USER syntax is still
supported; however, it is recommended that you use the DIRECTORY syntax in your
programs.
General Format
The general format of the DIRECTORY clause is as follows:
[ DIRECTORY is literal-1 ]
ïïïïïïïïï
literal-1
This literal describes the directory under which a data description is stored in the
dictionary specified in the SPECIAL-NAMES paragraph. Literal-1 must be a nonnumeric
literal of 1 to 17 alphabetic characters.
Example
In the following example, the version is 1 and the directory is specified as Smith :
Assigning an alias is useful when, for example, you want to invoke the same record twice
in your program. The alias enables you to use a unique qualifier.
In the program, the INVOKE clause is in the DATA DIVISION. Use the INVOKE clause to
assign an alias as follows:
See Also
See “Selecting a File” and “Invoking File Descriptions” later in this section for more
information.
General Format
The general format of the INVOKE clause is as follows:
Ú ¿
³ ä å ³
³ ³INVOKE³ ³
³data-name-1 ãïïïïïïâ ³
³ ³= ³ ³
³ æ ç ³
À Ù
data-name-1
This data name must be at the 01-level. Once an alias is assigned, any reference to the data
name in the program must specify data-name-1. All PROCEDURE DIVISION statements
must also use this alias.
Example
In the following example, MY-INTERNAL-NAME is an alias identifier for the
ADDS-ENTITY-NAME identifier:
Identifying a Dictionary
You can use the DICTIONARY statement to identify the dictionary to be used during
compilation. The dictionary is identified in the SPECIAL-NAMES paragraph of the
program. Optional program clauses provide program tracking. If no dictionary is specified
using the DICTIONARY statement, the compiler uses DATADICTIONARY by default.
Note: A program can invoke only one dictionary. Therefore, if a program accesses
both a SIM database (from a dictionary) and SDF forms, both must be in the
same dictionary.
General Format
The general format of the DICTIONARY statement is as follows:
Ú ¿
³, DICTIONARY IS literal-1 ³
³ ïïïïïïïïïï ³
³Ú ¿ ³
³³, PROGRAM-NAME IS literal-2 ³ ³
³³ ïïïïïïïïïïïï ³ ³
³³, PROGRAM-VERSION IS literal-3 ³ ³
³³ ïïïïïïïïïïïïïïï ³ ³
³³, PROGRAM-DIRECTORY IS literal-4³ ³
³À ïïïïïïïïïïïïïïïïï Ù ³
À Ù
DICTIONARY
This statement specifies the function name of the dictionary library. The function name is
the name equated to a library code file using the SL (support library) system command.
The function name can be no longer than 17 characters.
literal-1
This format element designates the function name of the dictionary library. The function
name can be 17 characters in length and optionally terminated by a period.
PROGRAM-NAME
This option specifies the name of the program entity defined in ADDS. The
PROGRAM-NAME option is required if you desire tracking information to be sent to
ADDS. Tracking is an ADDS feature. By defining a program entity in ADDS and setting the
tracking attribute to YES, you can direct the dictionary to make a list (track) of the data
structures and entities that are invoked in the DATA DIVISION and that are explicitly
referenced in the PROCEDURE DIVISION of your program. ADDS will then associate this
list with the program entity. More information on program tracking is provided in the
InfoExec ADDS Operations Guide.
If the PROGRAM-NAME option appears but tracking is not set in ADDS, a warning is
generated only if the WARNSUPR option is reset when the PROGRAM-NAME option
appears.
If the PROGRAM-NAME option appears and tracking is set in ADDS, tracking information
is sent to ADDS only if the program compiles correctly. Tracking information is not sent if
syntax errors are encountered or if compilation is aborted.
literal-2
This format element designates a valid program name in the data dictionary.
PROGRAM-VERSION
This option specifies to which version of the program entity tracking information is sent.
literal-3
This format element designates a numeric literal that contains from 1 to 6 digits.
PROGRAM-DIRECTORY
literal-4
See Also
See “Identifying Specific Entities” earlier in this section for information on the VERSION
and DIRECTORY clauses.
Example
The following example shows DATADICTIONARY specified as the function name of the
dictionary library. EXAMPLE-PROGRAM is the name of the program entity in ADDS to
which tracking information is sent.
SPECIAL-NAMES.
DICTIONARY IS "DATADICTIONARY"
PROGRAM-NAME IS "EXAMPLE-PROGRAM"
PROGRAM-VERSION IS 1
PROGRAM-DIRECTORY IS "JOHNDOE".
Selecting a File
The SELECT statement includes files from a dictionary in your program. You can assign
an alias identifier to a selected file. You can also use the VERSION and DIRECTORY
clauses to identify the particular file. In your program, you include the SELECT statement
in the FILE-CONTROL paragraph of the INPUT-OUTPUT SECTION.
General Format
The general format for the SELECT statement is as follows:
Ú ¿
³ ä ³ å
³ ³INVOKE³
³
SELECT ³file-name-1 ãïïïïïïâ
³ file-name-2 FROM DICTIONARY
ïïïïïï ³ ³= ³ ³ ïïïï ïïïïïïïïïï
³ æ ³ ç
À Ù
Ú ¿
³, DIRECTORY IS literal-2 ³
[,VERSION IS literal-1 ]³ ïïïïïïïïï ³ . [;]
ïïïïïïï ³; ³
À Ù
file-name-1
This name designates the alias for the file selected from a dictionary.
INVOKE
file-name-2
This name designates the file selected from the dictionary. Subsequent references to this
file name must use the file-name-1 alias.
FROM DICTIONARY
VERSION IS literal-1
This format element specifies a numeric literal that identifies a version of the file. Literal-1
comprises from 1 to 6 numeric digits.
DIRECTORY IS literal-2
This format element specifies a nonnumeric literal that designates the directory under
which the file is stored in the data dictionary.
; (semicolon)
This option, the semicolon following the ending period, controls the behavior of compiler
control records (CCRs) and format listings. The optional semicolon must be separated
from the ending period of the SELECT statement by at least one space.
1. Define the file in ADDS, and relate the formlibrary to the file. For information on
defining files in ADDS, refer to the InfoExec ADDS Operations Guide.
2. Use the SELECT statement with the FROM DICTIONARY clause, and invoke the
formlibrary in the file description statement of the program.
See Also
• For more information on using SDF with ADDS, refer to the SDF Operations and
Programming Guide and to Example 2–2, “ADDS Sample Program with SDF,” later in
this section.
• Refer to Section 6, “Using the SDF Program Interface,” for a discussion of using SDF
extensions in your COBOL74 program.
• For information on the VERSION and DIRECTORY clauses, see “Identifying Specific
Entities” earlier in this section.
• See “Assigning Alias Identifiers” earlier in this section for information on assigning an
alias identifier to a selected file.
Example
The following example of the SELECT statement contains comments that explain the
selection of a remote file:
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT ADDS-FILE FROM DICTIONARY
VERSION IS 1
DIRECTORY IS "*".
*--DICTIONARY DIRECTORY : *.
*-- ASSIGN TO DISK
*-- RESERVE 2 AREAS
*-- ORGANIZATION IS SEQUENTIAL
*-- .
SELECT REMOTE-FILE FROM DICTIONARY.
*--DICTIONARY DIRECTORY : *.
*-- ASSIGN TO REMOTE
*-- .
DATA DIVISION.
FILE SECTION.
If you do not use the INVOKE ALL option, one or more record description entries must
follow the file description entry or sort-merge file description entry. No I/O statements
(except RELEASE and RETURN) can be executed for the sort-merge file. Refer to
Volume 1 for information on I/O statements.
General Formats
The formats for ADDS file descriptions are as follows:
Format 1
Format 2
FD
This level indicator identifies the beginning of a file description and must precede the file
name. FD stands for file description.
SD
This level indicator identifies the beginning of a file description and must precede the file
name. SD refers to a sort-merge file description.
; (semicolon)
This option, the semicolon following the ending period, controls the behavior of compiler
control records (CCRs) and format listings. The semicolon must be separated from the
ending period of the FD or SD statement referencing a file from the dictionary by at least
one space.
See Also
• For general information on the FILE SECTION and the file description entries in a
program, refer to Volume 1.
• See “INVOKE ALL Option” later in this section for a description of that option.
• See “Assigning Alias Identifiers” earlier in this section for information on assigning an
alias identifier to a selected file.
• See “Selecting a File” earlier in this section for information on the SELECT statement.
Examples
The following statements are examples of FD and SD statements:
FD REMOTE-FILE.
General Format
The general format of the INVOKE ALL option is as follows:
[ INVOKE ALL ]
ïïïïïï ïïï
INVOKE ALL
This option invokes all the record description, SDF form, and SDF Plus record
descriptions defined for the file.
If the INVOKE ALL option is not specified in the file description, all file attributes are
invoked; however, a selected set of record descriptions, SDF form or SDF Plus record
descriptions can be invoked separately.
Example
The following code is an example of the INVOKE ALL option:
FILE SECTION.
FD ADDS-FILE INVOKE ALL.
The data-description entry is used within the FILE SECTION to invoke record
descriptions, SDF Plus record descriptions, or SDF formlibraries for any file that has not
been declared with an INVOKE ALL optional clause in its FD entry.
General Format
The general format for invoking data descriptions in ADDS is as follows:
Ú ¿ ä å
³ ä å ³ ³data-name-2 ³
³ ³INVOKE³ ³ ³ ³
level-number ³data-name-1 ãïïïïïïâ ³ ãgroup-list-name-1 â
ïïïïïïïïïïïï ³ ³= ³ ³ ³ ³
³ æ ç ³ ³formlibrary-name-1³
À Ù æ ç
FROM DICTIONARY
ïïïï ïïïïïïïïïï
[;VERSION IS literal-1 ] [ ; DIRECTORY IS literal-2 ] . [;]
ïïïïïïï ïïïïïïïïï
data-name-1
This data name must be at the 01-level. Once an alias is assigned, any reference to the data
name in the program must specify data-name-1. All PROCEDURE DIVISION statements
must also use this alias.
INVOKE
This option specifies an alias for data-name-2. INVOKE and the equal sign (=) are
synonyms.
data-name-2
This format element identifies a dictionary structure that is a record description. The
record description is at the 01-level and it is to be included in the FILE SECTION,
WORKING-STORAGE SECTION, LINKAGE SECTION, or LOCAL-STORAGE SECTION.
group-list-name-1
formlibrary-name-1
VERSION IS literal-1
This format element specifies a numeric literal that identifies a version of the record.
Literal-1 comprises from 1 to 6 digits.
DIRECTORY IS literal-2
This format element specifies a nonnumeric literal that identifies the directory under
which the record is stored in the data dictionary.
; (semicolon)
This option, the semicolon following the ending period, controls the behavior of compiler
control records (CCRs) and format listings. The optional semicolon must be separated
from the ending period of the data invocation by at least one space.
If a CCR immediately follows a data item invoked from the dictionary, the compiler
control option changes might occur before the compiler processes the information
invoked from the dictionary. You can avoid this situation by using the optional semicolon
after the ending period. The semicolon ensures that the compiler processes the invoked
information before the compiler control option changes.
• The 01-level records, SDF Plus form record libraries, or SDF formlibraries can be
invoked within the FILE SECTION, the WORKING-STORAGE SECTION, the LINKAGE
SECTION, or the LOCAL-STORAGE SECTION. Record collections, however, cannot
be invoked within the FILE SECTION; they can be invoked only within the
WORKING-STORAGE SECTION, the LINKAGE SECTION, or the LOCAL-STORAGE
SECTION.
• Within the FILE SECTION, no data-description entry can follow a file description that
includes the INVOKE ALL option under an FD entry.
• Within the FILE SECTION, if the file has been selected using the SELECT statement
shown for ADDS, the record or the formlibrary must be associated with that file in the
data dictionary.
• A record collection or formlibrary cannot be given an alias identifier using the
INVOKE clause.
See Also
For information about the VERSION and DIRECTORY clauses, see “Identifying Specific
Entities” earlier in this section.
Example
In the following example, an invocation with an SDF Plus record description is coded in
the WORKING-STORAGE SECTION because record descriptions cannot be invoked in the
FILE SECTION:
WORKING-STORAGE SECTION.
01 MY-REC-LIST INVOKE
ADDS-REC-LIST FROM DICTIONARY.
VERSION IS 2
DIRECTORY IS "*".
The clauses that are used to invoke dictionary entities are accurately coded. However, this
is only a program fragment and not a complete COBOL74 program. Note that a numbered
line with an asterisk (*) in the first column of the excerpt code indicates file attributes that
are generated from the ADDS definition.
***************************************************
* *
* This clause identifies the dictionary that *
* contains the data descriptions this program *
* invokes. It also specifies in the *
* dictionary the program to be tracked. *
* *
***************************************************
***************************************************
* *
* Files can be invoked from the dictionary by *
* using the SELECT statement. *
* *
***************************************************
COMPILE O.K.
TOTAL CARD COUNT: 157
D[01] STACK SIZE: 0023(017) WORDS
D[02] STACK SIZE: 0053(035) WORDS
CORE ESTIMATE: 2702 WORDS
STACK ESTIMATE: 310 WORDS
CODE FILE SIZE: 21 RECORDS
PROGRAM SIZE: 3 CODE SEGMENTS, 225 TOTAL WORDS
SUBROUTINE NAME: CODE3780, LEVEL 02
COMPILED ON THE MICRO A FOR THE A SERIES
COMPILER COMPILED WITH THE FOLLOWING OPTIONS:
BDMS.
COMPILE TIMES: ELAPSED CPU I-O RPM
0042.645 0002.074 0002.112 04541
DATADICTIONARY PROGRAM TRACKING SUMMARY :
PROGRAM NAME : EXAMPLE-PROGRAM , DIRECTORY : EXAMPLE ,
VERSION : 000001 ,
STATUS : TEST
Refer to the SDF Operations and Programming Guide for more information on using
SDF with ADDS. Refer to Section 6, “Using the SDF Program Interface,” for a discussion
of using SDF extensions in your COBOL74 program.
******************************************************
* The following lines specify the dictionary that *
* stores the formlibrary. *
* This example program also indicates the version *
* and directory of the program entity. *
******************************************************
011100
011200 SPECIAL-NAMES.
011300 DICTIONARY IS "DATADICTIONARY"
011400 PROGRAM-NAME IS "SAMPLE2"
011425 PROGRAM-VERSION IS 1
011450 PROGRAM-DIRECTORY IS "USER1".
******************************************************
* The following lines declare the remote file. *
* *
******************************************************
011500
012000 INPUT-OUTPUT SECTION.
013000 FILE-CONTROL.
014000 SELECT REMFILE
014500 ASSIGN TO REMOTE.
******************************************************
* The lines following the FD statement illustrate *
* file attributes that ensure a correct record size *
* for full screen writes when using remote files. *
* *
******************************************************
015000
016000 DATA DIVISION.
017000 FILE SECTION.
018000 FD REMFILE.
000100*--DICTIONARY DIRECTORY : *.
000200*-- BLOCK CONTAINS 2500 CHARACTERS
000300*-- RECORD CONTAINS 2500 CHARACTERS
000400*-- VALUE OF FILETYPE IS 3
000500*-- VALUE OF MYUSE IS IO
000600*-- CODE-SET IS EBCDIC
000700*--
******************************************************
* The following lines invoke the formlibrary *
* in the FILE SECTION. *
* This example program also indicates the version *
* and directory. *
******************************************************
000100*--DICTIONARY
D000110*--DICTIONARY FORMLIST <SAMPLELIB>. D
000130 01 SAMPLEFORM1. D
000140 02 ACTION PIC X(10). D
000150 02 ACCOUNT-NO PIC 9(9). D
000160 02 NAME PIC X(15). D
000170 02 STREET PIC X(25). D
000180 02 CITY PIC X(15). D
000190 02 STATE PIC X(2). D
000200 02 ZIP PIC 9(9). D
024000 PROCEDURE DIVISION.
024500 MAIN-PARA.
025000
*****************************************************
* *
* The following line opens the remote file. *
* *
*****************************************************
*****************************************************
* The following lines write a form from the *
* formlibrary to the terminal with default *
* values; the program then waits for a *
* transmission to do a read operation. WRITE *
* statements are not necessary when you are *
* sending a form with default values to the *
* terminal. *
*****************************************************
The program interface for COMS enables you to create online, interactive, and batch
programs that take advantage of the features which COMS offers for transaction
processing through direct windows. The program interface enables your program to
communicate with COMS, using the following COMS functions:
This section explains how to use the COMS extensions to communicate with COMS
through direct windows. For an alphabetized list of the extensions developed for COMS,
refer to “COMS Extensions” in Section 1, “Introduction to COBOL74 Program Interfaces.”
Note that processing items can be written using COBOL74 with an ALGOL shell.
Instructions on using the shell, as well as general COMS programming concepts, are
provided in the Communications Management System (COMS) Programming Guide.
For information about using DMSII and SIM databases together, see the InfoExec
Semantic Information Manager (SIM) Programming Guide.
When DMSII is run with COMS,the following DMSII statements are used to enable a
program interfacing with COMS to support synchronized transactions and recovery:
• ABORT-TRANSACTION
• BEGIN-TRANSACTION
• CLOSE
• DMTERMINATE
• END-TRANSACTION
COMS can also use the DMSII TPS MID-TRANSACTION statement.
When COMS is run with SIM, the following statements are used to support transactions
and recovery:
• ABORT-TRANSACTION
• BEGIN-TRANSACTION
• CLOSE
• END-TRANSACTION
See Also
• Information about the syntax and use of DMSII statements is provided in Section 4,
“Using the DMSII Program Interface.”
• Information about the use of the DMSII TPS MID-TRANSACTION statement is
provided in Section 5, “Using the DMSII TPS Program Interface.”
• Information about the syntax and use of SIM statements is provided in Section 8,
“Using the SIM Program Interface.”
• Information on syntax used with SDF is provided in Section 6, “Using the SDF
Program Interface.”
Declare the message area with a format and size that are appropriate to the data your
program is to receive. If the message area is too small to contain all the incoming text,
COMS truncates the message.
After a message is received, the Text Length field in the header contains the number of
characters in the entire message text.
Example
The following example shows the declaration for a COMS message area. The declaration
occurs in the DATA DIVISION.
IDENTIFICATION DIVISION.
PROGRAM-ID. COMSMSG.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 COMS-MESSAGE-AREA.
02 COMS-MESSAGE PIC X(2500).
COMMUNICATION SECTION.
When a program performs updates with SDF forms, the message area can receive the SDF
form. For information on how to write an application that uses SDF forms with COMS, see
Section 6, “Using the SDF Program Interface,” and the sample programs in the COMS
Programming Guide.
• You do not need to know the memory structure because COMS handles the location of
fields in the headers.
• COMS identifiers access all fields within the header; therefore, there is no need to
rename the fields in the queue structure.
• You need not change your program when new releases of COMS occur.
• COMS headers can be referenced by bound-in procedures.
used to receive or send values that provide information or instruction for various
activities.
This discussion of using COMS headers begins with a description of the declaration for
COMS headers and an explanation of how the COMS data types map intoCOBOL74. The
rest of the discussion covers the use of the header fields.
For detailed information on the use of the headers and fields, refer to the COMS
Programming Guide.
General Format
The general format for declaring input and output COMS headers is as follows:
ä å
³INPUT ³
ãïïïïï â HEADER data-name-1
³OUTPUT³ ïïïïïï
æïïïïïïç
[data-name-2 IS data-name-3]...
[CONVERSATION AREA [IS data-name-4 SIZE IS integer-1]].
ïïïïïïïïïïïï ïïïï ïïïï
[record-description-entry].
data-name-1
This format element names the input or output header. The header description is invoked
and provides access to all the fields of the input header.
data-name-2
This format element is any identifier retrieved from COMS. If data-name-2 is not unique to
the input header, you can access it with an OF qualification that mentions data-name-1.
IS
data-name-3
This option replaces the field name supplied by COMS; it is not equated. However, a field
cannot be renamed with a name that already exists in the header. If data-name-2 is
renamed, it must be referred to by data-name-3.
CONVERSATION AREA
This option provides a user-defined area associated with the input or output header. This
option must include either data-name-4 and a SIZE phrase, or be mapped with the
record-description-entry.
data-name-4
This format element names the conversation area. The area is specified as
02 data-name-4 PIC X(integer-1).
SIZE
This phrase defines the conversation area as a PIC X representation with the length
indicated by integer-1.
record-description-entry
This format element is added to the end of the header. The record-description-entry must
start at level 02.
See Also
• For more information on using the OF qualification, see the discussion of using set
and data set names in Section 4, “Using the DMSII Program Interface.”
• For more information on the CONVERSATION AREA option and the fields of the input
and output headers see “Using COMS Input Header Fields” and “Using COMS Output
Header Fields” later in this section.
• For more information on a specific requirement for SDF, see Section 6, “Using the
SDF Program Interface.”
Example
The following example shows the declarations for COMS input and output headers. An
example of declarations for headers within the context of a complete program is provided
in Example 3–1, “COMS Sample Program with a DMSII Database.”
COMMUNICATION SECTION.
INPUT HEADER COMS-IN
PROGRAMDESG IS COMS-IN-PROGRAM.
CONVERSATION AREA.
02 CA.
05 CA-1 PIC X(20).
05 CA-2 PIC X(30).
OUTPUT HEADER COMS-OUT.
COMS data types include a COMS designator data type that is used only for specific fields
and with service functions. COMS determines the kind of designator and required name
from the value that is passed. The designator type is compatible with COBOL74 data
items of type real. More information about COMS designators used with service functions
is provided in “Using COMS Designators” later in this section.
Boolean items are similar to DMS Boolean items; they can be tested with an IF condition
and set with a COMPUTE statement.
Note that when using logical tests against the COMS type TIME(6), you must redefine the
type as a PIC X(6) DISPLAY item that you test against.
COMS places values (designators and integers) in the input header fields when a
RECEIVE, ACCEPT, DISABLE, or ENABLE statement is executed.
COMS uses the output header when sending messages. You place designators into the
output header fields to route outgoing messages and describe their characteristics. You
can obtain designators by calling service functions to translate names representing COMS
entities to designators.
COMS uses the output header fields for the following tasks:
• Specifying a destination
• Routing by transaction code (trancode)
• Sending messages using direct windows
• Confirming message delivery
• Checking the status of output messages
See Also
• For general information on output headers and fields, refer to the COMS
Programming Guide.
• For information on data types, refer to “Mapping COMS Data Types to COBOL74”
earlier in this section and to “Using COMS Designators” later in this section.
• See “Calling Service Functions” later in this section for more information on obtaining
designators.
A direct-window program can set the VT flag before sending output messages by using the
following syntax:
COMS returns the result in the VT Flag field of the input header. You can test the result
directly by using the following IF statement:
IF VTFLAG OF INHDR...
To request delivery confirmation, perform the following steps before executing the SEND
statement:
• Use the COMPUTE statement to set the Delivery Confirmation Flag field. For
example, enter the following:
• Identify a message individually by placing a unique value of your choice into the
Delivery Confirmation Key field. When confirming delivery, COMS uses the default
input agenda to return the unique value in the first three characters of the message
area.
See Also
• For more information on requesting delivery confirmation on output, see the COMS
Programming Guide.
• Refer to “Using Communication Statements” later in this section for information on
receiving and sending messages.
Examples
Examples of library access by function, by initiator, and by title are explained in the
following paragraphs.
The syntax illustrated in this example is the programming equivalent of the default method
used by the DCI library. COMS is installed under a different object code file title, for
example COMS/ENTRY or COMS/PRODUCTION. Note that a change in the title of the
object code file requires appropriate data communications configuration changes. The
LIBACCESS library attribute specifies that the function name—not the object code file
title—is used to access the library. The FUNCTIONNAME library attribute designates the
function name of the library. Additional information on library attributes is provided in the
discussion of libraries in Volume 1. Refer to the System Software Utilities Operations
Reference Manual for a description of the library attributes.
The following example shows how to link a COMS program by initiator. This method of
linking to COMS is the preferred method for COMS programs. All other programs should
be linked by function.
A COMS application program can link to COMS by title. This method is not recommended.
Linking by title might be used, for example, when linkage is needed to a test version of
COMS that was not assigned a function name with the SL (support library) system
command, and access by initiator is not available on the level of the operating system you
have installed.
Note: Linking by title can cause COMS to be initiated at an inappropriate time and
with inappropriate attributes (for example, the usercode of the requestor, the
family statement, or limits). Linking by title can fail because of the family
substitution action if the object code file was renamed since initiation or if a
new version of the code file was installed that replaced the code file of the
current installation of COMS.
The following example shows how to link your program to COMS by title:
Example
The following example shows the initialization statement used within the context of code
that links an application program to COMS:
A DCI library enables programs to deal with symbolic sources and destinations instead of
peripherals. Program recompilation when the peripherals are changed or rearranged is
therefore avoided. The library reference is built with the title DCILIBRARY and the library
object name DCIENTRYPOINT. The DCIENTRYPOINT library object is an untyped
procedure.
2 DISABLE
3 ENABLE
4 RECEIVE
5 SEND
7 BEGIN-TRANSACTION ABORT
9 END-TRANSACTION ABORT
All statements except DISABLE, ENABLE, RECEIVE, and SEND are extensions to
ANSI-74 COBOL.
• An integer with a value indicating the length, in characters, of the EBCDIC array
(unindexed descriptor) that contains the message or the password.
• An integer with a value indicating either the type of end-indicator option to be sent or
received or the type of enable or disable operation to be performed. For the SEND or
RECEIVE statements, the following values are associated with an indicator option:
Value Indicator Option
For the DISABLE or ENABLE statement, the value specifies the device type as
follows:
Value Device Type
11 Input terminal
12 Input terminal
13 Output terminal
• An integer with a value that indicates advancing control when the SEND statement is
performed. The parameter also indicates whether or not to wait for messages when
the statement is a RECEIVE statement.
For the SEND statement, the value of the parameter specifies advancing as follows:
Value Advancing Control
0 No advancing
For the RECEIVE statement, the value of the integer can be set as follows in the
program or by the DCI library:
Setting Integer Value
Program The value indicates to the DCI library whether or not to wait if no
setting message or text is available. A value of 0 (zero) means do not wait, and
a value greater than 0 means wait that number of seconds. If this
parameter is set to 0 and a NO DATA clause is supplied, no waiting
occurs and the action specified in the NO DATA clause is taken if no
message is available.
DCI Before returning control to the program, the DCI library sets the value of
library the integer to 1 if no text is available; otherwise, a value of 0 (zero) is
setting returned with the text to the program.
• An integer equal to the number of lines the device is to advance when using the SEND
statement. If a SEND statement is not used, the value of this parameter is 0 (zero).
Example
You can write the DCI library in COBOL, ALGOL, or DCALGOL to allow access to disk
files, remote files, or port files. The symbolic queues, selection algorithms, sources, and
destinations—as set out in standard ANSI-74 COBOL—can be tailored to the particular
application using the DCI library. The following example shows a typical DCI library
object written in COBOL74:
IDENTIFICATION DIVISION.
PROGRAM-ID. DCIENTRYPOINT.
DATA DIVISION.
LINKAGE SECTION.
*
* Integer value of the statement
*
77 DCI-FUNCTION COMP PIC 9.
*
* Length of the array that contains the message or password
*
01 THE-MESSAGE
03 THE-MESSAGE-SUB PIC X
OCCURS 1 TO 9999 DEPENDING ON THE-MESSAGE-LENGTH.
*
* Indicator option or type of enable or disable to be performed
*
77 THE-MESSAGE-LENGTH COMP PIC 999.
*
* Value of advancing control
*
77 IO-OR-END-INDICATOR COMP PIC 99.
*
* Amount to advance in a SEND statement
*
When the ACCEPT MESSAGE COUNT statement is executed, the Status Value field of the
input header and Message Count field are appropriately updated.
General Format
The general format of the ACCEPT MESSAGE COUNT statement is as follows:
This statement updates the Message Count field to indicate the number of messages
present in the queue that COMS maintains for the program.
COMS-header-name-1
DISABLE Statement
The DISABLE statement closes a direct window to a station or disconnects a station
reached through a modem or a CP 2000 communications processor.
If the logical disconnection specified by the DISABLE statement has already occurred or is
denied by COMS, the data item in the Status Value field is updated. See “Using COMS
Input Header Fields” earlier in this section for more information on the Status Value field.
General Format
The general format of the DISABLE statement is as follows:
DISABLE INPUT
This phrase logically disconnects COMS from the specified sources or destinations. If this
logical disconnection has already occurred or is handled by means external to the
program, the DISABLE statement is not required in the program. In this case, the DISABLE
statement does not affect the logical path for the transfer of data between the COBOL74
programs and COMS.
TERMINAL
This optional word specifies that only the data item in the Station field is meaningful.
COMS-header-name-1
This format element specifies the name of the COMS input header.
This format element must be alphanumeric. The KEY options are literals defined for use
with COMS. KEY options are described in the COMS Programming Guide.
Example
The following example shows how to use the DISABLE statement with the optional word
TERMINAL:
ENABLE Statement
The ENABLE statement dynamically opens a direct window to a station not currently
attached to COMS. You can check the status of a station attachment by querying values in
the fields of the COMS input header.
For information about the use of this statement to dynamically attach a station, refer to
the COMS Programming Guide.
When the logical connection specified by the ENABLE statement already exists or is
denied by COMS. the data item in the Status Value field is updated.
General Format
The general format of the ENABLE statement is as follows:
ENABLE INPUT
This phrase provides a logical connection between COMS and the specified sources or
destinations. When this logical connection is already present or is handled by means
external to the program, the ENABLE statement is not required in the program. In this
case, the ENABLE statement does not affect the logical path for the transfer of data
between the COBOL74 program and COMS.
TERMINAL
This option dynamically opens a direct window to a station that is not attached to COMS.
COMS-header-name-1
literal-1 or identifier-1
This format element must be alphanumeric. The KEY values provided by COMS are
described in the COMS Programming Guide.
Examples
The following examples illustrate the use of the KEY values with the ENABLE statement.
The first example can be seen within the context of a complete program in line 019100 of
Example 3–1, “COMS Sample Program with a DMSII Database,” later in this section. For
more information on the use of the ENABLE statement to establish communication with
the COMS MCS, see “Initializing an Interface Link” earlier in this section.
RECEIVE Statement
The RECEIVE statement makes a message and pertinent information about the data
available to the COBOL74 program from a queue maintained by COMS. You can use the
RECEIVE statement to execute a specific imperative statement when you use the NO
DATA option, as shown in the following format diagram.
You can use the RECEIVE statement as many times as needed in the PROCEDURE
DIVISION of your program. You can structure your program to receive messages from one
or more stations or programs, but you cannot programmatically limit the reception of
messages to selected stations on the network or to certain types of programs.
Before you can receive or send messages, however, you must link to COMS and initialize
the program. For information, refer to “Preparing to Receive and Send Messages” earlier in
this section.
General Format
The general format of the RECEIVE statement is as follows:
COMS-header-name-1
This format element references an area to which a message is transferred. The message is
aligned to the left without space fill.
NO DATA imperative-statement-1
This option enables COMS to transfer control to the next executable statement when you
execute a RECEIVE statement and receive data.
If COMS does not make data available in the identifier-1 data item, one of the following
actions takes place when you execute a RECEIVE statement:
• If you specify the NO DATA option, the RECEIVE statement is terminated, which
indicates that action is complete. Imperative-statement-1 is executed.
• If you do not specify the NO DATA option, then the object program execution is
suspended until data is made available in identifier-1 or until end-of-task (EOT)
notification.
Imperative-statement-1 can consist of a NEXT SENTENCE option.
• If a message is the same size as the area of identifier-1, the message is stored in the
identifier-1 area.
• If a message is smaller than the area of identifier-1, the message is aligned to the
leftmost character position of the identifier-1 area with no space fill.
• If a message is larger than the area of identifier-1, the message fills the identifier-1
area from left to right, starting with the leftmost character of the message. The rest of
the message is truncated.
You cannot use a RECEIVE statement between BEGIN-TRANSACTION and
END-TRANSACTION statements. Doing so violates the rules of synchronized recovery and
you might lose some of the data in your database.
Example
The following example shows part of an application routine that is written to receive a
message from COMS and place it in an area defined in the WORKING-STORAGE
SECTION. An example of a RECEIVE statement within the context of a complete program
begins at line 019700 in Example 3–1, “COMS Sample Program with a DMSII Database,”
later in this section.
PROCEDURE DIVISION.
:
RECEIVE-MSG-FROM-COMS.
RECEIVE COMS-IN MESSAGE INTO MSG-IN-TEXT.
IF STATUSVALUE OF COMS-IN = 99
GO TO EOJ-ROUTINE.
*
* Process the message.
*
:
GO TO RECEIVE-MSG-FROM-COMS.
EOJ-ROUTINE.
STOP RUN.
SEND Statement
The SEND statement releases a message, message segment, or portion of a message to
one or more output queues maintained by COMS. Before you can send or receive
messages, however, you must link to COMS and initialize the program. For information on
these functions, refer to “Preparing to Receive and Send Messages” earlier in this section.
When a SEND statement is executed, the Status Value field is updated by COMS. See the
COMS Programming Guide for information on the values in the Status Value field.
General Formats
The following are two general formats for the SEND statement. The second format is for
segmented output.
ä å
³WITH identifier-2 ³
³ ³
³WITH ESI ³
SEND COMS-header-name-1 [FROM identifier-1]ã ïïï â
ïïïï ïïïï ³WITH EMI ³
³ ïïï ³
³WITH EGI ³
æ ïïï ç
Ú ¿
³ ä å ³
³ ³ä å Ú ¿ ³ ³
³ ³³identifier-3³ ³LINE ³ ³ ³
³ä å ³ã â ³ ³ ³ ³
³³BEFORE ³ ³³integer ³ ³LINES³ ³ ³
³ãïïïïïï â ADVANCING ãæ ç À Ù â ³
³³AFTER ³ ïïïïïïïïï ³ä å ³ ³
³æïïïïï ç ³³mnemonic-name³ ³ ³
³ ³ã â ³ ³
³ ³³PAGE ³ ³ ³
³ ææïïïï ç ç ³
À Ù
COMS-header-name-1
FROM identifier-1
This phrase moves the message or message segment to the sending character positions of
the area of identifier-1 and is aligned to the left with space fill.
Identifier-1specifies the data name of the area where the data to be sent is made available
to COMS.
When you execute a SEND statement, COMS interprets the value in the Text Length field
of the output header as the number of leftmost character positions of identifier-1 from
which data is to be transferred.
If the value of Text Length is 0 (zero), no characters of identifier-1 are transferred. The
value of Text Length cannot be outside the range 0 through the size of identifier-1. If the
value is outside the range, the message is truncated to the size of identifier-1 and the
Status Value field of the output header is set to 0.
WITH
identifier-2
This format element must be the name of a 1-character integer without an operational
sign, for example, PIC S9(11) USAGE BINARY.
These options specify the segmenting options. See “Segmenting Options” later in this
section for information on the three segmenting options.
identifier-3
integer
This format element specifies the number of lines to advance. The value can be 0 (zero).
mnemonic-name
This format element specifies a name that is identified with a particular feature specified
in the SPECIAL-NAMES paragraph of the ENVIRONMENT DIVISION.
Segmenting Options
There are three segmenting options: the end-of-message indicator (EMI), the end-of-group
indicator (EGI), and end-of-segment indicator (ESI). COMS recognizes these indicators
and establishes the appropriate linkage to maintain control over groups, messages, and
segments. For example, the following statement sends output immediately after values
have been moved to the required fields of the output header:
The contents of identifier-2 indicate that the contents of identifier-1 are to have an
associated ESI, EMI, or EGI according to the explanations in Table 3–4.
The hierarchy of ending indicators (major to minor) is EGI, EMI, and ESI. An EGI need not
be preceded by an ESI or an EMI, and an EMI need not be preceded in the code by an ESI.
0 No indicator No indicator
1 ESI Message segment complete
2 EMI Message complete
3 EGI Group of messages complete
A single execution of the SEND statement with segmented output never releases to COMS
more than the single message or message segment that is indicated by the contents of the
data item referenced by identifier-2 and by the specified ESI, EGI, or EMI. However, the
MCS does not transmit any portion of a message to a communications device until the
entire message is placed in the output queue.
During the execution of the run unit, the disposition of a portion of a message not
terminated by an EMI or EGI is undefined. Thus, the message does not logically exist for
the MCS and cannot be sent to a destination.
After the execution of a STOP RUN statement, the system removes any portion of a
message transferred from the run unit as a result of a SEND statement, but not terminated
by an EMI or EGI. As a result, no portion of the message is sent.
Advancing Options
The ADVANCING option enables you to control the vertical positioning of each message
or message segment on an output device where this control is possible. If vertical
positioning is not possible on a device, COMS ignores the specified or implied vertical
positioning.
On a device where vertical positioning is possible and the ADVANCING option is not
specified, the COMS default setting of BEFORE ADVANCING one line is used.
You can use the BEFORE ADVANCING and AFTER ADVANCING options to specify
whether the text of a message should be written to the output device before or after the
device advances to the next page, or before or after the device advances a specified
number of lines. If you specify neither of these options, it is assumed that you are
specifying lines. For example, the following code instructs the device to write a message
after advancing one line:
Although COMS supplies a default setting for carriage control, a processing item can alter
carriage control before an output message reaches its destination. For instructions on how
to alter carriage control, refer to the COMS Programming Guide.
If you specify identifier-3 in the ADVANCING option and the value of identifier-3 is 0, the
MCS ignores the ADVANCING option.
If you implicitly or explicitly specify the ADVANCING option, the following rules apply:
• If you use the BEFORE ADVANCING option, the output device writes the message or
message segment before it repositions the device vertically according to the rules for
identifier-3, integer, and mnemonic-name.
In the following SEND statement, the BEFORE ADVANCING option instructs the
output device to advance two lines after values have been moved into the appropriate
fields of the output headers:
• If you use the AFTER ADVANCING option, the output device writes the message or
message segment after it repositions the device vertically according to the rules for
identifier-3, integer, and mnemonic-name.
• If you specify identifier-3 or integer, the output device repositions characters
vertically downward a number of lines equal to the value of identifier-3 or integer.
• If you specify mnemonic-name, the output device positions characters according to
the rules for that device.
• If you specify the PAGE advancing control, the output device writes characters either
before or after the device is repositioned to the next page (depending on the option
used). For example, in the following SEND statement, the AFTER ADVANCING option
instructs the output device to advance one page after the message has been displayed:
If you specify the PAGE advancing control, but PAGE has no meaning in conjunction
with a specific device, then the output device advances as if you had specified a
BEFORE ADVANCING 1 LINE option or an AFTER ADVANCING 1 LINE option.
Considerations for Use
You cannot use a SEND statement between BEGIN-TRANSACTION and
END-TRANSACTION statements. Doing so violates the rules of synchronized recovery and
you might lose some of the data in your database.
Example
The following example shows SEND statements that specify segmented output using the
WITH ESI and WITH EGI options. The options are specified to hold output until the
message is complete.
WORKING-STORAGE SECTION.
01 MESSAGE-1 PIC X(100).
01 MESSAGE-2 PIC X(100).
01 MESSAGE-3 PIC X(100).
COMMUNICATION SECTION.
INPUT HEADER INHDR.
OUTPUT HEADER OUTHDR.
PROCEDURE DIVISION.
MOVE OUTPUT-SIZE1 TO TEXTLENGTH OF OUTHDR.
MOVE 0 TO STATUSVALUE OF OUTHDR.
SEND OUTHDR FROM MESSAGE-1 WITH ESI.
• CONVERT_TIMESTAMP
• GET_BUFFER_DESIGNATOR
• GET_DESIGNATOR_ARRAY_USING_DESIGNATOR
• GET_DESIGNATOR_USING_DESIGNATOR
• GET_DESIGNATOR_USING_NAME
• GET_ERRORTEXT_USING_NUMBER
• GET_INTEGER_ARRAY_USING_DESIGNATOR
• GET_INTEGER_USING_DESIGNATOR
• GET_NAME_USING_DESIGNATOR
• GET_REAL_ARRAY
• GET_STRING_USING_DESIGNATOR
• STATION_TABLE_ADD
• STATION_TABLE_INITIALIZE
• STATION_TABLE_SEARCH
• TEST_DESIGNATORS
In COBOL74, you can use hyphens (-) rather than underscores (_) in the names of service
functions. The compiler automatically translates hyphens to underscores for use with
COMS.
For a complete discussion of the COMS service functions and their use, refer to the COMS
Programming Guide.
See Also
• Refer to “Mapping COMS Data Types to COBOL74” earlier in this section for
information on the COMS designator data type and its use with COBOL74.
• See the COMS Programming Guide for information about COMS designators.
The COMS entities have designators that can be used in service function calls. Table 3–5
lists the service function mnemonics that you can use to identify particular data items.
The data items indicate the kinds of information that can be requested in a program.
Agenda AGENDA
Database DATABASE
Device designator DEVICE
Device list DEVICE-LIST
Installation data INSTALLATION-DATA
• Use the CALL statement syntax for calling library procedures in COBOL74. The CALL
statement is explained in detail in Volume 1.
• Pass the integer parameters (using unscaled integer values) by name rather than by
value.
Do not perform arithmetic computations on the values returned from the procedure calls.
You can move the values to other locations of a compatible type within your program, and
you can pass them as parameters when calling other library objects. For information on
compatible types, refer to “Mapping COMS Data Types to COBOL74” earlier in this
section.
Note: If the library being called is DCILIBRARY, you must use hyphens (-) in the
mnemonic names. The hyphens are automatically translated to underscores (_)
by the compiler for use with COMS.
Example
The following example shows the use of the CALL statement to pass an agenda designator
to obtain an agenda name. The agenda designator and name used in the example are also
declared in the WORKING-STORAGE SECTION of the program.
The service function result value indicates the result of the service function call. The
result value is returned to the parameter specified in the GIVING clause of the CALL
statement.
See Also
• For more information on the GET_NAME_USING_DESIGNATOR service function,
and for an example of the CALL statement used for this service function, see
“GET_NAME_USING_DESIGNATOR Service Function” later in this section.
• Refer to the COMS Programming Guide for information about the service function
result values.
• Refer to “Passing Parameters to Service Functions” later in this section for
information on valid parameters and examples of the CALL syntax.
General Format of the VALUE Option
You can use the VALUE option with the CALL statement for COMS service functions in
which a mnemonic parameter is passed for a numeric result.
[VALUE mnemonic-1]
ïïïïï
VALUE
This parameter indicates that a service function mnemonic is being passed by value to the
service function.
mnemonic-1
See Also
Refer to “Identifying Information with Service Function Mnemonics” earlier in this section
for information on valid mnemonics.
Example
The following example uses the CALL statement with the VALUE parameter. The
LSN-NUM variable contains the value of the LSN service function mnemonic. SF-RSLT
receives the result of the procedure call. If the result of the procedure call is successful,
SF-RSLT contains a 0 (zero); otherwise, SF-RSLT contains an error code.
For information on valid parameters and an example of program code using the
GET_INTEGER_USING_DESIGNATOR service function, see
“GET_INTEGER_USING_DESIGNATOR Service Function” later in this section.
.
.
WORKING-STORAGE SECTION.
.
77 HDR-STATION REAL.
77 LSN-NUM PIC S9(11) USAGE BINARY.
77 SF-RSLT PIC S9(11) USAGE BINARY.
.
.
PROCEDURE DIVISION.
.
.
CALL "GET-INTEGER-USING-DESIGNATOR OF DCILIBRARY"
USING HDR-STATION
VALUE LSN
LSN-NUM
GIVING SF-RSLT.
• Designators
• Mnemonics
• Arrays
Designators and arrays must be declared in the WORKING-STORAGE SECTION of your
COBOL74 program.
You cannot pass header fields as parameters. To pass fields, you must first move them to a
declared temporary parameter, and then pass the values. The temporary parameter must
be declared as a real value.
The service function declarations and valid parameters for passing service functions in a
COBOL74 program are explained on the following pages. Note the following general
characteristics:
Example
In the following example of the CONVERT_TIMESTAMP service function, SF-RSLT
receives the result of the call to the service function. If the result of the call is successful,
SF-RSLT contains a 0 (zero); otherwise, SF-RSLT contains an error code.
77 WS-TIMESTAMP REAL.
01 WS-TIME PIC X(6).
77 SF-RSLT PIC S9(11) USAGE BINARY.
.
.
.
CALL "CONVERT-TIMESTAMP OF DCILIBRARY"
USING WS-TIMESTAMP
VALUE TIME
WS-TIME
GIVING SF-RSLT.
• A designator
• An integer representing the length of the XATMI buffer in bytes.
Example
In the following example of the GET_BUFFER_DESIGNATOR service function, SF-RSLT
receives the result of the call to the service function. If the result of the call is successful,
SF-RSLT contains a 0 (zero); otherwise, SF-RSLT contains an error code.
.
.
WORKING-STORAGE SECTION.
.
01 WS-TYPE PIC X(8).
01 WS-SUBTYPE PIC X(16).
77 WS-DESG REAL.
77 WS-BUFFER-LENGTH PIC S9(11) USAGE BINARY.
77 SF-RSLT PIC S9(11) USAGE BINARY.
.
.
PROCEDURE DIVISION
.
.
CALL "GET-BUFFER-DESIGNATOR OF DCILIBRARY"
USING WS-TYPE
WS-SUBTYPE
WS-DESG
WS-BUFFER-LENGTH
GIVING SF-RSLT.
• The STATION LIST designator. Because the STATION LIST designator is not a field of
the header, you must first obtain the designator representing the station list by using
the GET_DESIGNATOR_USING_NAME service function. Then use the STATION LIST
designator supplied by that function as the designator variable in the
GET_DESIGNATOR_ARRAY_USING_DESIGNATOR function.
• The total number of designators in the station list by COMS.
The output parameter is a real array containing the designators.
Example
In the following example of the GET_DESIGNATOR_ARRAY_
USING_DESIGNATOR service function, SF-RSLT receives the result of the call to the
service function. If the result of the call is successful, SF-RSLT contains a 0 (zero);
otherwise, SF-RSLT contains an error code.
77 WS-TABLE-DESG REAL.
77 WS-DESG-TABLE-MAX-INDEX PIC S9(11) USAGE BINARY.
01 WS-DESG-TABLE REAL.
05 WS-D-TABLE REAL OCCURS 10 TIMES.
77 SF-RSLT PIC S9(11) USAGE BINARY.
.
.
.
CALL "GET-DESIGNATOR-ARRAY-USING-DESIGNATOR OF DCILIBRARY"
USING WS-TABLE-DESG
WS-DESG-TABLE-MAX-INDEX
WS-DESG-TABLE
GIVING SF-RSLT.
All INSTALLATION_DATA_LINK
Call SERVICE
Example
In the following example of the GET_DESIGNATOR_USING_DESIGNATOR service
function, SF-RSLT receives the result of the call to the service function. If the result of the
call is successful, SF-RSLT contains a 0 (zero); otherwise, SF-RSLT contains an error code.
77 WS-DESG REAL.
77 WS-DESG-RSLT REAL.
77 SF-RSLT PIC S9(11) USAGE BINARY.
.
.
.
CALL "GET-DESIGNATOR-USING-DESIGNATOR OF DCILIBRARY"
USING WS-DESG
VALUE INSTALLATION-DATA-LINK
WS-DESG-RSLT
GIVING SF-RSLT.
Example
In the following example of the GET_ERRORTEXT_USING_NUMBER service function,
SF-RSLT receives the result of the call to the service function. If the result of the call is
successful, SF-RSLT contains a 0 (zero); otherwise, SF-RSLT contains an error code.
.
.
WORKING-STORAGE SECTION.
.
77 WS-ERROR PIC S9(11) USAGE BINARY.
77 WS-TEXT-LENGTH PIC S9(11) USAGE BINARY.
01 WS-ERROR-TEXT PIC X(90).
77 SF-RSLT PIC S9(11) USAGE BINARY.
.
.
PROCEDURE DIVISION
.
.
CALL "GET-ERRORTEXT-USING-NUMBER OF DCILIBRARY"
USING WS-ERROR
WS-TEXT-LENGTH
WS-ERROR-TEXT
GIVING SF-RSLT.
agenda-name of window-name
For installation data, the data with a window value equal to the ALL entity (the default
value) is used if no window is specified and if the window in which the program is
running does not have an entity of the same name.
The output parameter is a designator.
Example
In the following example of the GET_DESIGNATOR_USING_NAME service function,
SF-RSLT receives the result of the call to the service function. If the result of the call is
successful, SF-RSLT contains a 0 (zero); otherwise, SF-RSLT contains an error code.
All INSTALLATION_INTEGER_ALL
Program MIXNUMBERS
.
.
.
77 WS-DESG REAL.
77 WS-INT-TABLE-MAX-INDEX PIC S9(11) USAGE BINARY.
77 SF-RSLT PIC S9(11) USAGE BINARY.
01 WS-INT-TABLE USAGE BINARY.
03 WS-INT-TABLE-DETAIL PIC S9(11) OCCURS 10 TIMES.
.
.
.
CALL "GET-INTEGER-ARRAY-USING-DESIGNATOR OF DCILIBRARY"
USING WS-DESG
VALUE INSTALLATION-INTEGER-ALL
WS-INT-TABLE-MAX-INDEX
WS-INT-TABLE
GIVING SF-RSLT.
All INSTALLATION_INTEGER_1, 2, 3, 4
Station LSN
Example
In the following example of the GET_INTEGER_USING_DESIGNATOR service function,
SF-RSLT receives the result of the call to the service function. If the result of the call is
successful, SF-RSLT contains a 0 (zero); otherwise, SF-RSLT contains an error code.
77 WS-DESG REAL.
77 WS-INT PIC S9(11) USAGE BINARY.
77 SF-RSLT PIC S9(11) USAGE BINARY.
.
.
.
CALL "GET-INTEGER-USING-DESIGNATOR OF DCILIBRARY"
USING WS-DESG
VALUE INSTALLATION-INTEGER-1
WS-INT
GIVING SF-RSLT.
Example
In the following example of the GET_NAME_USING_DESIGNATOR service function,
SF-RSLT receives the result of the call to the service function. If the result of the call is
successful, SF-RSLT contains a 0 (zero); otherwise, SF-RSLT contains an error code.
77 WS-DESG REAL.
01 WS-NAME PIC X(30).
77 SF-RSLT PIC S9(11) USAGE BINARY.
.
.
.
CALL "GET-NAME-USING-DESIGNATOR OF DCILIBRARY"
USING WS-DESG
WS-NAME
GIVING SF-RSLT.
The input parameter is a mnemonic representing the requested function. The only
allowable mnemonic is STATISTICS, which returns a table. Each table entry contains the
following six items. (The input parameter items that show DCI library in parentheses are
passed from DCI library programs only, and not from remote files.)
• Entity designator
• Type of entity, as follows:
Entry Code Entity Represented
3 MCS window
77 WS-DESG REAL.
77 WS-STRING-MAX-CHAR PIC S9(11) USAGE BINARY.
01 WS-STRING PIC X(30).
77 SF-RSLT PIC S9(11) USAGE BINARY.
.
.
.
MOVE SPACES TO WS-STRING.
CALL "GET-STRING-USING-DESIGNATOR OF DCILIBRARY"
USING WS-DESG
VALUE INSTALLATION-STRING-1
WS-STRING-MAX-CHAR
WS-STRING
GIVING SF-RSLT.
Example
The following example shows the declarations and statements for the station table service
functions. After the execution of the code in the example, STATION-SEARCH-RESULT
will contain the index of the station designator in the hash table.
.
.
.
WORKING STORAGE SECTION.
.
.
.
01 STATION-HASH REAL.
02 STATION-DESIGNATOR REAL OCCURS 100.
77 STATION-SEARCHRESULT PIC S9(11) BINARY.
77 STATION-SEARCH-DESIGNATOR REAL.
77 STATION-SEARCH-MODULUS PIC S9(11) BINARY.
.
.
.
PROCEDURE DIVISION.
.
.
.
If one designator is contained within the list of the other designator, a value of 0 is
returned. If not, an error occurs and a value of 2 is returned.
Example
In the following example of the TEST_DESIGNATORS service function, SF-RSLT receives
the result of the call to the service function:
77 WS-DESG REAL.
77 WS-DESG-RSLT REAL.
77 SF-RSLT PIC S9(11) USAGE BINARY.
.
.
.
CALL "TEST-DESIGNATORS OF DCILIBRARY"
USING WS-DESG
WS-DESG-RSLT
GIVING SF-RSLT.
See Also
• Information on synchronized recovery when COMS is used with DMSII is provided in
the explanation of the CLOSE statement under “CLOSE Statement” in Section 4,
“Using the DMSII Program Interface.”
• Information on TADS is provided in the COBOL ANSI-74 Test and Debug System
(TADS) Programming Guide.
All transactions in the program are two-phase transactions. In phase 1, all records are
locked. In phase 2, the data is stored in the database and only the END-TRANSACTION
statement unlocks records. All transactions instruct COMS to audit the input message
when the END-TRANSACTION statement takes the program out of transaction state.
021000******************************************************************
021100 100-PROCESS-TRANSACTION SECTION.
021200******************************************************************
021220* Because the transaction type is programmatically based on
021240* the MFI, make sure that the type is within range before
021260* exiting to the appropriate subprogram.
021280*
021300 100-PROCESS-TRANS-SN.
021400 IF MSG-TCODE = "CRERAC"
021500 PERFORM 200-CREATE-RACE
021600 ELSE
021700 IF MSG-TCODE = "ADDENT"
021800 PERFORM 300-ADD-ENTRY
021900 ELSE
022000 IF MSG-TCODE = "DELENT"
022100 PERFORM 400-DELETE-ENTRY
022200 ELSE
022300 MOVE "INVALID TRANS CODE" TO MSG-STATUS
022320 PERFORM 900-SEND-MSG.
022340
022400 100-PROCESS-TRANS-EXIT.
022500 EXIT.
022600
022700******************************************************************
022800 200-CREATE-RACE SECTION.
022900******************************************************************
023000 200-CREATE-RACE-SN.
023020* Enter a new race record in the database.
023050* If there is an abort on the BEGIN-TRANSACTION or
023060* END-TRANSACTION statement, return to the RECEIVE statement.
023080
023100 CREATE RACE-CALENDAR.
023200 MOVE MSG-CR-NAME TO RACE-NAME.
023300 MOVE MSG-CR-ID TO RACE-ID.
023400 MOVE MSG-CR-DATE TO RACE-DATE.
023500 MOVE MSG-CR-TIME TO RACE-TIME.
023600 MOVE MSG-CR-LOCATION TO RACE-LOCATION.
023700 MOVE MSG-CR-SPONSOR TO RACE-SPONSOR.
023800
023900* BEGIN-TRANSACTION COMS-IN USING MSG-TEXT NO AUDIT RDS
023950 BEGIN-TRANSACTION COMS-IN NO-AUDIT RDS
024000 ON EXCEPTION
024100 IF DMSTATUS(ABORT)
024200* THEN MUST GET BACK TO RECEIVE STMT
024300 GO TO 200-CREATE-RACE-EXIT
024400 ELSE
024500 CALL SYSTEM DMTERMINATE.
024600* MOVE COMS-IN-RST-LOC TO RDS-LOCATOR.
024700 STORE RACE-CALENDAR.
024800 IF DMSTATUS(DMERROR)
024900 MOVE "STORE ERROR" TO MSG-STATUS
025000 ELSE
029900 GO TO 300-ADD-ENTRY-EXIT
030000 ELSE
030100 CALL SYSTEM DMTERMINATE.
030200 PERFORM 900-SEND-MSG.
030300 300-ADD-ENTRY-EXIT.
030400 EXIT.
030500
030600******************************************************************
030700 400-DELETE-ENTRY SECTION.
030800******************************************************************
030900 400-DELETE-ENTRY-SN.
030920* Delete a boat from a race. The restart requirements are the
030940* same as for the previous transaction.
030960
031000 LOCK ENTRY-RACE-SET AT
031790 ENTRY-RACE-ID = MSG-DE-RACE-ID AND
031200 ENTRY-BOAT-ID = MSG-DE-ID
031300 ON EXCEPTION
031400 IF DMSTATUS(NOTFOUND) THEN
031500 MOVE "BOAT ENTRY NOT FOUND" TO MSG-STATUS
031600 GO TO DE-SEND-MSG
031700 ELSE
031800 CALL SYSTEM DMTERMINATE.
031900
032000* BEGIN-TRANSACTION COMS-IN USING MSG-TEXT NO-AUDIT RDS
032050 BEGIN-TRANSACTION COMS-IN NO-AUDIT RDS
032100 ON EXCEPTION
032200 IF DMSTATUS(ABORT)
032300* THEN MUST GET BACK TO RECEIVE STMT
032400 GO TO 400-DELETE-ENTRY-EXIT
032500 ELSE
032600 CALL SYSTEM DMTERMINATE.
032700* MOVE COMS-IN-RST-LOC TO RDS-LOCATOR.
032800 DELETE ENTRY.
032900 IF DMSTATUS(DMERROR)
033000 MOVE "FOUND BUT NOT DELETED" TO MSG-STATUS
033100 ELSE
033200 MOVE "BOAT DELETED" TO MSG-STATUS.
033300 END-TRANSACTION COMS-OUT AUDIT RDS
033400 ON EXCEPTION
033500 IF DMSTATUS(ABORT)
033600 GO TO 400-DELETE-ENTRY-EXIT
033700 ELSE
033800 CALL SYSTEM DMTERMINATE.
033900 DE-SEND-MSG.
034000 PERFORM 900-SEND-MSG.
034100 400-DELETE-ENTRY-EXIT.
034200 EXIT.
034300
034400******************************************************************
034500 900-SEND-MSG SECTION.
034600******************************************************************
034700 900-SEND-MSG-SN.
034720* Send the message back to the originating station.
034740* Do not specify an output agenda. Test the result
034760* of the SEND statement.
034780*
034800 MOVE 1 TO COMS-OUT-COUNT.
034950 MOVE 0 TO COMS-OUT-DESTINATION.
035000 MOVE 0 TO COMS-OUT-STATUS-KEY.
035100 MOVE 106 TO COMS-OUT-TEXT-LENGTH.
035200 SEND COMS-OUT FROM MSG-TEXT.
035300 IF COMS-OUT-STATUS-KEY = 0 OR 92
035400 NEXT SENTENCE
035500 ELSE
035600 DISPLAY "ONLINE PROGRAM SEND ERROR: " COMS-OUT-STATUS-KEY.
035700 900-SEND-MSG-EXIT.
035800 EXIT.
035900******************************************************************
036000 910-CLOSEDOWN SECTION.
036100******************************************************************
036200 910-CLOSEDOWN-SN.
036220* Close the database.
036240
036300 BEGIN-TRANSACTION NO-AUDIT RDS.
036400* Recreate RDS and store RDS.
036600 END-TRANSACTION NO-AUDIT RDS.
036700 CLOSE SAILDB.
036800 910-CLOSEDOWN-EXIT.
036900 EXIT.
037000******************************************************************
037100 920-CHECK-COMS-INPUT-ERRORS SECTION.
037200******************************************************************
037300 920-CHECK-CIE-SN.
037320* Check for COMS control messages.
037340
037400 IF ( COMS-IN-STATUS-KEY = 0 OR 92 OR 99 )
037450
037500* These codes signify a successful message, a recovery
037550* message and an EOT notification, respectively.
037575*
037600 NEXT SENTENCE
037650
037700 ELSE
037800 IF COMS-IN-STATUS-KEY = 93
037900 MOVE "MSG CAUSES ABORT, PLS DONT RETRY" TO MSG-STATUS
038000 PERFORM 900-SEND-MSG
038100 ELSE
038150
038200* The COMS control message is 20, 100, 101, or 102. These
038300* values mean the application is manipulating the dynamic
See Also
For more information on TADS, see the COBOL ANSI-74 TADS Guide.
The program contains three transactions. Each transaction has a unique trancode and a
unique MFI. The trancode CRERAC creates a race entry in the database. ADDENT adds a
boat entry to a race. The race must exist for the transaction to be completed. DELENT
deletes a boat from a race.
The program also contains the coding required by TADS. The program must be compiled
with the TADS option and the TADS diagnostic station specified. No changes need to be
made to the program if TADS is not present.
The program sample contains comments to indicate the program actions at each step.
013900 005-MAIN-EXIT.
014000 PERFORM 910-CLOSEDOWN.
014100 STOP RUN.
014200
014300*****************************************************************
014400 007-PROCESS-COMS-INPUT SECTION.
014500*****************************************************************
014600* Get the next message from COMS. If the message is 99, go to
014625* end of task (EOT); otherwise, make sure that the message
014700* is valid before processing it.
014800
014900 007-PROCESS-CI-SN.
015000 MOVE SPACES TO MSG-TEXT.
015100 RECEIVE COMS-IN MESSAGE INTO MSG-TEXT.
015200 IF COMS-IN-STATUS-KEY NOT = 99
015300 PERFORM 920-CHECK-COMS-INPUT-ERRORS
015400 IF ( COMS-IN-STATUS-KEY = 0 OR 92) AND
015500 COMS-IN-FUNCTION-STATUS NOT < 0 THEN
015600 PERFORM 100-PROCESS-TRANSACTION.
015700 007-PROCESS-CI-EXIT.
015800 EXIT.
015900
016000******************************************************************
016100 100-PROCESS-TRANSACTION SECTION.
016200******************************************************************
016300* Because the transaction type is programmatically based
016400* on MFI, make sure that it is within range before
016450* exiting to a subprogram.
016500
016600 100-PROCESS-TRANS-SN.
016700 MOVE 0 TO E-RACE, E-BOAT.
016800 IF MSG-TCODE = "CRERAC"
016900 PERFORM 200-CREATE-RACE
017000 ELSE
017100 IF MSG-TCODE = "ADDENT"
017200 PERFORM 300-ADD-ENTRY
017300 ELSE
017400 IF MSG-TCODE = "DELENT"
017500 PERFORM 400-DELETE-ENTRY
017600 ELSE
017700 MOVE "INVALID TRANS CODE" TO MSG-STATUS
017800 PERFORM 900-SEND-MSG.
017900
018000 100-PROCESS-TRANS-EXIT.
018100 EXIT.
018200
018300******************************************************************
018400 200-CREATE-RACE SECTION.
018500******************************************************************
018600 200-CREATE-RACE-SN.
018700* Enter a new race in the database.
018800
029500 GO TO DE-SEND-MSG.
029600 DISCARD ENT.
029700 BEGIN-TRANSACTION
029800 ON EXCEPTION
029900 PERFORM 905-SIM-ERR-RTN
030000 GO TO DE-SEND-MSG.
030100 DELETE ENTRY WHERE ENTRY-RACE-ID = NUM-KEY AND
030200 ENTRY-BOAT-ID = MSG-DE-ID
030300 ON EXCEPTION
030400 PERFORM 905-SIM-ERR-RTN.
030500 IF DMSTATE
030600 MOVE "Delete Error" TO MSG-STATUS
030700 ELSE
030800 MOVE "Boat deleted" TO MSG-STATUS.
030900 END-TRANSACTION COMS-OUT
031000 ON EXCEPTION
031100 PERFORM 905-SIM-ERR-RTN.
031200 DE-SEND-MSG.
031300 PERFORM 900-SEND-MSG.
031400 400-DELETE-ENTRY-EXIT.
031500 EXIT.
031600
031700******************************************************************
031800 900-SEND-MSG SECTION.
031900******************************************************************
032000 900-SEND-MSG-SN.
032100* Send the message back to the originating station.
032150* Do not specify an output agenda.
032200* Test the result of the SEND statement.
032300
032400 MOVE 1 TO COMS-OUT-COUNT.
032500 MOVE 0 TO COMS-OUT-DESTINATION.
032600 MOVE 0 TO COMS-OUT-STATUS-KEY.
032700 MOVE 116 TO COMS-OUT-TEXT-LENGTH.
032800 SEND COMS-OUT FROM MSG-TEXT.
032900 IF COMS-OUT-STATUS-KEY = 0 OR 92
033000 NEXT SENTENCE
033100 ELSE
033200 DISPLAY "On-line program SEND error: " COMS-OUT-STATUS-KEY.
033300 900-SEND-MSG-EXIT.
033400 EXIT.
033500******************************************************************
033600 905-SIM-ERR-RTN SECTION.
033700******************************************************************
033800 905-SIM-ERR-RTN-SN.
033900* Get the error message from SIM. The message can be
033950* 176 bytes in length.
033955*
034000 DISPLAY "SIM Error: Race=", E-RACE, " Boat=", E-BOAT.
034100 CALL SYSTEM DMEXCEPTIONMSG GIVING WS-MSG.
034200 DISPLAY MSG-1.
034300 DISPLAY MSG-2.
034400 905-SIM-ERR-RTN-EXIT.
034500 EXIT.
034600******************************************************************
034700 910-CLOSEDOWN SECTION.
034800******************************************************************
034900 910-CLOSEDOWN-SN.
035000* Close the database.
035100 CLOSE SIMSAILDB.
035200 910-CLOSEDOWN-EXIT.
035300 EXIT.
035400******************************************************************
035500 920-CHECK-COMS-INPUT-ERRORS SECTION.
035600******************************************************************
035700 920-CHECK-CIE-SN.
035800* Check for COMS control messages.
035900
036200 IF ( COMS-IN-STATUS-KEY = 0 OR 92 OR 99 )
036250* The codes signify a successful message, a recovery
036300* message, or an EOT notification, respectively.
036350*
036400 NEXT SENTENCE
036500 ELSE
036600 IF COMS-IN-STATUS-KEY = 93
036700 MOVE "93: MSG CAUSED ABORT, DONT RETRY" TO MSG-STATUS
036800 PERFORM 900-SEND-MSG
036900 ELSE
036950* COMS-IN STATUS-KEY is 20, 100, 101, or 102. These
037000* values mean the application is manipulating the
037100* dynamic attachment or detachment of stations, and has
037200* received an error.
037300 DISPLAY COMS-IN-STATUS-KEY
037400 MOVE "ERROR IN STA ATTACH/DETACHMENT" TO MSG-STATUS
037500 PERFORM 900-SEND-MSG.
037600
037700 IF COMS-IN-FUNCTION-STATUS < 0 THEN
037800* This statement means that the application ID is tied
037900* to a default input agenda. MSG-TEXT probably does not
037950* contain a valid transaction.
038000 MOVE "NEGATIVE FUNCTION CODE " TO MSG-STATUS
038100 DISPLAY COMS-IN-FUNCTION-STATUS
038200 PERFORM 900-SEND-MSG-SN THRU 900-SEND-MSG-EXIT.
038300
038400 920-CHECK-CIE-EXIT.
038500 EXIT.
038600
This section explains how to use the extensions developed for the DMSII application
program interface. The DMSII extensions allow you to perform the following tasks:
The DMSII program interface can be used with the Advanced Data Dictionary System
(ADDS), Communications Management System (COMS), DMSII transaction processing
system (TPS), and the Semantic Information Manager (SIM). For more information on the
extensions developed for one of these products, see the section that provides an
explanation of that product.
See Also
• For additional information on using ADDS with DMSII, see the InfoExec ADDS
Operations Guide.
• For additional information on using COMS with DMSII, see the COMS Programming
Guide.
• For additional information on using SIM with DMSII, see the InfoExec Semantic
Information Manager (SIM) Programming Guide.
If you invoke a data set more than once and that data set uses internal names to invoke
two paths, you must qualify each path by the data set that it spans. If you use improper or
insufficient qualification, you receive a syntax error.
You qualify an item name by the name of any structure that physically contains the item.
You can use any number of qualifying names as long as the result is unique.
A set name can be qualified by the name of the data set it spans. A group name can qualify
an item contained within the group.
Note that the compiler usually issues a syntax error when qualification is logically
required but not provided. However, unexpected results can still occur, even when the
compiler does not issue a warning. If qualification is insufficient, the compiler usually uses
the last item declared or invoked in the program that has the same name as the variable.
To avoid unexpected results, do one or both of the following when invoking DMSII data
sets more than once in the same program:
Examples
The following examples show code in which name qualification is needed or in which a
successful or unsuccessful attempt has been made to provide qualification. The applicable
DASDL descriptions precede examples.
The following DASDL description is used by the COBOL74 code in the following example:
In the following example, XYZ declared at level 77 is invalid because it cannot be qualified.
However, XYZ declared at level 03 is valid because it can be qualified.
The following DASDL description is used by the COBOL74 code in the following example:
DB DBASE.
01 D1.
01 DA=D1.
FIND S1 OF D1 AT A=V.
MOVE A OF D1 TO LA.
The record area for a data set is established in two parts: one part contains control items,
and the other contains data items. You code the data items just as an 01-level
WORKING-STORAGE SECTION entry, with appropriate lower level entries. This setup
enables you to use the data manipulation statements to move database items, including
groups.
Group moves are always considered alphanumeric moves. The arrangement of the data
item record area also enables you to use MOVE CORRESPONDING statements. For more
information on MOVE statements, refer to Volume 1.
If you use variable-format records in your programs, a group move at the 01-level fills the
receiving area without regard to the individual items contained within either the sending
or receiving area. Using variable-format records can therefore cause unexpected values to
be stored in the receiving area. For MOVE CORRESPONDING statements, only items in
the fixed portion of the record are candidates for the move.
Examples
The following examples reference database items that contain compiler-produced listings.
The following example illustrates a group move involving database items. The items T, CT,
L, E, and S are control items and are not affected by moves to or from D.
01 D
02 A
02 B
02 C
03 E1
03 E2.
E1 and E2 are items of the record area for E rather than D; therefore, these items are not
affected by moves to or from D.
The following example shows database items that will be used in a MOVE
CORRESPONDING statement. The items contained in the record depend on the value of T
as follows:
The items X and Y are never moved as a result of a MOVE CORRESPONDING statement.
01 D
02 T RECORDTYPE.
02 A PIC X(6) DISPLAY.
02 B PIC 9(6) COMP.
* FORMAT TYPE 1.
02 X PIC 9(6) COMP.
* FORMAT TYPE 2.
02 Y PIC 9(11) COMP.
The following DASDL description is used by the COBOL74 code in the following example:
DASDL:
C COMPACT DATASET
(N NUMBER (1);
X NUMBER (5) OCCURS 9 TIMES DEPENDING ON N);
The following example shows three lines of COBOL74 code that use MOVE statements. In
the statements, the variable N in the DASDL description equals 5. The first and second
lines execute successfully. The third line, however, creates an invalid index error because
MOVE 5 TO N.
Declaring a Database
The DATA-BASE SECTION of a COBOL74 program supplies the COBOL74 compiler with a
description of all or selected portions of one or more databases. You place the
DATA-BASE SECTION in the DATA DIVISION after the FILE SECTION and before the
WORKING-STORAGE SECTION.
The database declaration supplies information that identifies a given database. The
compiler lists all the invoked descriptions of record formats, items, sets, subsets, and
keys.
General Format
The general format for a database declaration is as follows:
Ú ¿
³ ä å ³
³ ³INVOKE³ ³
DB ³data-name-1 ãïïïïïïâ ³ [ data-name-2 OF ] data-name-3
³ ³= ³ ³ ïï
³ æ ç ³
À Ù
[ GLOBAL ]
ïïïïïï
[ ALL ]
ïïï
[ VALUE OF TITLE IS literal-1 ]
ïïïïï ïï ïïïïï
data-name-1
This format element specifies the internal name of the database, data sets, sets, or subsets
within the program.
You can invoke a database, data set, set, or subset more than once; however, you must use
the external name to reference only one invocation of each structure. Data-name-1 must
be used to provide unique names for all other invocations of the structures. The default
internal name is the external name of the structure.
You can establish multiple record areas and set paths, or both, by specifying data-name-1
with a data set reference or set reference. In this way, several records of a single data set
can be manipulated simultaneously.
These format elements invoke a database, data set, set or subset. The INVOKE option and
the equal sign (=) are synonyms.
When you use the INVOKE option in your program, you must use the internal names of
renamed structures in all subsequent references to the structures. A structure using an
alias identifier can be a string literal enclosed in quotation marks (“”).
data-name-2
This format element enables the program to reference a logical database. A program can
invoke structures selectively from a logical database, or it can invoke the entire logical
database. You can specify selective invocations such as physical databases; however, you
can select only those structures that are included in the logical database.
data-name-3
This format element designates the name of the database to be invoked. You can use
data-name-3 as a qualifier of a data set, set, or subset. If you use the INVOKE clause,
data-name-3 can be a string literal enclosed in quotation marks (“”).
GLOBAL
ALL
This option specifies that all structures of the specified database are to be used.
VALUE OF
This option specifies the file attribute name. The only mnemonic allowed in the VALUE
OF option is TITLE. For more information about the VALUE OF clause, refer to Volume 1.
literal-1
This format element designates the name of the file attribute. Literal-1 can be a string
literal enclosed in quotation marks (“”).
Examples
The following examples show varied formats you can use to declare a database:
DB DATABASE-1.
DB MY-DB-2 = DATABASE-2.
DB DATABASE-3 GLOBAL.
DB DATABASE-5 ALL.
DB DATABASE-6.
01 DATASET-1.
01 DATASET-2.
The maximum number of structures that can be invoked by a user program is 4000. Only
1000 of the invoked structures can be data sets or remaps.
General Format
The general format for the data set reference is as follows:
Ú ¿
³ ä å ³
³ ³INVOKE³ ³
01 ³data-name-1 ãïïïïïïâ ³
³ ³= ³ ³
³ æ ç ³
À Ù
ä å
³ Ú ¿ ³
³ ³ ä å ³ ³
³ ³ ³NONE ³ ³ ³
³ ³ ³ïïïï ³ ³ ³
³ ³ ³Ú ¿ ³ ³ ³
³ ³ ³³ ä å ³ ³ ³ ³
ãdata-name-2 ³USING ã³ ³INVOKE³ ³ â ³ â
³ ³ïïïïï ³³data-name-3 ãïïïïïïâ ³ data-name-4 ...³ ³ ³
³ ³ ³³ ³= ³ ³ ³ ³ ³
³ ³ ³³ æ ç ³ ³ ³ ³
³ ³ ³À Ù ³ ³ ³
³ ³ æ ç ³ ³
³ À Ù ³
ædata-name-5 ç
data-name-1
This format element designates the internal name of the data set or set.
These format elements invoke only the data sets that you specify if you use the data set
reference. If you do not use the data set reference, you implicitly invoke all structures of
the specified database.
You cannot invoke only the global data from a database; you must invoke at least one
structure. You can invoke the structure explicitly in the data set reference, or implicitly by
default or by using the ALL option in the database statement.
data-name-2
This format element must be the name of the data set to be used. You can use data-name-2
as a qualifier for its embedded structures. If the INVOKE option is used, data-name-2 can
be a string literal enclosed in quotation marks (“”).
USING
This option invokes specific sets from the data sets declared in the data set reference. If
you omit the USING option, you invoke all sets. If you specify the USING option, you
invoke either no sets (NONE) or only the specified sets.
data-name-3
This format element contains the name of a set. You can use data-name-3 in your program
to reference a synonym for the set specified by data-name-4. All subsequent references to
the set previously specified as data-name-4 must use the name specified for data-name-3.
data-name-4
data-name-5
This format element is a set reference that is not implicitly associated with any particular
record area. When you choose data-name-5, data-name-1 must be the name of a set. You
must specify the data set name VIA option in the selection expression to load a record
area by using data-name-5.Additional information on the VIA option is provided in “Using
Selection Expressions” later in this section.
To use a path, you must invoke the disjoint data set. You establish a path by invoking a
data set containing either of the following:
You invoke remaps declared in DASDL the same way as you invoke conventional data
sets.
The following example shows the establishment of one current record area for the data
set D, one path for the set S1, and one path for the set S2. If you execute either of the
following statements, the program automatically loads the data to the D record area: FIND
S1, MODIFY S1, FIND S2, or MODIFY S2. S1 and S2 are invoked implicitly.
01 D.
The following example shows the establishment of two current record areas (D and X)
and two paths (S1 and S2). The sets S1 and S2 are implicitly associated with the D record
area. The USING NONE option prevents a set from being associated with the X record
area. Thus, the FIND S1 or FIND S2 statement loads the D record area. The FIND X VIA S1
or FIND X VIA S2 statement must be executed to load the X record area using a set.S1 and
S2 are invoked implicitly.
01 D.
The following example shows how multiple current record areas and multiple current
paths can be established. The FIND S1 OF D statement loads the D record area without
disturbing the path S1 OF X, and the FIND S1 OF X statement loads the X record area
without disturbing the path S1 OF D. The S1 set must be qualified. S1 and S2 are invoked
implicitly.
01 D.
01 X=D.
The following example shows how to establish more current record areas than paths. The
three record areas (D, X, and Y) are established with only two paths (S1 OF D and S1 OF
X). The program must execute the following statements to load the Y record area: FIND Y
VIA S1 OF D, FIND Y VIA S1 OF X, or FIND Y. S1 is invoked explicitly.
01 D USING S1.
The following example shows how the USING clause syntax can be used to explicitly
associate a set with a given record area. The FIND S1 statement loads the X record area,
and the FIND T statement loads the Y record area. The S1 and T sets both use the same
key.
The following example shows how the set reference can be used to establish a set that is
not implicitly associated with any particular record area. The FIND D VIA SY statement
must be executed to load a record area using the set S1.
01 D.
01 SY=S1.
In the following example, the data set references are not specified to invoke the E and F
data sets; however, the paths are established by invoking the embedded set SE and the
link item LINK:
01 D.
The paths established in the preceding example, however, cannot be used unless they are
specified as data set references for the E and F data sets to establish record areas for
these paths, as shown in the following lines of code:
01 F.
01 E.
01 D.
The following example shows the commented code as it appears in the listing. For logical
database LDB2, the following sets are visible to the user program:
IDENTIFICATION DIVISION.
PROGRAM-ID. DBTEST.
DATA DIVISION.
DATA-BASE SECTION.
DB LDB2 OF EXAMPLEDB ALL.
* 01 D1 STANDARD DATA SET(#2).
* S1 SET(#4,AUTO) OF D1 KEYS ARE A,B,C.
* 02 A REAL.
* 02 B PIC 9(5) COMP.
* 02 C PIC X(10) DISPLAY.
* 01 D2 STANDARD DATA SET(#5).
* S2 SET(#9,AUTO) OF D2 KEYS ARE X,Y,Z.
* 02 X FIELD SIZE IS 08 BITS.
* 02 Y PIC 99 COMP.
* 02 Z REAL.
* 02 E STANDARD DATA SET(#6).
* SE SET(#7,AUTO) OF E KEY IS V1.
* 03 V1 REAL.
* 03 V2 PIC XX DISPLAY.
PROCEDURE DIVISION.
T.
STOP RUN.
The following DASDL description is used by the COBOL74 code in the following two
examples:
Using a Separately Compiled Procedure to Reference a Database with the GLOBAL Option
$ LEVEL=3
.
.
.
DATA-BASE SECTION.
DB TESTDB GLOBAL ALL.
PROCEDURE DIVISION.
P1.
SET NAMESET TO BEGINNING.
SET NAMESET TO BEGINNING.
PERFORM P2 UNTIL DMSTATUS (DMERROR) = 1.
P2.
FIND NEXT NAMESET AT LAST = "SMITH" AND FIRST = "JOHN".
* OTHER STATEMENTS
The following Work Flow Language (WFL) program binds the SEP/HOST procedure with
the COBOL74 program. Refer to the Work Flow Language (WFL) Programming
Reference Manual for more information on using WFL.
Using a DMSII Host Program to Call a Separately Compiled Procedure That References the
Same Database
The following example shows the COBOL74 program declarations for the DMSII host
program and the corresponding database reference. The program is compiled as
SEP/HOST.
.
.
DATA-BASE SECTION.
DB TESTDB ALL.
PROCEDURE DIVISION.
DECLARATIVES.
P SECTION. USE EXTERNAL AS PROCEDURE.
END DECLARATIVES.
P1.
OPEN UPDATE TESTDB.
CALL P.
CLOSE TESTDB.
STOP RUN.
A database equation is like a file equation. A WFL equation overrides the specification of a
database title in a language declaration, and run-time modification of a database title
overrides both WFL equations and user language specifications. However, a database
equation differs from a file equation in that a run-time error results if a COBOL74 program
attempts to set or examine the TITLE attribute of the database while it is open.
The MOVE statement and the CHANGE statement manipulate the database TITLE
attribute during program execution. For information on the use of the TITLE attribute, see
the discussion of file attributes in Volume 1. Also refer to Volume 1 for more detailed
information on the MOVE and CHANGE statements.
Note: When the database is accessed, the system verifies that the description of the
database matches the description applied at the time the program was compiled.
If this verification is unsuccessful, the program receives an exception on the
access or terminates. Use of a database title equation is thus limited to cases in
which the description file for the database that was originally named in the
program matches that of the database referenced in the run-time database
equation statement.
General Format
The general format of the MOVE and CHANGE statements is as follows:
ä å ä å
³MOVE ³ ³OF³
ãïïïï â ATTRIBUTE TITLE ãïïâ internal-name
³CHANGE³ ïïïïïïïïï ïïïïï ³IN³
æïïïïïïç æïïç
TO alphanumeric-data-item
ïï
Example
In the following example, the first OPEN statement opens the LIVEDB database. The data
and control files of LIVEDB are stored under the disk directory of the user. The second
OPEN statement opens TESTDB. The files for TESTDB are stored on TESTPACK under
the usercode UC.
Later in this section, Example 4–1, “DMSII Sample Program,” shows the MOVE statement
within the context of a complete program.
IDENTIFICATION DIVISION.
PROGRAM-ID. DBEQUATE.
.
.
.
DATA-BASE SECTION.
DB MYDB ALL
VALUE OF TITLE IS "LIVEDB".
.
.
.
OPEN UPDATE MYDB.
.
.
.
CLOSE MYDB.
CHANGE ATTRIBUTE TITLE OF MYDB
TO "(UC)TESTDB ON TESTPACK".
OPEN UPDATE MYDB.
.
.
.
CLOSE MYDB.
STOP RUN.
General Format
The general format for selection expressions is as follows:
ä[ data-name-1 VIA ] å
³ ïïï ³
³ ä å ³
³ ³Úä å ¿ ³ ³
³ ³³³FIRST³ ³ Ú ¿ ³ ³
³ ³³³ïïïïï³ ³ ³ä å ³ ³ ³
³ ³³³LAST ³ ³ ³³AT ³ ³ ³ ³
³ ã³ãïïïï â ³ data-name-2 ³ãïï â key condition³ â ³
³ ³³³NEXT ³ ³ ³³WHERE³ ³ ³ ³
³ ³³³ïïïï ³ ³ ³æïïïïïç ³ ³ ³
³ ³³³PRIOR³ ³ À Ù ³ ³
ã ³Àæïïïïïç Ù ³ â
³ ædata-name-3 ç ³
³ Úä å ¿ ³
³ ³³FIRST³ ³ ³
³ ³³ïïïïï³ ³ ³
³ ³³LAST ³ ³ ³
³ ³ãïïïï â ³ data-name-4 ³
³ ³³NEXT ³ ³ ³
³ ³³ïïïï ³ ³ ³
³ ³³PRIOR³ ³ ³
³ Àæïïïïïç Ù ³
æ ç
data-name-1
This format element identifies the record area and current path that are affected if the
desired record is found. You can use this option for link items and for sets not implicitly
associated with the data set.
VIA
This option indicates the path to be taken to identify the record in the data set.
FIRST
This option selects the first record in the specified data set, set, or subset. FIRST is
specified by default. If you specify a key condition, DMSII selects the first record that
satisfies the key condition.
LAST
This option selects the last record in the specified data set, set, or subset. If you specify a
key condition, DMSII selects the last record that satisfies the key condition.
However, the record returned might not always be the absolute last record. Assume that
program A performs a LOCK LAST operation when program B has the last record locked.
Assume also that while program A is waiting, one or more records are added to the data
set, set, or subset. The record program A receives is the last record that existed when
program A performed the LOCK LAST and began its wait for the record, not the last
existing record at the time program B released the record.
NEXT
This option selects the next record relative to either of the following:
PRIOR
This option selects the prior record relative to either of the following:
data-name-2
This option identifies the record referred to by the set path. Data-name-2 must be a set or
a subset. DMSII returns a NOTFOUND exception if the record has been deleted or if the
path does not refer to a valid current record.
AT or WHERE
This option indicates that a key condition follows. AT and WHERE are synonyms.
key condition
This format element selects the particular record to be located in the selection expression.
A key condition is an expression that ultimately evaluates to a TRUE or FALSE value.
A key condition is composed of the parts shown in the following table. The parts of the
key condition must be present in the order listed.
You can repeat the key condition construction one or more times to create a more
complex condition. Use left and right parentheses to indicate precedence, if desired or
required.
data-name-3
This format element specifies a link item defined in DASDL. DMSII selects the record to
which the link item refers and returns an exception if the link item is NULL.
data-name-4
This format element selects the record referred to by the data set path. DMSII returns a
NOTFOUND exception if the record has been deleted or if the path does not refer to a
valid current record. Data-name-4 must be a data set name.
Example
The following example locates the record S where A is equal to 50 and B is equal to 50, or
it locates the record S where A is equal to 50 and C is less than 90. The example also
locates the record S where A is equal to the literal “MYNAME”. Note that in the following
example, “A = 50 AND (B = 50 OR C <90)” and “A = "MYNAME"” are key conditions.
Count Attribute
The value of the count attribute is the number of counted references pointing at the record
in the Count field.
Because the ASSIGN statement updates a count item directly in the database, the value of
the Count field can differ from the actual value in the database, even if the field is tested
immediately after the record containing the Count field is made current.
DMSII returns an exception when you attempt to delete a record and the count item is not
0 (zero).
General Format
The general format for the count attribute is as follows:
data-name-1 (data-name-2)
data-name-1
data-name-2
This format element designates a count name. The use of data-name-2 enables read-only
access to the Count field of a record.
Example
The following example provides the DASDL description for code that exemplifies the use
of the count attribute:
D DATA SET (
A ALPHA (3);
L IS IN E COUNTED;
);
E DATA SET (
C COUNT;
N NUMBER (3);
);
General Format
The general format for the record type attribute is as follows:
data-name-1 (record-name-1)
data-name-1
record-name-1
This format element is the name of the record. Specifying the record enables read-only
access to the Record Type field of a record.
Example
The following example provides the DASDL description for code that exemplifies the use
of the record type attribute:
D DATA SET (
T RECORD TYPE (2);
A ALPHA (3);
),
2: (
B BOOLEAN;
R REAL;
N NUMBER (3);
);
IF D(T) = 2 GO TO...
Population Attribute
The population attribute enables read-only access to the current population of the
structure name. However, this value is often inaccurate, even if it is tested immediately
after the record that contains it is made current. This inaccuracy occurs because other
programs running concurrently on a multiprocessing system can cause the value of the
population item in the database to change.
General Format
The general format for the population attribute is as follows:
data-name-1 (data-name-2)
data-name-1
data-name-2
Example
The following example provides the DASDL description for COBOL74 code that
exemplifies the use of the population attribute:
The operation in this example accesses not the population of D, but the population of the
structure embedded in D to which EPOP refers.
MOVE D (EPOP) TO X.
To save usage data in the object code file, use the SET statement to set the
DATADICTINFO option before the first source-language statement. You cannot use the
SET, RESET, or POP option action indicators within the program.
General Format
The format of the DATADICTINFO option is as follows:
[ DATADICTINFO ]
ïïïïïïïïïïïï
DATADICTINFO
This option specifies the use of the DATADICTINFO option. The option is of type Boolean;
the default value is FALSE.
See Also
• For information on compiler control options and the option action indicators, refer to
Volume 1.
• For more information on the SET statement, see “SET Statement” later in this section.
Example
The following statement is an example of the DATADICTINFO option:
$SET DATADICTINFO.
ABORT-TRANSACTION Statement
The ABORT-TRANSACTION statement discards any updates made in a transaction after a
BEGIN-TRANSACTION statement, and removes a program from transaction state.
General Format
The format of the ABORT-TRANSACTION statement is as follows:
COMS-header-name-1
This option is used only with COMS and specifies a COMS header. COMS-header-name-1
calls the DCIENTRYPOINT of a data communications interface (DCI) library when a
program detects an exception condition. This feature enables a program interfacing with
COMS to support synchronized transactions and recovery.
data-name-1
This format element specifies the name of a restart data set (RDS).
ON EXCEPTION
This clause handles exceptions. Refer to “DMSII Exceptions” later in this section for
information on the clause.
See Also
Refer to Section 3, “Using the COMS Program Interface,” for more information on COMS.
Examples
The following lines of code provide examples of the ABORT-TRANSACTION statement:
ABORT-TRANSACTION VENDOR-RESTART.
ASSIGN Statement
The ASSIGN statement establishes the relationship between a record in a data set and a
record in the same or another data set. The ASSIGN statement is effective immediately;
therefore, the second record does not need to be stored unless data items of this record
have been modified.
General Format
The general format of the ASSIGN statement is as follows:
ä å
³data-name-1³
ASSIGN ã â TO data-name-2
³NULL ³ ïï
æïïïï ç
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
data-name-1
If data-name-1 is a data set, you must declare it in DASDL as the object data set of the link
item data-name-2. Data-name-2 is a value that points to the current record in data-name-1.
The current path of the data set specified by data-name-1 must be valid, but the record
need not be locked. Your program returns an exception if the data set path is not valid.
NULL
This clause severs the relationship between records by assigning a NULL value to
data-name-2. If data-name-2 is already NULL, then DMSII ignores this clause. Executing a
FIND, MODIFY, or LOCK statement on a NULL link item results in an exception.
data-name-2
This format element points either to the current record in the data set specified by
data-name-1 (a data set) or to the record pointed to by data-name-1 (a link item).
The current path of the data set containing data-name-2 must be valid and the record
locked; otherwise, the program returns an exception.
If data-name-1 refers to a disjoint data set, data-name-2 can point to any record in the data
set. If data-name-2 refers to an embedded data set, it can reference only certain records in
the data set. In this case, the record being referenced must be owned by the record
containing data-name-2 or by an ancestor of the record containing data-name-2. (An
ancestor is the owner of the record, the owner of the owner, and so forth.)
ON EXCEPTION
This clause handles exceptions. If the program finds an exception, it terminates the
ASSIGN statement and assigns a NULL value to data-name-2. Refer to “DMSII Exceptions”
later in this section for information on the ON EXCEPTION option.
• Links must be maintained by the program. Other DMSII structures, such as automatic
subsets, can perform the tasks that links perform but are maintained by the system.
• Links must be removed. If you delete a record pointed to by several links, you might
forget to remove all the links pointing to that record. As a result, the links would point
to nothing.
• Links are one-way pointers to a record. While you can find the record a link is pointing
to, you cannot easily determine which record is pointing to the linked record.
If the link item is a counted link, DMSII automatically updates the count item, even if the
referenced record is locked by another program.
Example
The following DASDL description is used by the COBOL74 code in the following example.
The description is compiled with the name DBASE.
D DATA SET (
A ALPHA (3);
B BOOLEAN;
L IS IN E VERIFY ON N;
);
S SET OF D KEY A;
E DATA SET (
N NUMBER (3);
R REAL;
);
T SET OF E KEY N;
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE CONTROL.
SELECT TAPE-FILE ASSIGN TO TAPE.
DATA DIVISION.
FILE SECTION.
FD TAPE-FILE.
01 TAPE-REC.
02 X PIC XXX.
02 Y PIC 999.
DATA-BASE SECTION.
DB DBASE ALL.
PROCEDURE DIVISION.
OPEN-INPUT-FILE.
OPEN INPUT TAPE-FILE.
OPEN-DB.
OPEN UPDATE DBASE.
START-PRG.
READ TAPE-FILE AT END
CLOSE TAPE-FILE
CLOSE DBASE
STOP RUN.
FIND S AT A = X.
FIND T AT N = Y.
ASSIGN E TO L.
FREE D.
GO TO START-PRG.
BEGIN-TRANSACTION Statement
The BEGIN-TRANSACTION statement places a program in transaction state. This
statement can be used only with audited databases.
COMS-header-name-1
This option is used only with COMS and specifies the input header. You can use
COMS-header-name-1 to call the DCIENTRYPOINT of a DCI library when your program
detects an exception condition. This feature enables a program interfacing with COMS to
support synchronized transactions and recovery.
Your program calls the DCI library before it performs the exception-handling procedure.
USING
If you have employed the USING option and your program does not detect an exception,
your program calls the DCI library and passes the message area indicated by identifier-1 to
the DCIENTRYPOINT.
identifier-1
AUDIT
This clause captures the restart area. The path of the RDS named is not altered when the
restart record is stored.
NO-AUDIT
data-name-1
This format element is the name of the RDS you want to update.
ON EXCEPTION
This clause handles exceptions. Your program returns an exception if you execute a
BEGIN-TRANSACTION statement while the program is already in transaction state.
If an exception occurs, the program is not placed in transaction state. If the program
returns an ABORT exception, all records that the program had locked are freed. Refer to
“DMSII Exceptions” later in this section for information on the ON EXCEPTION option.
• ASSIGN
• DELETE
• GENERATE
• INSERT
• REMOVE
• STORE
Example
The following DASDL description is used by the COBOL74 code in the following example.
The description is compiled with the name DBASE.
OPTIONS (AUDIT);
R RESTART DATA SET (
P ALPHA (10);
Q ALPHA (100);
);
D DATA SET (
A ALPHA (3);
N NUMBER (3);
);
S SET OF D KEY N;
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE CONTROL.
SELECT TAPE-FILE ASSIGN TO TAPE.
DATA DIVISION.
FILE SECTION.
FD TAPE-FILE.
01 TAPE-REC.
02 X PIC 999.
02 Y PIC XXX.
DATA-BASE SECTION.
DB DBASE ALL.
WORKING-STORAGE SECTION.
01 CNT PIC 999.
PROCEDURE DIVISION.
OPEN-INPUT-FILE.
OPEN INPUT TAPE-FILE.
OPEN-DB.
OPEN UPDATE DBASE.
CREATE-D.
CREATE D.
ADD 1 TO CNT.
MOVE CNT TO N.
BEGIN-TRANSACTION AUDIT R.
STORE D.
END-TRANSACTION NO-AUDIT R.
IF CNT < 100
GO TO CREATE-D.
START-PRG.
READ TAPE-FILE AT END
CLOSE TAPE-FILE
CLOSE DBASE
STOP RUN.
LOCK S AT N = X.
BEGIN-TRANSACTION AUDIT R
MOVE Y TO A.
STORE D.
END-TRANSACTION NO-AUDIT R.
GO TO START-PRG.
Later in this section, Example 4–1, “DMSII Sample Program,” shows the
BEGIN-TRANSACTION statement within the context of a complete program.
General Format
The general format for the CANCEL TRANSACTION POINT statement is as follows:
data-name-1
arithmetic-expression-1
The CANCEL TRANSACTION POINT statement discards all database changes made
between the current point in the transaction and the point specified by
arithmetic-expression-1.
If you do not specify arithmetic-expression-1, DMSII discards all data updated since the
BEGIN-TRANSACTION statement placed the program in transaction state. For details on
arithmetic expressions, see Volume 1.
ON EXCEPTION
This clause handles exceptions. Refer to “DMSII Exceptions” later in this section for
information on the ON EXCEPTION option.
Examples
The following lines of code provide examples of the CANCEL TRANSACTION POINT
statement:
CLOSE Statement
The CLOSE statement closes a database when your program requires no further access to
it. The CLOSE statement is optional because the system closes any open database when
the program terminates. A successfully closed database causes a syncpoint in the audit
trail.
CLOSE data-name-1
ïïïïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
data-name-1
ON EXCEPTION
This clause handles exceptions. Your program returns an exception if the specified
database is not open. Refer to “DMSII Exceptions” later in this section for information on
the clause.
Your program does not return some exceptions when the CLOSE statement is used. To be
sure your program detects all exceptions that occur during the execution of the CLOSE
statement, do both of the following:
• Use the ON EXCEPTION option to prevent the program from being discontinued if an
exception flag is raised.
• Use an IF statement to check for exceptions that do not raise an exception flag.
If you are running COMS for synchronized recovery, it is recommended that you do not
use the ON EXCEPTION option. If DMSII detects a database error during the closing of a
database, the system allows your program to terminate abnormally; otherwise, the
database might abort recursively. If you do use the ON EXCEPTION option, you should
ensure that your program calls the DMTERMINATE statement for those exceptions that
your program does not handle. Use the following syntax, therefore, to close a database
when you are using COMS with DMSII for synchronized recovery:
CLOSE DBASE.
Example
The following example shows the recommended syntax for the CLOSE statement when
the ON EXCEPTION option and the IF statement are used:
CLOSE MYDB
ON EXCEPTION
DISPLAY "EXCEPTION WHILE CLOSING MYDB"
CALL SYSTEM DMTERMINATE.
The following code checks for the ABORT condition, which is not caught by the ON
EXCEPTION clause if it happens during the CLOSE operation.
IF DMSTATUS(DMCATEGORY) = 16
OPEN MYDB
GO TO ABORTED.
Later in this section, Example 4–1, “DMSII Sample Program,” shows the CLOSE statement
within the context of a complete program.
COMPUTE Statement
The COMPUTE statement assigns a value to a Boolean item in the current record of a data
set. The COMPUTE statement affects only the record area. The database is not affected
until a subsequent STORE statement is executed.
General Format
The general format of the COMPUTE statement is as follows:
ä å
³condition³
³ ³
COMPUTE data-name-1 = ãTRUE â
ïïïïïïï ³ïïïï ³
³FALSE ³
æïïïïï ç
data-name-1
condition
If you specify a condition, DMSII assigns the value of the condition to the specified
Boolean item. The format rules for the condition are the same as the standard COBOL74
rules for the relation conditions.
TRUE
FALSE
Examples
The following lines of code provide two examples of the COMPUTE statement:
Later in this section, Example 4–1, “DMSII Sample Program,” shows the COMPUTE
statement within the context of a complete program.
CREATE Statement
The CREATE statement initializes the user work area of a data set record.
1. Frees the current record of the specified data set. Note that if the
INDEPENDENTTRANS option in DASDL is set and the CREATE statement is issued
during transaction state, the locked record is not freed until an END-TRANSACTION
statement is executed.
For more information on the INDEPENDENTTRANS option, refer to the DMSII
DASDL Reference Manual.
2. Reads the specified expression to determine the format of the record to be created.
3. Initializes data items to one of the following values:
• INITIALVALUE value declared in DASDL, if present
• NULL value declared in DASDL, if present
• NULL value as a default value
General Format
The general format of the CREATE statement is as follows:
data-name-1
This format element specifies the data set you want to initialize. The current path of the
data set is unchanged until you execute a STORE statement.
(expression)
The expression option specifies a variable-format record. You must use an expression only
to create a variable-format record; otherwise, the expression must not appear.
ON EXCEPTION
This clause handles exceptions. Your program returns an exception if the expression does
not represent a valid record type. See “DMSII Exceptions” later in this section for
information.
The CREATE statement only sets up a record area. If the record contains embedded
structures, you must store the master record before you can create entries in the
embedded structures. If you create only entries in the embedded structure (that is, if you
do not alter items in the master), you need not store the master record a second time.
Example
The following DASDL description is used by the COBOL74 code in the following example.
The description is compiled with the name DBASE.
D DATA SET (
A ALPHA (10);
B BOOLEAN;
N NUMBER (3);
);
S SET OF D KEY N;
RS RESTART DATA SET (RS-NUM NUMBER(3););
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE CONTROL.
SELECT TAPE-FILE ASSIGN TO TAPE.
DATA DIVISION.
FILE SECTION.
FD TAPE-FILE.
01 TAPE-REC.
02 X PIC X(10).
02 Y PIC 9.
02 Z PIC 999.
DATA-BASE SECTION.
DB DBASE ALL.
PROCEDURE DIVISION.
OPEN-INPUT-FILE.
OPEN INPUT TAPE-FILE.
OPEN-DB.
OPEN UPDATE DBASE.
START-PRG.
READ TAPE-FILE AT END
CLOSE TAPE-FILE
CLOSE DBASE
STOP RUN.
CREATE D.
MOVE X TO A.
IF Y = 1
COMPUTE B = TRUE.
MOVE Z TO N.
BEGIN-TRANSACTION NO-AUDIT RS.
STORE D.
END-TRANSACTION AUDIT RS.
GO TO START-PRG.
Later in this section, Example 4–1, “DMSII Sample Program,” shows the CREATE
statement within the context of a complete program.
DELETE Statement
The DELETE statement finds a record by a method identical to that of the FIND
statement. However, whereas the FIND statement transfers the record to the user work
area associated with a data set or global data, the DELETE statement performs the
following steps:
1. Frees the current record, unless the selection expression is the name of the data set
and the current record is locked. In this case, the locked status is not altered.
2. Alters the current path to point to the record specified by the selection expression,
and locks this record.
3. Transfers that record to the user work area.
4. Removes the record from all sets and automatic subsets, but not from manual subsets.
5. Removes the record from the data set.
If your program finds a record that cannot be deleted, the program returns an exception
and terminates the DELETE statement, leaving the current path pointing to the record
specified by the selection expression.
If you use a set selection expression and your program cannot find the record, the
program returns an exception and changes and invalidates the set path. The selection
expression refers to a location between the last key that is less than the condition and the
first key that is greater than the condition. You can execute a set selection expression with
the NEXT or PRIOR options from this location, provided keys that are greater than or less
than the condition exist. The current path of the data set, the current record, and the
current paths of any other sets for that data set remain unchanged.
When the DELETE statement is completed, the current paths still refer to the deleted
record.
General Format
The general format of the DELETE statement is as follows:
DELETE selection-expression-1
ïïïïïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
selection-expression-1
This format element identifies the record you want to delete. Selection expressions are
explained in “Using Selection Expressions” earlier in this section.
ON EXCEPTION
This clause handles exceptions. For information on the clause, refer to “DMSII
Exceptions” later in this section.
Your program returns an exception and does not delete the record if one of the following
is true:
Example
The following DASDL description is used by the COBOL74 code in the following example.
The description is compiled with the name DBASE.
D DATA SET (
A ALPHA (3);
B BOOLEAN;
N NUMBER (3);
R REAL;
);
S SET OF D KEY N;
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE CONTROL.
SELECT TAPE-FILE ASSIGN TO TAPE.
DATA DIVISION.
FILE SECTION.
FD TAPE-FILE.
01 TAPE-REC.
02 X PIC 999.
DATA-BASE SECTION.
DB DBASE ALL.
PROCEDURE DIVISION.
OPEN-INPUT-FILE.
OPEN INPUT TAPE-FILE.
OPEN-DB.
OPEN UPDATE DBASE.
START-PRG.
READ TAPE-FILE AT END
CLOSE TAPE-FILE
CLOSE DBASE
STOP RUN.
DELETE S AT N = X.
GO TO START-PRG.
Later in this section, Example 4–1, “DMSII Sample Program,” shows the DELETE
statement within the context of a complete program.
DMTERMINATE Statement
The DMTERMINATE statement terminates programs. When an exception occurs that the
program does not handle, DMTERMINATE terminates the program with a fault.
General Format
The general format of the DMTERMINATE statement is as follows:
Example
The following example uses the DMTERMINATE statement:
FIND FIRST D
ON EXCEPTION
DISPLAY "D IS EMPTY DATA SET"
CALL SYSTEM DMTERMINATE.
END-TRANSACTION Statement
The END-TRANSACTION statement takes a program out of transaction state. You can use
this statement only with audited databases. The END-TRANSACTION statement performs
the following steps:
COMS-header-name-1
This option specifies the COMS output header. For information on COMS, refer to
Section 3, “Using the COMS Program Interface.”
The COMS-header-name-1 option is used only with COMS. You can specify
COMS-header-name-1 to call the DCIENTRYPOINT of a DCI library whenever you execute
the statement. This feature enables a program interfacing with COMS to support
synchronized transactions and recovery. When your program detects an exception
condition, it calls the DCI library before it performs any exception-handling procedures.
USING
This option causes your program to call the DCI library and pass the message area
indicated by identifier-1 to the DCIENTRYPOINT.
identifier-1
This format element specifies the message area passed to the DCIENTRYPOINT.
AUDIT
This clause captures the restart area. Storing the restart record does not alter the path of
the RDS.
NO-AUDIT
data-name-1
This format element is the name of the restart data area specified in the AUDIT or
NO-AUDIT clause.
SYNC
ON EXCEPTION
This clause handles exceptions. Refer to “DMSII Exceptions” later in this section for
information on the clause. The program returns an exception if you execute an
END-TRANSACTION statement when the program is not in transaction state.
The END-TRANSACTION statement frees all records. However, if your program returns an
exception, the transaction is not applied to the database.
Example
The following DASDL description is used by the COBOL74 code in the following example.
The description is compiled with the name DBASE.
OPTIONS (AUDIT);
R RESTART DATA SET (
P ALPHA (10);
Q ALPHA (100);
);
D DATA SET (
A ALPHA (3);
N NUMBER (3);
);
S SET OF D KEY N;
The following example shows two sections of code, each of which begins with a
BEGIN-TRANSACTION statement and ends with an END-TRANSACTION statement. Both
sections of code define a transaction. The transaction becomes an indivisible, logical unit.
During processing, the transactions are audited for recovery. The AUDIT or NO-AUDIT
clause determines whether the restart record of the data set is captured.
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE CONTROL.
SELECT TAPE-FILE ASSIGN TO TAPE.
DATA DIVISION.
FILE SECTION.
FD TAPE-FILE.
01 TAPE-REC.
02 X PIC 999.
02 Y PIC XXX.
DATA-BASE SECTION.
DB DBASE ALL.
WORKING-STORAGE SECTION.
01 CNT PIC 999.
PROCEDURE DIVISION.
OPEN-INPUT-FILE.
OPEN INPUT TAPE-FILE.
OPEN-DB.
OPEN UPDATE DBASE.
CREATE-D.
CREATE D.
ADD 1 TO CNT.
MOVE CNT TO N.
BEGIN-TRANSACTION AUDIT R.
STORE D.
END-TRANSACTION AUDIT R.
IF CNT < 100
GO TO CREATE-D.
START-PRG.
READ TAPE-FILE AT END
CLOSE TAPE-FILE
CLOSE DBASE
STOP RUN.
LOCK S AT N = X.
BEGIN-TRANSACTION AUDIT R.
MOVE Y TO A.
STORE D.
END-TRANSACTION NO-AUDIT R
GO TO START-PRG.
Later in this section, Example 4–1, “DMSII Sample Program,” shows the
END-TRANSACTION statement within the context of a complete program.
FIND Statement
The FIND statement transfers a record to the user work area associated with a data set or
global data. Additional information on the use of the FIND statement with the REBLOCK
and READAHEAD options is provided in the DMSII Application Programming Guide.
1. Frees a locked record in the data set if you specify a data set in the FIND statement.
Specifying a set in the FIND statement frees a locked record in the associated data
set.
2. Alters the current path to point to the record specified by the selection expression or
the database name.
3. Transfers that record to the user work area.
Using the FIND statement does not prevent other transactions from reading the record
before the current update transaction is completed.
General Format
The general format of the FIND statement is as follows:
ä å
³ ä å ³
³ ³selection-expression-1 ³ ³
³FIND ã â ³
ãïïïï ³data-name-1 ³ â
³ æ ç ³
³ ³
³FIND KEY OF selection-expression-2 ³
æïïïï ïïï ïï ç
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
selection-expression-1
This format element specifies the record you want to transfer to the user work area.
data-name-1
This format element specifies the global data record you want to transfer to the user work
area associated with the global data. If no global data is described in DASDL, DMSII
returns a syntax error.
FIND KEY OF
This clause moves the key and any associated data (as specified in the DASDL
description) from the key entry to the user work area. Your program does not perform a
physical read on the data set; consequently, the value and contents of all items in the
record area that do not appear in the key entry retain whatever value they had before you
executed the FIND KEY OF clause. The FIND statement does not affect the current path
of the data set.
selection-expression-2
If you use selection-expression-2 and your program fails to find the record, the program
returns an exception, and changes and invalidates the set path. The selection expression
refers to a location between the last key that is less than the condition and the first key
that is greater than the condition. You can process selection-expression-2 by using the
NEXT or PRIOR option from this location, provided the keys that are greater than or less
than the condition exist. The current path of the data set, the current record, and the
current paths of any other sets for that data set remain unchanged.
ON EXCEPTION
This clause handles exceptions. Refer to “DMSII Exceptions” later in this section for
information on the clause. The program returns an exception if no record satisfies the
selection expression.
Examples
The following example shows the FIND statement used with a record selection
expression:
The following example shows the FIND statement used with a FIND KEY OF clause:
Later in this section, Example 4–1, “DMSII Sample Program,” shows the FIND statement
within the context of a complete program.
FREE Statement
The FREE statement explicitly unlocks the current record or structure. A FREE statement
executed on a record enables other programs to lock that record or structure.
Note that if you set the INDEPENDENTTRANS option in DASDL for the database, the
program ignores a FREE statement during transaction state. For more information on the
INDEPENDENTTRANS option, refer to the DMSII DASDL Reference Manual and the
DMSII Application Programming Guide.
You can execute a FREE statement after any operation. If the current record or structure
is already free, or if no current record or structure is present, DMSII ignores the FREE
statement.
You can use the FREE statement to unlock a record or structure that you anticipate will
not be implicitly freed for a long time.
The FREE statement is optional in some situations because the FIND, LOCK, MODIFY,
and DELETE statements can free a record before the program executes them. Generally,
an implicit FREE operation is performed, if needed, during any operation that establishes
a new data set path.
FIND, LOCK, and MODIFY statements using sets or subsets free the locked record only if
a new record is retrieved. Other constructs that can free data set records are
• END-TRANSACTION
• BEGIN-TRANSACTION
• CREATE
• RECREATE
• SET TO BEGINNING
• SET TO ENDING
General Format
The general format for the FREE statement is as follows:
ä å
³data-name-1 ³
FREE ã â
ïïïï ³STRUCTURE data-name-2³
æïïïïïïïïï ç
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
data-name-1
This format element specifies either the data set whose current record is to be unlocked
or the global data record to be unlocked. The data set path and current record area remain
unchanged.
STRUCTURE
data-name-2
ON EXCEPTION
This option handles exceptions. Refer to “DMSII Exceptions” later in this section for
information on the clause. If the program returns an exception, the state of the database
remains unchanged.
Example
The following example uses the FREE statement:
LOCK NEXT S
ON EXCEPTION
GO TO NO-MORE.
IF ITEM-1 NOT = VALID-VALUE
FREE DS
GO ERR.
GENERATE Statement
The GENERATE statement creates an entire subset in one operation. All subsets must be
disjoint bit vectors. The GENERATE statement performs the following steps:
1. Deletes all records from the subset if the subset is not empty
2. Assigns to the generated subset the records in another subset, a combination of the
records in two other subsets, or NULL values
Note: It is recommended that you coordinate any subset declaration with other users
because subsets can be used concurrently and altered without your knowledge.
General Format
The general format of the GENERATE statement is as follows:
ä å
³NULL ³
³ïïïï ³
³ Úä å ¿ ³
³ ³³AND³ ³ ³
GENERATE data-name-1= ã ³³ïïï³ ³ â
ïïïïïïïï ³data-name-2³ãOR â data-name-3 ³ ³
³ ³³ïï ³ ³ ³
³ ³³+ ³ ³ ³
³ ³³ ³ Ù ³
æ Àæ- ç ç
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
data-name-1
This format element is the name of the subset you want to generate. Data-name-1 must be
a manual subset and a disjoint bit vector.
NULL
This phrase assigns a NULL value to the generated subset so that the subset remains
empty.
data-name-2
This format element is the name of the subset you want to assign to data-name-1. The
data-name-2 subset must be of the same data set as the data-name-1 subset and must be a
disjoint bit vector.
AND
This operator assigns the intersection of data-name-2 and data-name-3 to data-name-1. The
intersection is defined to be all the records in data-name-2 that are also in data-name-3.
OR
This operator assigns the union of data-name-2 and data-name-3 to data-name-1. The union
is defined to be all the records that are in either data-name-2 or data-name-3.
+ (plus)
This operator is the subset-exclusive OR. This operator assigns the records contained in
either data-name-2 or data-name-3 (but not both) to data-name-1.
–(minus)
This operator is the subset difference. This operator assigns the records contained in
data-name-2 that are not in data-name-3 to data-name-1.
data-name-3
This format element is the name of the subset you want to combine with data-name-2 and
assign to data-name-1. The data-name-3 subset must be of the same data set as the
data-name-2 subset and must be a disjoint bit vector.
ON EXCEPTION
This option handles exceptions. Refer to “DMSII Exceptions” later in this section for more
information on the clause.
Example
The following DASDL description is used by the COBOL74 code in the following example.
The description is compiled with the name DBASE.
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE CONTROL.
SELECT TAPE-FILE ASSIGN TO TAPE.
DATA DIVISION.
FILE SECTION.
FD TAPE-FILE.
01 TAPE-REC.
02 S PIC XXX.
02 T PIC 9.
02 U PIC 999.
02 V PIC 9(4).
DATA-BASE SECTION.
DB DBASE ALL.
PROCEDURE DIVISION.
OPEN-INPUT-FILE.
OPEN INPUT TAPE-FILE.
OPEN-DB.
OPEN UPDATE DBASE.
START-PRG.
READ TAPE-FILE AT END
CLOSE TAPE-FILE
GO TO GENERATE-SUBSET.
CREATE D.
MOVE S TO A.
IF T = 1
COMPUTE B = TRUE.
MOVE U TO N.
MOVE V TO R.
STORE D.
GO TO START-PRG.
GENERATE-SUBSET.
GENERATE Z = X AND Y.
CLOSE DBASE.
STOP RUN.
Later in this section, Example 4–1, “DMSII Sample Program,” shows the GENERATE
statement within the context of a complete program.
IF Statement
The IF statement tests an item to determine if it contains a NULL value.
Note: It is recommended that you use the IF NULL test to test a database item for a
NULL value. Attempts to compare a database item against some value assumed
to be equivalent to NULL might not always produce correct results.
General Format
The general format of the IF statement is as follows:
ä å
³ädata-name-1 [NOT] å ³
³³ ïïï ³ ³
³ãNOT data-name-2 IS â NULL ³
³³ïïï ³ ïïïï ³
IF ãæ ç â imperative-statement-1
³Ú ä å ¿ ³
³³ ³data-name-3 ³ ³ ³
³³NOT ã â ³ ³
³³ïïï ³data-name-4 is NULL³ ³ ³
æÀ æ ïïïïç Ù ç
[ ELSE imperative-statement-2 ]
ïïïï
imperative-statement-1
Your program executes imperative-statement-1 if the condition you are testing is satisfied.
NULL
This phrase is the null value defined in the DASDL description. The NULL phrase specifies
a condition that can also appear in combined conditions. Refer to Volume 1 for
information on combined conditions.
When the NULL phrase is applied to a group item, the NULL phrase defined in the DASDL
description is used, regardless of the NULL specification for any elementary item
contained within the group.
Data items declared in the DASDL description, besides being used in the NULL test, can
also be used in standard COBOL74 relation conditions, exactly like data items declared in
a COBOL74 program.
data-name-3
This format element specifies a Boolean item declared in the DASDL specification.
data-name-4
This format element specifies a link item declared in the DASDL specification. The
specified link item contains a NULL value if one of the following is true:
imperative-statement-2
Example
The following example illustrates the use of the NULL phrase with the IF statement:
IF THE-ITEM IS NULL
PERFORM NEVER-USED.
Later in this section, Example 4–1, “DMSII Sample Program,” shows the IF statement
within the context of a complete program.
INSERT Statement
The INSERT statement places a record into a manual subset. To accomplish this task, the
statement performs the following steps:
data-name-1
This format element identifies the data set whose current record you want to insert into
the subset specified by data-name-2. Data-name-1 must be the object data set of the
specified subset. The path of data-name-1 must refer to a valid record; otherwise, the
program returns an exception.
data-name-2
This format element must specify a manual subset of the data set specified by
data-name-1.
ON EXCEPTION
This option handles exceptions. Refer to “DMSII Exceptions” later in this section for
information on the clause. The program returns an exception if one of the following is
true:
• The subset you specified does not permit duplicates, and the record you want to insert
has a key identical to that of a record currently in the specified subset.
• The specified subset is embedded in a data set, and the data set does not have a valid
current record.
• The LOCK TO MODIFY DETAILS option was specified in the DASDL description, and
the current record is not locked.
• INDEPENDENTTRANS is set in DASDL, you attempted to insert the specified record,
and a deadlock occurred during the locking step.
Example
The following DASDL description is used by the COBOL74 code in the following example.
The description is compiled with the name DBASE.
D DATA SET (
A ALPHA (3);
B BOOLEAN;
N NUMBER (3);
R REAL;
);
X SUBSET OF D BIT VECTOR;
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE.
DATA DIVISION.
DATA-BASE SECTION.
DB DBASE ALL.
PROCEDURE DIVISION.
OPEN-DB.
OPEN UPDATE DBASE.
SET D TO BEGINNING.
START-PRG.
FIND NEXT D ON EXCEPTION
CLOSE DBASE
STOP RUN.
IF N > 10
INSERT D INTO X.
GO TO START-PRG.
Later in this section, Example 4–1, “DMSII Sample Program,” shows the INSERT
statement within the context of a complete program.
LOCK/MODIFY Statement
The LOCK statement finds a record in a manner identical to that of the FIND statement,
and then locks a found record against a concurrent modification by another user. LOCK
and MODIFY are synonyms. The LOCK statement also provides the STRUCTURE phrase,
which simultaneously locks all records in a structure.
If the record to be locked has already been locked by another program, the system
performs a contention analysis. The present program waits until the other program
unlocks the record, unless the wait would result in a deadlock. If a deadlock would result,
the system unlocks all records locked by the program having the lowest priority of the
programs that would be involved in the deadlock, and terminates the lower-priority
program with a DEADLOCK exception.
No other user can lock or secure the record once it is locked; therefore, the record must
be freed when locking is no longer required. You can free a record explicitly by using a
FREE statement or free a record implicitly by executing a subsequent LOCK, FIND,
DELETE, CREATE, or RECREATE statement on the same data set.
1. Implicitly frees a locked record. However, if you have set the INDEPENDENTTRANS
option in DASDL, the LOCK/MODIFY statement does not free the locked record until
you execute an END-TRANSACTION statement.
2. Alters the current path to point to the record specified by the selection expression or
data name included in the statement.
3. Locks the specified record.
4. Transfers that record to the user work area.
General Format
The general format of the LOCK/MODIFY statement is as follows:
ä å
ä å ³selection-expression-1³
³LOCK ³ ³ ³
ãïïïï â ãdata-name-1 â
³MODIFY³ ³ ³
æïïïïïïç ³STRUCTURE data-name-2 ³
æïïïïïïïïï ç
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
selection-expression-1
data-name-1
This format element specifies the global data record you want to lock.
STRUCTURE
This phrase locks or secures all records in the structure simultaneously. If other users
have locked or secured the structure or records in the structure, you must wait until those
users free the records or the structure, or end their transactions to do so. A deadlock
occurs when other users attempt to lock or secure more records while you are locking the
structure. Once you have locked a structure, you must continue to lock individual records.
Each new lock implicitly frees the previous record, even if you have set the
INDEPENDENTTRANS option in DASDL. These freed records continue to be available
only to the user securing the structure.
You cannot free structure locks with an END-TRANSACTION statement; instead, you
must use a FREE statement. More information is provided in “FREE Statement” earlier is
this section.
data-name-2
ON EXCEPTION
This option handles exceptions. Refer to “DMSII Exceptions” for more information on the
clause. The program returns an exception if no record satisfies the selection expression. If
the program returns an exception, the record is not freed. A DEADLOCK exception occurs
if the program waits on a LOCK statement for a time longer than that specified in the
MAXWAIT task attribute. For more information about the MAXWAIT attribute, refer to the
Task Attributes Programming Reference Manual.
If the LOCK statement uses a selection expression and an exception is returned, the
program invalidates the current path of the specified set. However, the current path of the
data set, the current record, and the current paths of any other sets for that data set
remain unaltered.
Examples
The following line of code shows the LOCK statement used with the STRUCTURE phrase:
The following example shows the LOCK statement used with the ONON EXCEPTION
option:
The following example shows the MODIFY statement used with the ON EXCEPTION
clause:
Later in this section, Example 4–1, “DMSII Sample Program,” shows the LOCK statement
within the context of a complete program.
OPEN Statement
The OPEN statement opens a database for subsequent access and specifies the access
mode. You must execute an OPEN statement before the database is first accessed;
otherwise, the program terminates at run time with an invalid operator error.
1. Opens an existing database. If files required for invoked structures are not in the
system directory, DMSII displays an informative message.
2. Performs an implicit create operation on the RDS.
General Format
The general format of the OPEN statement is as follows:
ä å
³INQUIRY ³
OPEN ãïïïïïï â data-name-1
ïïïï ³UPDATE ³
æïïïïïï ç
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
INQUIRY
This phrase enforces read-only access to the database specified by data-name-1. You use
this option when you do not want to update the database. The program returns an
exception to the following statements if you have opened the database with the INQUIRY
phrase:
ASSIGN GENERATE
BEGIN-TRANSACTION INSERT
DELETE REMOVE
END-TRANSACTION STORE
DMSII does not open any audit files if the OPENINQUIRY statement has been specified in
all programs that are currently accessing the database.
UPDATE
This phrase enables you to modify the database specified by data-name-1. You must
specify the UPDATE phrase to use the following statements:
ASSIGN GENERATE
BEGIN-TRANSACTION INSERT
DELETE REMOVE
END-TRANSACTION STORE
data-name-1
ON EXCEPTION
This option handles exceptions. More information on the clause is provided later in this
section under “DMSII Exceptions.” The program returns an exception if the database is
already open or if access to the database is denied because of security. If the program
returns an exception, the state of the database remains unchanged.
Examples
The following example illustrates the use of the OPEN statement with the INQUIRY
phrase:
The following example uses the OPEN statement with the INQUIRY phrase and an ON
EXCEPTION option:
Later in this section, Example 4–1, “DMSII Sample Program,” shows the OPEN statement
within the context of a complete program.
RECREATE Statement
The RECREATE statement partially initializes the user work area.
General Format
The general format of the RECREATE statement is as follows:
data-name-1
This format element is the name of the data set you want to initialize.
(expression)
ON EXCEPTION
This option handles exceptions. More information on this clause is provided later in this
section under “DMSII Exceptions.”
Example
The following DASDL description is used by the COBOL74 code in the following example.
The description is compiled with the name DBASE.
D DATA SET (
A ALPHA (3);
N NUMBER (3);
);
S SET OF D KEY N;
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE.
DATA DIVISION.
DATA-BASE SECTION.
DB DBASE ALL.
PROCEDURE DIVISION.
START-PRG.
OPEN UPDATE DBASE.
CREATE D.
MOVE "ABC" TO A.
MOVE 1 TO N.
STORE D.
RECREATE-D.
RECREATE D.
ADD 1 TO N.
STORE D.
IF N < 500
GO TO RECREATE-D
ELSE
CLOSE DBASE
STOP RUN.
Later in this section, Example 4–1, “DMSII Sample Program,” shows the RECREATE
statement within the context of a complete program.
REMOVE Statement
The REMOVE statement is similar to the FIND statement except that a found record is
locked and then removed from the specified subset.
If the program returns an exception after step 3, the operation terminates, leaving the
current path pointing to the record specified by the CURRENT phrase or by the data set
name.
When the REMOVE statement is completed, the current paths still refer to the deleted
record. As a result, a FIND statement on the current record results in a NOTFOUND
exception, although the FIND NEXT and FIND PRIOR statements give valid results.
General Format
The general format of the REMOVE statement is as follows:
Ú ¿
³CURRENT ³
REMOVE ³ïïïïïïï ³ FROM data-name-2
ïïïïïï ³data-name-1³ ïïïï
À Ù
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
CURRENT
This phrase the current record from the subset specified by data-name-2. If you specify
this option, the subset must have a valid current record. If the subset does not have a valid
current record, the program returns an exception.
data-name-1
This format element identifies the name of record. If you specify data-name-1, the program
finds the record located by the current path and removes it from the subset. The program
returns an exception if the record is not in the subset.
data-name-2
This format element specifies the subset from which you want to remove a record.
Data-name-2 must specify a manual subset of the data set specified by data-name-1.
If the subset is embedded in a data set, the data set must have a current record defined
and that record must be locked. If the record is not locked, the program returns an
exception.
ON EXCEPTION
This option handles exceptions. More information on this clause is provided later in this
section under “DMSII Exceptions.” Exceptions are returned if one of the following is true:
• You specify the CURRENT phrase, and the specified subset does not have a valid
current record.
• You use the data set name (data-name-2) option, and the record is not in the subset.
• You specify a subset that is embedded in a data set, and the data set does not have a
current record defined and locked.
• INDEPENDENTTRANS is set in DASDL, you attempted to remove the specified
record, and a deadlock occurred during the locking step.
Example
The following DASDL description is used by the COBOL74 code in the following example.
The description is compiled with the name DBASE.
D DATA SET (
A ALPHA (3);
B BOOLEAN;
N NUMBER (3);
R REAL;
);
X SUBSET OF D BIT VECTOR;
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE.
DATA DIVISION.
DATA-BASE SECTION.
DB DBASE ALL.
PROCEDURE DIVISION.
OPEN-DB.
OPEN UPDATE DBASE.
SET X TO BEGINNING.
START-PRG.
FIND NEXT X ON EXCEPTION
CLOSE DBASE
STOP RUN.
IF N > 100
REMOVE D FROM X.
GO TO START-PRG.
Later in this section, Example 4–1, “DMSII Sample Program,” shows the REMOVE
statement within the context of a complete program.
General Format
The format for the SAVE TRANSACTION POINT statement is as follows:
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
data-name-1
This format element is the name of a RDS that identifies the database.
arithmetic-expression-1
This expression indicates a marker to be assigned to the present execution point in the
transaction. Arithmetic expressions are discussed in Volume 1.
ON EXCEPTION
Example
The following line of code shows an example of the SAVE TRANSACTION POINT
statement:
SECURE Statement
The SECURE statement prevents other programs from updating a record by applying a
shared lock. It is called a shared lock because other users can read, find, or secure the
record; however, they cannot update the record.
You can execute a LOCK statement to upgrade secured records to locked records. If two
or more users try to upgrade the records at the same time, however, a deadlock can occur
and cause an exception.
General Format
The format for the SECURE statement is as follows:
ä å
³selection-expression-1³
³ ³
SECURE ãdata-name-1 â
ïïïïïï ³ ³
³STRUCTURE data-name-2 ³
æïïïïïïïïï ç
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
selection-expression-1
This format element specifies the record you want to secure. For more information, see
“Using Selection Expressions” earlier in this section.
data-name-1
This format element specifies the global data record you want to secure. If the invoked
database contains a remap of the global data, your program uses the name of the logical
database, not the name of the global data remap, to lock the global data record.
STRUCTURE
The STRUCTURE phrase secures all records in the structure simultaneously. The
structure must be a data set. If other users have locked records in the structure, you must
wait until the users free the records or structures or end their transactions before you can
secure the structure. A deadlock can occur if other users attempt to lock more records
while you are securing the structure.
You cannot free a secured structure by ending the transaction; instead, you must use the
FREE statement. More information on this statement is provided in “FREE Statement”
earlier in this section.
data-name-2
This format element specifies the name of the data set used in the STRUCTURE phrase.
ON EXCEPTION
This option handles exceptions. See “DMSII Exceptions” for information on this clause.
Example
The following line of code shows an example of the SECURE statement used with the
STRUCTURE phrase:
SET Statement
The SET statement alters the current path or changes the value of an item in the current
record. The SET statement affects only the record area; it does not affect the data set until
you execute a subsequent STORE statement.
General Format
The general format of the SET statement is as follows:
ä å
³ ³
³ ä å ³
³ ³BEGINNING³ ³
³data-name-1 TO ãïïïïïïïïïâ ³
SET ã ïï ³ENDING ³ â
ïïï ³ æïïïïïï ç ³
³data-name-2 TO data-name-3 ³
³ ïï ³
³data-name-4 TO NULL ³
æ ïï ïïïï ç
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
Data-name-1 specifies the data set, set, or subset whose current path you want to alter to
point to the beginning or ending of the data set.
These format elements identify the name of a set or subset. Data-name-2 specifies the set
or subset whose current path you want to alter to point to the current record of
data-name-3.
data-name-4
This format element specifies an item of the current record that is to be assigned a NULL
value. Data-name-4 cannot be a link item.
NULL
If you declare a null value in DASDL, that value is used as the NULL value in this
statement. Otherwise, the statement uses the system default NULL value.
When the NULL value is applied to a group item, the NULL value defined in DASDL is
used, regardless of the NULL specification for any elementary item contained within the
group.
ON EXCEPTION
This option handles exceptions. Information on this clause is provided later in this section
under “DMSII Exceptions.”
Example
The following DASDL description is used by the COBOL74 code in the following example.
The description is compiled with the name DBASE.
DS DATA SET
(A ALPHA (20);
N NUMBER (2)
);
S SET OF DS
KEY (A);
SS SUBSET OF DS
WHERE (N=3);
FIND S AT A = "ABC".
SET SS TO DS
ON EXCEPTION
NEXT SENTENCE.
FIND NEXT SS.
SET S TO BEGINNING
ON EXCEPTION
DISPLAY "NONE".
SET SS TO ENDING
ON EXCEPTION
DISPLAY "NONE".
Later in this section, Example 4–1, “DMSII Sample Program,” shows the SET statement
within the context of a complete program.
STORE Statement
The STORE statement places a new or modified record into a data set. The statement
inserts the data from the user work area for the data set or global record into the data set
or global record area.
After you execute a CREATE or RECREATE statement, you can execute a STORE
statement to do one of the following:
• Ensure the validity of the data in the user work area if you have specified a VERIFY
condition in DASDL.
• Test the record for validity before the STORE statement inserts the record into each
set in the data set. For example, the STORE statement can test the record to
determine whether or not duplicate values for keys are allowed.
• Evaluate the WHERE condition for each automatic subset.
• Insert the record into all sets and automatic subsets if all conditions are satisfied.
• Lock the new record.
• Alter the data set path to point to the new record.
After you execute a LOCK or MODIFY statement, the STORE statement does the
following:
• Checks the data in the user work area for validity if you have specified a VERIFY
condition in the DASDL.
• Depending on the condition, performs the following steps:
− If items involved in the insertion conditions have changed, reevaluates the
conditions
− If the condition yields a FALSE value, removes the record from each automatic
subset that contains the record
− If the condition yields a TRUE value, inserts the record into each automatic
subset that does not contain the record
• Deletes and reinserts the record into the proper position if you have modified a key
used in ordering a set or automatic subset so that the record must be moved within
that set or automatic subset.
• Stores the record in a manual subset, but does not reorder that subset. Your program
is responsible for maintaining manual subsets. A subsequent reference to the record
using that subset produces undefined results.
General Format
The general format of the STORE statement is as follows:
STORE data-name-1
ïïïïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
data-name-1
This format element identifies the name of the data set you want to store. Data-name-1
causes the STORE statement to do one of the following:
• Return the data in the specified data set work area to the data set.
• Return the data in the global data work area to the global data record area.
You must lock the global data record before you execute a STORE statement; otherwise,
the program terminates the STORE statement with an exception.
ON EXCEPTION
This option handles exceptions. The program returns an exception and does not store the
record if the record does not meet any of the validation conditions. The program also
returns an exception if either of the following is true:
• The data set path is valid and the current record is not locked.
• The global data record is not locked.
Information on the ON EXCEPTION option is provided later in this section under “DMSII
Exceptions.”
Example
The following DASDL description is used by the COBOL74 code in the following example.
The description is compiled with the name DBASE.
D DATA SET (
A ALPHA (3);
N NUMBER (3);
);
S SET OF D KEY N;
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE.
DATA DIVISION.
DATA-BASE SECTION.
DB DBASE ALL.
PROCEDURE DIVISION.
START-PRG.
OPEN UPDATE DBASE.
CREATE D.
MOVE "ABC" TO A.
MOVE 1 TO N.
STORE D.
RECREATE-D.
RECREATE D.
ADD 1 TO N.
STORE D.
IF N < 500
GO TO RECREATE-D
ELSE
CLOSE DBASE
STOP RUN.
Later in this section, Example 4–1, “DMSII Sample Program,” shows the STORE statement
within the context of a complete program.
The database status word, DMSTATUS, is associated with each COBOL74 program that
accesses a database. The value of DMSTATUS indicates whether an exception has
occurred and specifies the nature of the exception. The data management structure
number attribute, DMSTRUCTURE, can also be helpful in analyzing the results of
exception conditions.
General Format
The general format of the DMSTATUS database status word is as follows:
ä å
³category-mnemonic³
³ ³
³DMCATEGORY ³
³ïïïïïïïïïï ³
³DMERRORTYPE ³
DMSTATUS ( ãïïïïïïïïïïï â )
ïïïïïïïï ³DMSTRUCTURE ³
³ïïïïïïïïïïï ³
³DMERROR ³
³ïïïïïïï ³
³DMRESULT ³
æïïïïïïïï ç
category-mnemonic
This format element yields a TRUE value if the major category specified by
categora-mnemonic has occurred.
DMCATEGORY
DMERRORTYPE
This attribute yields a numeric value identifying the subcategory of the major category.
DMSTRUCTURE
This attribute yields a numeric value identifying the structure number of the structure
involved in the exception. See “DMSTRUCTURE Structure Number Function” in this
section for more information.
DMERROR
DMRESULT
This attribute yields the 48-bit contents of DMSTATUS as a PIC X(6) data item. If no
exception has occurred, the program returns six EBCDIC nulls (that is, 48
“000000000000”).
The DMSTRUCTURE function is most useful when the previous operation against a data
set that is spanned by several data sets yielded an exception. The program can determine
from the structure number which structure caused the exception.
When you declare a partitioned structure in DASDL, the structure is assigned one or more
structure numbers, depending on the value of the integer in the following option:
For example, three structure numbers are assigned to the structure when you specify the
following option:
OPEN PARTITIONS = 3
The DMSTRUCTURE function returns the lowest structure number assigned to the
structure. However, the value in DMSTRUCTURE can be any of the values assigned by
DMSII at run time; it is not necessarily the same value every time.
General Format
The general format for the DMSTRUCTURE function is as follows:
data-name-1 (DMSTRUCTURE)
ïïïïïïïïïïï
data-name-1
This format element returns the structure number of the data set, set, or subset.
Example
The following example uses the DMSTRUCTURE structure number function:
DMSII Exceptions
You can use any of the following methods in your program code to handle exceptions:
An explanation of the DMERROR Use procedure and ON EXCEPTION option are included
in this discussion of DMSII exceptions. See Volume 1 for information on the USE
statement with Use procedures.
You can call the DMERROR Use procedure each time the program returns an exception
during the execution of a data management (DM) statement, unless the program contains
an ON EXCEPTION option for that statement. The DMERROR Use procedure passes
control of your program to the statement following the data management statement that
encountered the exception.
The DMERROR Use procedure can appear by itself or in any order with other Use
procedures in the DECLARATIVES SECTION. However, you can declare only one
DMERROR Use procedure in a COBOL74 program. In addition, the DMERROR Use
procedure cannot contain GO TO statements that reference labels outside the procedure.
If you use both a DMERROR Use procedure and an ON EXCEPTION option, the ON
EXCEPTION option takes precedence, and the DMERROR Use procedure is not executed.
Example
The following example shows the declaration for the DMERROR Use procedure:
DECLARATIVES.
DMERR-SECT SECTION.
USE ON DMERROR.
DMERR-PARA.
IF DMSTATUS(NOTFOUND)...
END DECLARATIVES.
ON EXCEPTION Option
You can place the ON EXCEPTION option after the verb of the following DM statements
to handle exceptions:
ABORT-TRANSACTION INSERT
ASSIGN LOCK
BEGIN-TRANSACTION MODIFY
CLOSE RECREATE
CREATE REMOVE
END-TRANSACTION SECURE
FIND SET
FREE STORE
GENERATE
The ON EXCEPTION option is also shown in the syntax of these data management
statements.
If you use both a DMERROR Use procedure and an ON EXCEPTION option, the ON
EXCEPTION option takes precedence, and the DMERROR Use procedure is not executed.
General Format
The general format of the ON EXCEPTION option is as follows:
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
One of these format elements is executed if the program returns an exception. Refer to
Volume 1 for information about these statements.
Examples
In the following line of code, a branch to the LBL1 subprogram is executed if a STORE
statement encounters an exception:
The following example uses the ON EXCEPTION option and interrogates DMSTATUS:
MODIFY S AT X = 3 ON EXCEPTION
IF DMSTATUS (NOTFOUND) GO NOT-FOUND-L ELSE
IF DMSTATUS (DEADLOCK) GO DEAD-LOCK-L ELSE
.
.
.
NOT-FOUND-L.
IF DMSTATUS (DMERRORTYPE) = 1 statement ELSE
IF DMSTATUS (DMERRORTYPE) = 2 statement ELSE
.
.
.
DEAD-LOCK-L.
IF DMSTATUS (DMERRORTYPE) = 1 statement ELSE
FIND REMOVE
The program accesses the UNIVDB database to create and update a master student file
called MSF. The master student file is sorted by the social security number of each
student. Updates can be performed to the file such as changing the name or grade of a
student. For example, the code for changing grades begins at line 032900. Two subsets are
created for students beginning at line 030000. One subset is based on the sex of each
student; the other subset contains information on students who have a grade point
average greater than 3.5.
017000 EXIT.
017100
017200
017300 RECREATE-ADR.
017400 RECREATE ADR.
017500 ADD 1 TO SNO.
017600 STORE ADR ON EXCEPTION
017700 PERFORM STATUS-BOOLEAN.
017800 RECREATE-ADR-EXIT.
017900 EXIT.
018000*
018100* Build MSF master student file.
018200*
018300 READ-CARD-LOOP.
018400 READ CARD AT END MOVE 1 TO END-OF-DATA-IND.
018500 WRITE MONITOR-REC FROM CARD-REC.
018600
018700 IF C-TYPE=1
018800 BEGIN-TRANSACTION AUDIT RSTDS
018900 PERFORM 100-CREATE-MSF THRU 100-CREATE-MSF-EXIT
019000 END-TRANSACTION NO-AUDIT RSTDS
019100
019200 ELSE IF C-TYPE=2
019300 BEGIN-TRANSACTION AUDIT RSTDS
019400 PERFORM 200-CREATE-QUARTER THRU 200-CREATE-QUARTER-EXIT
019500 END-TRANSACTION NO-AUDIT RSTDS
019600
019700 ELSE IF C-TYPE=3
019800 BEGIN-TRANSACTION AUDIT RSTDS
019900 PERFORM 300-CREATE-CORSES THRU 300-CREATE-CORSES-EXIT
020000 END-TRANSACTION NO-AUDIT RSTDS
020100
020200 ELSE IF C-TYPE=4
020300 PERFORM 400-LINK-MSF-TO-ADR
020400
020500 ELSE IF C-TYPE=5
020600 BEGIN-TRANSACTION AUDIT RSTDS
020700 PERFORM 500-DELETE-ADR THRU 500-DELETE-ADR-EXIT
020800 END-TRANSACTION NO-AUDIT RSTDS
020900
021000 ELSE IF C-TYPE=6
021100 PERFORM 600-GENERATE-SUBSET
021200
021300 ELSE IF C-TYPE=7
021400 BEGIN-TRANSACTION AUDIT RSTDS
021500 PERFORM 700-CHANGE-MSF-NAME THRU 700-CHANGE-MSF-NAME-EXIT
021600 END-TRANSACTION NO-AUDIT RSTDS
021700
021800 ELSE IF C-TYPE=8
026800 GO TO 300-CREATE-CORSES-EXIT
026900 ELSE
027000 PERFORM STATUS-BOOLEAN.
027100 LOCK QSET AT QTR = C-QTR.
027200 IF C-TYPECOURSE = 1 CREATE CORSES(1).
027300 IF C-TYPECOURSE = 2 CREATE CORSES(2).
027400 MOVE C-TYPECOURSE TO TYPECOURSE.
027500 IF C-TYPECOURSE = 1
027600 MOVE C-GRADE TO GRADE
027700 ELSE
027800 MOVE C-GRADE TO GGD.
027900 STORE CORSES ON EXCEPTION
028000 PERFORM STATUS-BOOLEAN.
028100 300-CREATE-CORSES-EXIT.
028200 EXIT.
028300
028400 400-LINK-MSF-TO-ADR.
028500 LOCK MSFSET AT SSNO = C-SSNO.
028600 LOCK SSAD AT SNO OF ADR = C-SSNO.
028700 MOVE ADLN(1) TO HOME-ADDRESS.
028800 400-LINK-MSF-TO-ADR-EXIT.
028900 EXIT.
029000
029100 500-DELETE-ADR.
029200 MOVE "LOCK MSFSET" TO MONITOR-VERB.
029300 LOCK MSFSET AT SSNO = C-SSNO ON EXCEPTION
029400 PERFORM STATUS-BOOLEAN.
029500 DELETE ADR ON EXCEPTION
029600 PERFORM STATUS-BOOLEAN.
029700 500-DELETE-ADR-EXIT.
029800 EXIT.
029900
030000 600-GENERATE-SUBSET.
030100 MOVE "GENERATE AND" TO MONITOR-VERB.
030200 GENERATE UTILITY = SMART AND SEXSET.
030300 FIND FIRST UTILITY ON EXCEPTION
030400 IF DMSTATUS(NOTFOUND)
030500 DISPLAY "SUBSET EMPTY"
030600 GO TO 600-GENERATE-SUBSET
030700 ELSE
030800 PERFORM STATUS-BOOLEAN.
030900 MOVE LNAME TO MONITOR-REC.
031000 WRITE MONITOR-REC.
031100 MOVE "GENERATE NULL" TO MONITOR-VERB.
031200 GENERATE UTILITY = NULL.
031300 600-GENERATE-SUBSET-EXIT.
031400 EXIT.
031500
031600 700-CHANGE-MSF-NAME.
The transaction processing system (TPS) provides users of the Data Management System
II (DMSII) with improved processing for a high volume of transactions. To minimize
program coding and maintenance, TPS separates the database processing functions into
modules and provides a library of transaction processing procedures.
Typically, there are two types of programs you can write for TPS:
This section discusses the functions of the program interface and provides program
samples that demonstrate a typical application using TPS. The following topics are
included:
See Also
Refer to the DMSII Transaction Processing System (TPS) Programming Guide for
information on general programming considerations and concepts, and for detailed
information on the Transaction Formatting Language (TFL) used in TPS to describe
transaction processing information.
Refer to identifiers in a COBOL74 program as they are declared in the TFL source. Note
that BDMSCOBOL74 compilers support the hyphenated identifier. Table 5–1 shows how
COBOL74 interprets TFL items in programs that access a transaction base.
Legend
<name> Declared item name
n, m Unsigned integers
S Optional negative sign (–)
• Specify only a transaction base to invoke all structures in the transaction base by
default.
• Optionally specify a list of transaction record formats and subformats, to invoke only
those structures of the transaction base.
The program can designate alternative internal names for the transaction base and for any
of the formats or subformats declared. If alternative internal names are used for the base
name, subbase name, format name, or subformat name, the program must reference these
internal identifiers rather than the TFL source identifiers.
A program can also declare a subbase that has been defined for the transaction base. If a
subbase is declared, only the transaction record formats and subformats defined within
that subbase are accessible to the program. The program can specify a list of transaction
record formats and subformats, using internal names if needed, that can be invoked from
that subbase.
The TRANSACTION SECTION in the DATA DIVISION contains the declarations of all
transaction bases that can be referenced in a COBOL74 program. The TRANSACTION
SECTION must appear between the DATA-BASE SECTION and the WORKING-STORAGE
SECTION.
General Format
The general format for invoking the transaction base is as follows:
TRANSACTION SECTION.
ïïïïïïïïïïï ïïïïïïï
Ú ¿
³TB [[ internal-base-id-1 = ] subbase-id ] OF base-id [ GLOBAL ] ³
³ïï ïï ïïïïïï ³
³Ú ¿³
³³USING [ internal-format-id-1 = ] format-id-1 ³³
³³ïïïïï ³³
³³Ú ¿ ³³
³³³ ä å ³ ³³
³³³ ³ALL ³ ³ ³³
³³³ ³ïïï ³ ³ ³³
³³³ ³NONE ³ ³ ³³
³³³ ( ãïïïï â )³ ³³
³³³ ï ³[internal-subformat-id-3 = ] subformat-id-3 ³ ï³ ³³
³³³ ³ ³ ³ ³³
³³³ ³ [[,internal-subformat-id-4 =] subformat-id-4] ...³ ³ ³³
³³³ æ ç ³ ³³
³³À Ù ³³
³³ ³³
³³Ú ¿ ³³
³³³, [internal-format-id-2 = ] format-id 2 ³ ³³
³³³Ú ¿ ³ ³³
³³³³ ä å ³ ³ ³³
³³³³ ³ALL ³ ³ ³ ³³
³³³³ ³ïïï ³ ³ ³ ³³
³³³³ ³NONE ³ ³ ³ ³³
³³³³ ( ãïïïï â )³... ³ ³³
³³³³ ï ³[internal-subformat-id-3 = ] subformat-id-3 ³ ï³ ³ ³³
³³³³ ³ ³ ³ ³ ³³
³³³³ ³ [[,internal-subformat-id-4 =] subformat-id-4...] ³ ³ ³ ³³
³³³³ æ ç ³ ³ ³³
ÀÀÀÀ Ù Ù ÙÙ
TRANSACTION SECTION
This section invokes all transaction bases that can be referenced in a program.
TB
This option specifies the name of the transaction base or transaction subbase to be
invoked in the program. All transaction bases that can be referenced by the program must
have transaction base declarations.
internal-base-id-1
subbase-id
If subbase-id is specified, only the transaction record formats and subformats defined
within that subbase are accessible.
base-id
This format element specifies the TFL base name of the transaction base to be invoked.
GLOBAL
This option enables a separately compiled bound procedure to reference the same
transaction base declared in the host program.
The transaction base formats and subformats must be declared in the same order in the
two programs being bound. The logical identifiers for transaction bases, formats, and
subformats also must be the same in the two programs being bound.
Any transaction library entry point that is used in the bound procedure must be declared
in the host program. Therefore, a COBOL74 host program must have CALL statements to
all the transaction library entry points that are used in the bound procedure.
USING
This option specifies one or more transaction record formats and subformats to be
invoked. If this option is used, only the indicated transaction record formats and
subformats are invoked. If this option is not used, transaction record formats and
subformats are invoked for that transaction base or subbase.
These format-ids specify the names of the transaction record format being invoked.
ALL
If the ALL option is used in the subformat list, all the subformats of that format are
invoked.
NONE
If the NONE option is used in the subformat list, no subformats of that format are invoked.
internal-subformat-id-1 through 4
subformat-id-1 through 4
If a list of subformat IDs is specified, only those subformats are invoked. If this list is not
specified, all subformats of the transaction record format are invoked.
See Also
See “Using Transaction Library Entry Points” later in this section for more information on
that topic.
Examples
The following example shows the syntax for declaring a transaction base:
TRANSACTION SECTION.
TB TRB = BANKTR
USING STATIS=STATUS, CREATEACCT, RESTARTDETANKER,
DEPOSIT, WITHDRAWAL, PURGEACCT, SYSTEMTR.
In the next example, subbase-id SUBB is the transaction record format of the BANKTR
base-id. The USING option includes ALL, which specifies that all the subformats are
invoked.
TRANSACTION SECTION.
TB TRB = SUBB OF BANKTR
USING ALL.
A transaction record variable can be associated with only one transaction base or
transaction subbase and can contain only one of the formats or subformats that have been
invoked for that particular transaction base or subbase. The size of the array row must be
large enough to accommodate the largest of all the formats invoked for it.
The following information explains how transaction record variables are declared, and
how transaction records are created.
Different formats are used to declare variables for the single array row and table array
row.
General Formats
The general formats used to declare transaction record variables for a single array row
and for a table array row are as follows:
01 transaction-record-id-1.
OCCURS integer-2
TIMES
GLOBAL
A transaction record or transaction record array that is declared in the host program can
be declared global in the bound procedure by using this option. The GLOBAL option
cannot be specified in the host program; it is allowed only in COBOL74 procedures
compiled with the LEVEL option set at 3 or higher. If a transaction base is declared global,
the associated transaction records are not made global unless the record syntax also
includes the GLOBAL option.
See Also
Refer to “Accessing Transaction Record Items” later in this section for more information
about subscripts.
Example
The following example shows declarations for transaction record variables:
TRANSACTION SECTION.
TB TRB = BANKTR
USING STATIS=STATUS, CREATEACCT, RESTARTDETANKER,
DEPOSIT, WITHDRAWAL, PURGEACCT, SYSTEMTR.
01 TRIN.
01 TROUT.
01 LASTINPUT.
01 RESTARTTRREC.
01 LASTRESPONSE.
• Assigns to the record variable the initial values of all items in the transaction record
format and subformat, if given. The items that are assigned are all declared in TFL.
• Initializes the transaction record control items.
When a format is created, only those items in the common part are assigned initial values.
When a subformat is created, the common part items as well as the subformat part items
are assigned initial values. The record variable contains the given format until you
reinitialize it with a subsequent CREATE statement. It is never cleared by the system.
Once a transaction record variable has been created in a particular format and optional
subformat, the items defined within the format and subformat can be accessed and
manipulated. If a transaction record is created in a particular format, the record contains
only the data items associated with that format. If a transaction record is created in a
particular format and subformat, the record contains the data items associated with the
format and the data items associated with the subformat.
General Format
The general format of the CREATE statement is as follows:
Ú ä å ¿ ä å
³ ³OF³ ³ ³OF³
CREATE ³ subformat-id ãïïâ ³ format-id ãïïâ
ïïïïïï ³ ³IN³ ³ ³IN³
À æïïç Ù æïïç
transaction-record-id [ ( subscript ) ] .
ï ï
subformat-id
This format element is the name of the subformat in which the initial values of the data
items are assigned to the transaction record variable.
format-id
This format element is the name of the format in which the initial values of the data items
are assigned to the transaction record variable.
transaction-record-id
This format element identifies the transaction record variable that is initialized to the
particular format, and the subformat if specified.
subscript
See Also
• More information on subscripts is provided in “Subscripts” later in this section.
• More information on transaction record variables is provided in “Declaration of
Transaction Record Variables” earlier in this section.
Examples
The following examples illustrate the use of the CREATE statement to initialize a variable
to a particular format:
The formal and actual parameters must refer to the same transaction base, but need not
specify the same list of transaction formats.
A transaction record is passed as a parameter in the same way that any 01-level entry is
passed.
See Also
• For more information on passing an 01-level entry as a parameter, refer to the
discussion of the USE statement in Volume 1.
• For coded program examples of parameter passing, see “TPS Programming Examples”
later in this section.
• For information on transaction library procedures see “Using Transaction Library
Entry Points” later in this section.
General Format
The general format for the MOVE statement is as follows:
transaction-record-1
This format element is a fully subscripted transaction record variable whose contents you
are assigning or copying to another transaction record variable.
transaction-record-2
This format element is a fully subscripted transaction record variable that receives its
contents from another transaction record variable.
See Also
For more information on the syntax and semantics of the MOVE statement, refer to
Volume 1.
Example
The following example assigns a transaction record variable named TRIN to the
transaction record variable named TROUT:
Transaction record data items are considered normal data items and can be referenced at
any place in the PROCEDURE DIVISION that is acceptable for a normal data item.
The following rules apply to the use of the CORRESPONDING phrase of a MOVE, ADD, or
SUBTRACT statement in referencing transaction record items:
• A transaction record name alone is not considered a legitimate group name. Instead, a
transaction record format name, a transaction subformat name, or a subordinate
group data item must be referenced.
• When a transaction record format is referenced, only the data items in the common
portion of the format are considered eligible for use in the CORRESPONDING phrase.
See Also
Refer to Volume 1 for more information on the CORRESPONDING phrase used in these
statements.
General Format
The general format for accessing transaction record items is as follows:
ä å
³OF³
transaction-record-item-id ãïïâ
³IN³
æïïç
Ú ä å ¿ Ú ä å ¿
³ ³OF³ ³ ³ ³OF³ ³
³ subformat-id ãïïâ ³ ³format-id ãïïâ ³transaction-record-id
³ ³IN³ ³ ³ ³IN³ ³
À æïïç Ù À æïïç Ù
[ ( subscript-1 [ , subscript-2 ] . . . ) ] .
ï ï
transaction-record-item-id
This format element identifies a particular transaction format data item that you want to
reference.
subformat-id
This format element identifies a particular transaction subformat. To access a data item
within a particular transaction record, you can specify subformat-id to qualify the item.
format-id
This format element identifies a particular transaction format. You might need to use
format-id as a qualifier to access a data item within a particular transaction record.
transaction-record-id
This format element identifies the transaction record variable that contains the data item
to be referenced.
Subscripts for the transaction-record-id are explained in “Subscripts” later in this section.
Coded examples are also provided.
See Also
See “Data Item Qualification” later in this section for more information on data item
qualification.
Examples
Following are examples of code used to access transaction record items:
Subscripts
A subscript is a COBOL74 arithmetic expression. A subscript identifies an element
declared with an OCCURS clause and within a table. A subscript is required if the
transaction-record-id is declared with an OCCURS clause, and this subscript must be
specified first if there are several subscripts.
• Data items of transaction record formats or subformats that are occurring items
• Items embedded within one or more occurring groups
• Occurring items embedded within occurring groups
If there is a subscript for the transaction record, subscripts within a list of transaction
record items follow that subscript. The subscripts within a list of transaction record items
are listed from left to right, and from the outermost occurring group to the innermost
occurring group or occurring items.
A valid subscript for a transaction record item ranges from 1 to the value of the unsigned
integer, which must not exceed 4095.
See Also
More information on transaction record variables declared with an OCCURS clause is
provided in “Declaration of Transaction Record Variables” earlier in this section.
A GROUP
(
B-1 REAL;
B-2 GROUP
(
C-1 REAL;
C-2 NUMBER(6) OCCURS 5 TIMES;
) OCCURS 10 TIMES;
) OCCURS 20 TIMES;
04 A OCCURS 20.
05 B-1 REAL.
05 B-2 OCCURS 10.
06 C-1 REAL.
06 C-2 PIC9(6) COMP OCCURS 5.
C-2 OF TR (3,7,2,4)
The following example shows the declaration for the subscripted reference:
01 TR OCCURS 10.
04 A OCCURS 20.
05 B-1 REAL.
05 B-2 OCCURS 10.
06 C-1 REAL.
06 C-2 PIC(6) COMP OCCURS 5.
Data item If the name of the desired data item is unique with respect to data
items of other invoked formats, then only the data item name need be
specified. For example,
DATAITEMNAME OF TRANREC
Format name and If the name of the desired data item is not unique with respect to data
data item name items of other invoked formats, but is unique to the format that
contains it, both the format and data item names are needed for
qualification. For example:
Additional information and a description of the record control items are provided in the
DMSII TPS Programming Guide.
General Format
The general format used to inquire about transaction control record items is as follows:
transaction-control-item
This format element is the name of the transaction control record about which you are
inquiring.
transaction-record-id
This format element identifies a transaction record variable. It must be fully subscripted if
a transaction record array element is used.
subscript
Example
The following example shows code used to inquire about transaction control record items:
READP.
******
.
.
.
MOVE "F/B/O =" TO RMT-1.
MOVE TRFILENUM(TRIN) TO RMT-2.
MOVE TRBLOCKNUM(TRIN) TO RMT-3.
MOVE TROFFSET(TRIN) TO RMT-4.
MOVE TRFORMAT(TRIN) TO RMT-5.
MOVE TRSUBFORMAT(TRIN) TO RMT-6.
The compile-time functions are discussed in detail in the DMSII TPS Programming
Guide. The format shown in the following text provides the syntax you use to access the
functions.
See Also
For examples of using compile-time functions, refer to “Update Library Programming
Conventions” later in this section.
General Format
The general format for using compile-time functions is as follows:
ä å
³TRFORMAT ³
³ïïïïïïïï ³
³TRSUBFORMAT³
³ïïïïïïïïïïï³
³TRDATASIZE ³ Ú ä å¿
³ïïïïïïïïïï ³ ³ ³OF³³
ãTRBITS â ( ³transaction-record-item-id ãïïâ³ )
³ïïïïïï ³ ï ³ ³IN³³ ï
³TRDIGITS ³ À æïïçÙ
³ïïïïïïï ³
³TRBYTES ³
³ïïïïïïï ³
³TROCCURS ³
æïïïïïïïï ç
Ú ä å ¿ Úä å ¿
³ ³OF³ ³ ³³OF³ ³
³ subformat-id ãïïâ ³ format-id ³ãïïâ transaction-base-id ³ .
³ ³IN³ ³ ³³IN³ ³
À æïïç Ù Àæïïç Ù
transaction-record-item-id
This format element is the name of a data item contained within an invoked transaction
format or subformat.
subformat-id
This format element is the name of a transaction subformat that has been invoked within
the program.
format-id
This format element is the name of a transaction format that has been invoked within the
program.
transaction-base-id
This format element is the name of a transaction base that has been invoked within the
program.
The following information explains how to pass a numeric item to an integer parameter of
an entry point and a display item to a string parameter of an entry point. It also discusses
the TPS entry points and the CALL statement syntax used to access the entry points.
See Also
For detailed information on transaction library entry points, refer to the DMSII TPS
Programming Guide.
To pass a numeric item to an ALGOL integer parameter, you use one of the following two
methods:
• Use the INTEGER function, which converts an item declared with USAGE
COMPUTATIONAL to an ALGOL integer representation.
• Specify the BINARY option in the USAGE clause of the item declaration. When the
BINARY option is specified, the item is represented in binary form, which is the same
as an ALGOL integer representation.
In addition, you can pass an item declared with the USAGE DISPLAY clause to an ALGOL
string parameter of a library entry point by using the STRING function to convert the item
to an ALGOL string representation.
See Also
• For more information regarding the STRING and INTEGER functions, refer to
Volume 1.
• For information on how integer parameters must be declared so that an update library
can receive them from transaction library entry points, refer to “Parameter Passing to
an Update Library” later in this section.
General Format
The general format for the INTEGER and STRING functions is as follows:
INTEGER ( COBOL74-identifier )
ïïïïïïï ï ï
STRING ( COBOL74-identifier )
ïïïïïï ï ï
INTEGER (COBOL74-identifier)
This function converts the COMP item specified by the identifier to an ALGOL integer
representation. The identifier must be a COMP item.
STRING (COBOL74-identifier)
This function converts the DISPLAY item specified by the identifier to an ALGOL string
representation so that the item can be passed to an ALGOL string parameter of a library
entry point.
CALL......USING INTEGER(VARNAME),....
GIVING INTEGER(RESULT).
If VARNAME and RESULT are COMP items declared with the BINARY option in the
USAGE clause, the previous example is changed to
CALL......USING VARNAME,......
GIVING RESULT.
CALL......USING INTEGER(VARNAME-1),
STRING(DISPLAYVAR) GIVING INTEGER(VARNAME-2).
Example
The following example uses the CALL statement with a TPS entry point. Refer to the TPS
sample programs at the end of this section for more examples of use of the entry points.
PROCESSTRANSACTION.
CALL "PROCESSTRANSACTION "
USING IDNUM, TRIN, TROUT,
RESTARTTRREC
GIVING TPS-RESULT.
Table 5–3 includes the TPS entry points and their parameters.
The following paragraphs explain the conventions used to program the update library,
describes methods used to declare transaction Use procedures, and covers methods used
to declare ALGOL integer parameters so that they are passed to an update library from
TPS entry points. The following text also describes the transaction processing statements
that are extensions developed for the TPS program interface.
See Also
For information on TPS entry points, refer to “Using Transaction Library Entry Points”
earlier in this section.
The update library must provide one entry point that makes it accessible to the
transaction library. The name of this entry point is ACCESSDATABASE. In a COBOL74
program, ACCESSDATABASE must be the program-name defined in the
IDENTIFICATION DIVISION.
The ACCESSDATABASE entry point accepts certain parameters, which are explained in
detail in the DMSII TPS Programming Guide.
See Also
• For information on programming the update library, refer to the DMSII TPS
Programming Guide.
• For an example of an update library, refer to “TPS Programming Examples” later in
this section.
General Format
The general format of the section header for a transaction Use procedure is as follows:
section-name SECTION.
ïïïïïïïï
Ú ¿
USE AS³ GLOBAL ³ TRANSACTION PROCEDURE .
À ïïïïïï Ù ïïïïïïïïïïï ïïïïïïïïï
GLOBAL
A transaction record or transaction record array that is declared in the host program can
be declared global in the bound procedure, by using the GLOBAL option. The names of the
procedures must be the same in the bound procedure and in the host program.
See Also
For more information on the USE statement syntax, semantics, and general rules, refer to
Volume 1.
DECLARATIVES.
TR1 SECTION. USE AS GLOBAL TRANSACTION PROCEDURE.
TR2 SECTION. USE AS GLOBAL TRANSACTION PROCEDURE.
END DECLARATIVES.
See Also
• For information about the update library, see “Using the Update Library” earlier in this
section.
• For examples of an update library written in COBOL74, refer to “TPS Programming
Examples” later in this section.
OPEN Statement
The OPEN statement opens a database for subsequent access and specifies the access
mode. It also performs an explicit CREATE statement on the restart data set (RDS).
The TRUPDATE option for the OPEN statement must be used in the update library.
General Format
The general format of the OPEN statement is as follows:
Úä å ¿
³³INQUIRY ³ ³
OPEN ³ãïïïïïïï â ³ data-name-1
ïïïï ³³TRUPDATE³ ³
Àæïïïïïïïïç Ù
Ú ä å ¿
³ ³ imperative-statement-1 ³ ³
³ON EXCEPTION ã conditional-statement-1 â ³ .
³ ïïïïïïïïï ³ NEXT SENTENCE ³ ³
À æ ïïïï ïïïïïïïï ç Ù
INQUIRY
This option enforces read-only access to the database. This option is specified when no
update operations are to be performed on the database. If the INQUIRY option is
specified, the use of the BEGIN-TRANSACTION, MID-TRANSACTION, and
END-TRANSACTION statements is not allowed.
TRUPDATE
data-name-1
ON EXCEPTION
This option handles exceptions. The program returns an exception if the following
statements are used when the database is opened with the INQUIRY option:
The program also returns an exception if the database is already open. If an exception is
returned, the state of the database is unchanged.
See Also
Refer to “Processing DMSII Exceptions” in Section 4, “Using the DMSII Program
Interface,” for information on the ON EXCEPTION option.
BEGIN-TRANSACTION Statement
The BEGIN-TRANSACTION statement places a program in transaction state. This
statement is used only with audited databases. The statement must be able to pass a
transaction record as well as pass parameters to procedures in the Accessroutines.
General Format
The general format of the BEGIN-TRANSACTION statement is as follows:
BEGIN-TRANSACTION ( transaction-record-variable-id )
ïïïïïïïïïïïïïïïïï ï ï
Ú ä å ¿
³ ³ imperative-statement-1 ³ ³
restart-data-set-name ³ON EXCEPTION ã conditional-statement-1 â ³ .
³ ïïïïïïïïï ³ NEXT SENTENCE ³ ³
À æ ïïïï ïïïïïïïï ç Ù
transaction-record-variable-id
This identifier is the name of the formal input transaction record variable.
restart-data-set-name
This format element is the name of the RDS. The RDS is declared in the TFL source as
parameters.
ON EXCEPTION
This option handles exceptions. The program returns an exception if the database is
already open. If an exception is returned, the state of the database is unchanged.
See Also
Refer to “Processing DMSII Exceptions” in Section 4, “Using the DMSII Program
Interface,” for information on the ON EXCEPTION option.
MID-TRANSACTION Statement
The MID-TRANSACTION statement causes the compiler to generate calls on the given
procedure immediately before the call on the DMSII procedure in the Accessroutines. This
statement must be able to pass a transaction record as well as present parameters to
procedures in the Accessroutines. The MID-TRANSACTION statement is used only with
audited databases.
General Format
The general format of the MID-TRANSACTION statement is as follows:
MID-TRANSACTION ( transaction-record-variable-id,
ïïïïïïïïïïïïïïï ï
saveinputtr-procedure-identifier )
ï
Ú ä å ¿
³ ³ imperative-statement-1 ³ ³
³ON EXCEPTION ã conditional-statement-1 â ³ .
³ ïïïïïïïïï ³ NEXT SENTENCE ³ ³
À æ ïïïï ïïïïïïïï ç Ù
transaction-record-variable-id
saveinputtr-procedure-identifier
This format element is an identifier for the SAVEINPUTTR procedure. SAVEINPUT is the
name of the SAVEINPUTTR formal procedure. SAVEINPUTTR is an untyped formal
procedure with no parameters. The compiler generates a call on a particular procedure
immediately before the call on the DMSII procedure in the Accessroutines.
ON EXCEPTION
This option handles exceptions. The program returns an exception if the database is
already open. If an exception is returned, the state of the database is unchanged.
See Also
Refer to “Processing DMSII Exceptions” in Section 4, “Using the DMSII Program
Interface,” for information on the ON EXCEPTION option.
END-TRANSACTION Statement
The END-TRANSACTION statement takes a program out of transaction state. This
statement must be able to pass a transaction record and present parameters to procedures
in the Accessroutines.
General Format
The general format of the END-TRANSACTION statement is as follows:
END-TRANSACTION ( transaction-record-variable-id,
ïïïïïïïïïïïïïïï ï
saveresponse-procedure-identifier ) restart-data-set-name
ï
Ú ä å ¿
Ú ¿ ³ ³ imperative-statement-1 ³ ³
³SYNC³ ³ON EXCEPTION ã conditional-statement-1 â ³ .
ÀïïïïÙ ³ ïïïïïïïïï ³ NEXT SENTENCE ³ ³
À æ ïïïï ïïïïïïïï ç Ù
transaction-record-variable-id
saveresponsetr-procedure-identifier
restart-data-set-name
SYNC
ON EXCEPTION
This option handles exceptions. The program returns an exception if the database is
already open. If an exception is returned, the state of the database is unchanged.
See Also
Refer to “Processing DMSII Exceptions” in Section 4, “Using the DMSII Program
Interface,” for information on the ON EXCEPTION option.
DASDL Description
Example 5–1 shows the DASDL description for the COBOL74 banking transaction program
(Example 5–4).
OPTIONS(AUDIT);
PARAMETERS(SYNCPOINT = 10 TRANSACTIONS);
);
TFL Description
Example 5–2 shows the TFL description for the banking transaction program in
Example 5–4.
AREAS = 100,
AREASIZE = 100 BLOCKS,
BLOCKSIZE = 20 SEGMENTS,
FAMILY = DISK,
CHECKSUM = TRUE
),
DATA FILE
(
AREAS = 100,
AREASIZE = 2 BLOCKS,
BLOCKSIZE = 3 SEGMENTS,
FAMILY = DISK,
CHECKSUM = TRUE
);
Update Library
Example 5–3 shows an update library capable of maintaining database consistency. Refer
to “Using the Update Library” earlier in this section for more information about
programming update libraries.
001500*
001600 WORKING-STORAGE SECTION.
001700 77 FUNCTIONFLAG COMP PIC 9(8).
001800 77 ACCT COMP PIC 9(6).
001900 77 OLDBAL COMP PIC S9(8)V99.
002000 77 NEWBAL COMP PIC S9(8)V99.
002100*
002200******************************************************************
002300*
002400 PROCEDURE DIVISION USING FUNCTIONFLAG,TRIN,TROUT,SAVEINPUT,
002500 SAVERESPONSE.
002600 DECLARATIVES.
002700 SAVEINPUT SECTION. USE AS TRANSACTION PROCEDURE.
002800 SAVERESPONSE SECTION. USE AS TRANSACTION PROCEDURE.
002900 END DECLARATIVES.
003000*
003100 MAIN SECTION.
003200 P1.
003300 IF FUNCTIONFLAG EQUAL 1 PERFORM OPENUPDATE ELSE
003400 IF FUNCTIONFLAG EQUAL 2 PERFORM OPENINQUIRY ELSE
003500 IF FUNCTIONFLAG EQUAL 3 PERFORM UPDATEDB ELSE
003600 IF FUNCTIONFLAG EQUAL 4 PERFORM FORCEABORT ELSE
003700 IF FUNCTIONFLAG EQUAL 5 PERFORM CLOSEDB.
003800 UPDATELIB-EXIT.
003900 EXIT PROGRAM.
04300 OPENUPDATE.
004400************
004500 OPEN TRUPDATE DBASE.
004600*
004700*
004800 OPENINQUIRY.
004900 ************
005000 OPEN INQUIRY DBASE.
005100*
005200*
005300 UPDATEDB.
005400*********
005500 IF TRFORMAT(TRIN) EQUAL TRFORMAT(CREATEACCT) PERFORM MAKEACCT
005600 PERFORM MAKEACCT ELSE
005700 IF TRFORMAT(TRIN) EQUAL TRFORMAT(PURGEACCT) PERFORM ELIMACCT
005800 PERFORM ELIMACCT ELSE
005900 IF TRFORMAT(TRIN) EQUAL TRFORMAT(STATIS)
006000 PERFORM STATUSCHK ELSE
006100 IF TRFORMAT(TRIN) EQUAL TRFORMAT(DEPOSIT)
006200 PERFORM DEPAMNT ELSE
006300 IF TRFORMAT(TRIN) EQUAL TRFORMAT(WITHDRAWAL)
006400 PERFORM WITHAMNT ELSE
006500 DISPLAY "NO UPDATE ROUTINE FOR THE FORMAT PASSED IN".
006600*
006700*
006800 FORCEABORT.
006900***********
007000 CLOSE DBASE.
007100*
007200*
007300 CLOSEDB.
007400********
007500 CLOSE DBASE.
007600*
007700*
007800* This is the update routine for creating a new account.
007900*
008000 MAKEACCT.
008100*********
008200 CREATE ACCOUNT ON EXCEPTION PERFORM ERR.
008300 MOVE ACCTNUM OF CREATEACCT OF TRIN TO ACCOUNT-NUM.
008400 MOVE NAME OF CREATEACCT OF TRIN TO NAME OF ACCOUNT.
008500 BEGIN-TRANSACTION(TRIN) RDS ON EXCEPTION PERFORM ERR.
008600 MID-TRANSACTION(TRIN,SAVEINPUT) RDS ON EXCEPTION PERFORM ERR.
008700 STORE ACCOUNT ON EXCEPTION PERFORM ERR.
008800*
008900 RETURN INPUT TRANSACTION AS GOOD TRANSACTION RESPONSE RECORD.
009000*
009100 MOVE TRIN TO TROUT.
009200 END-TRANSACTION(TRIN,SAVERESPONSE) RDS ON EXCEPTION PERFORM
009300 ERR.
009400*
009500* This is the update routine for eliminating an existing account.
009600*
009700 ELIMACCT.
009800*********
009900 MOVE ACCTNUM OF PURGEACCT OF TRIN TO ACCT.
010100 LOCK ACCOUNT-SET AT ACCOUNT-NUM = ACCT ON EXCEPTION PERFORM
010200 ERR.
010300 BEGIN-TRANSACTION(TRIN) RDS ON EXCEPTION PERFORM ERR.
010400 MID-TRANSACTION(TRIN,SAVEINPUT) RDS ON EXCEPTION PERFORM ERR.
010500 DELETE ACCOUNT ON EXCEPTION PERFORM ERR.
010600*
010700* Return same transaction as good transaction response record.
010800*
010900 MOVE TRIN TO TROUT.
011100 END-TRANSACTION(TRIN,SAVERESPONSE) RDS ON EXCEPTION PERFORM
011200 ERR.
011300*
011400* This is an example of an inquiry routine. It returns the balance
011500* of a particular account.
011600*
011700 STATUSCHK.
011800***********
011900 MOVE ACCTNUM OF STATIS OF TRIN TO ACCT.
012000 FIND ACCOUNT-SET AT ACCOUNT-NUM = ACCT ON EXCEPTION PERFORM
012100 ERR.
012200 MOVE TRIN TO TROUT.
012300 MOVE BALANCE OF ACCOUNT TO BALANCE OF STATIS OF TROUT.
012400*
012500* This is the update routine to place deposits into accounts.
012600*
012700 DEPAMNT.
012800********
012900 MOVE ACCTNUM OF DEPOSIT OF TRIN TO ACCT.
013000 LOCK ACCOUNT-SET AT ACCOUNT-NUM = ACCT ON EXCEPTION PERFORM
013100 ERR.
013200 MOVE BALANCE OF ACCOUNT TO OLDBAL.
013300 ADD OLDBAL, AMOUNT OF DEPOSIT OF TRIN GIVING NEWBAL.
013400 CREATE DEPOSIT OF ACCOUNT ON EXCEPTION PERFORM ERR.
013500 MOVE TRANDATE OF DEPOSIT OF TRIN TO TRANDATE OF DEPOSIT OF
013600 ACCOUNT.
013700 MOVE AMOUNT OF DEPOSIT OF TRIN TO
013800 AMOUNT OF DEPOSIT OF ACCOUNT.
013900 MOVE OLDBAL TO OLD-BALANCE.
014000 MOVE NEWBAL TO NEW-BALANCE.
014100 MOVE NEWBAL TO BALANCE OF ACCOUNT.
014200 BEGIN-TRANSACTION(TRIN) RDS ON EXCEPTION PERFORM ERR.
014300 MID-TRANSACTION(TRIN,SAVEINPUT) RDS ON EXCEPTION PERFORM ERR.
014400 STORE ACCOUNT ON EXCEPTION PERFORM ERR.
014500 STORE DEPOSIT OF ACCOUNT ON EXCEPTION PERFORM ERR.
014600 CREATE STATIS IN TROUT.
014700 MOVE NEWBAL TO BALANCE OF STATIS OF TROUT.
014800 MOVE ACCTNUM OF DEPOSIT OF TRIN TO
014900 ACCTNUM OF STATIS OF TROUT.
015000 END-TRANSACTION(TRIN,SAVERESPONSE) RDS ON EXCEPTION PERFORM
015100 ERR.
015200*
015300* This update routine performs withdrawals against accounts.
015500*
015600 WITHAMNT.
015700*********
015800 MOVE ACCTNUM OF WITHDRAWAL OF TRIN TO ACCT.
015900 LOCK ACCOUNT-SET AT ACCOUNT-NUM = ACCT ON EXCEPTION PERFORM
016000 ERR.
016100 MOVE BALANCE OF ACCOUNT TO OLDBAL.
016200 SUBTRACT AMOUNT OF WITHDRAWAL OF TRIN FROM OLDBAL GIVING
016300 NEWBAL.
016400 CREATE DEPOSIT OF ACCOUNT ON EXCEPTION PERFORM ERR.
016500 MOVE TRANDATE OF WITHDRAWAL OF TRIN TO TRANDATE OF DEPOSIT OF
016600 ACCOUNT.
016700 MOVE AMOUNT OF WITHDRAWAL OF TRIN TO AMOUNT OF DEPOSIT OF
016800 ACCOUNT.
016900 MOVE OLDBAL TO OLD-BALANCE.
017000 MOVE NEWBAL TO NEW-BALANCE.
017100 MOVE NEWBAL TO BALANCE OF ACCOUNT.
017200 BEGIN-TRANSACTION(TRIN) RDS ON EXCEPTION PERFORM ERR.
017300 MID-TRANSACTION(TRIN,SAVEINPUT) RDS ON EXCEPTION PERFORM ERR.
000100$SET FREE
000200 IDENTIFICATION DIVISION.
000300 ENVIRONMENT DIVISION.
000400 INPUT-OUTPUT SECTION.
000500 FILE-CONTROL.
000600 SELECT REMOTEFILE
000700 ASSIGN TO REMOTE.
000800 SELECT PRINTFILE
000900 ASSIGN TO PRINTER.
001000 I-O-CONTROL.
001100 DATA DIVISION.
001200 FILE SECTION.
001300 FD REMOTEFILE
001400 RECORD CONTAINS 72 CHARACTERS.
001500 01 RMT-REC PIC X(72).
001600 01 RMT-FIELDS.
001700 03 RMT-1 PIC X(10).
001800 03 RMT-2 PIC X(10).
001900 03 RMT-3 PIC X(10).
002000 03 RMT-4 PIC X(10).
002100 03 RMT-5 PIC X(10).
002200 03 RMT-6 PIC X(10).
002300 03 RMT-7 PIC X(12).
002400 FD PRINTFILE
007500*
007600 PROCEDURE DIVISION.
007700 MAIN SECTION.
007800 P1.
007900 OPEN I-O REMOTEFILE.
008000 OPEN OUTPUT PRINTFILE.
008100 MOVE 3 TO TANKING.
008200*
008300*****************************************************************
008400*
008500* Set the LIBPARAMETER before the first call on the library
008600* entry point.
008700*
008800******************************************************************
008900*
009000 MOVE "JOURNAL NAME?" TO RMT-REC.
009100 PERFORM WRITE-RMT.
009200 READ REMOTEFILE INTO USER-NAME; INVALID GO TO ERR.
009300 CHANGE ATTRIBUTE LIBPARAMETER OF "BANKTR/CODE/HOSTLIB"
009400 TO USER-NAME.
009500*
009600 MOVE "WHAT DO YOU WANT TO DO?" TO RMT-REC.
009700 PERFORM WRITE-RMT.
009800 MOVE "CHOICE (1=UPDATE, 2=INQUIRY, 3=TANK, 4=READ)"
009900 TO RMT-REC.
010000 PERFORM WRITE-RMT.
010100 READ REMOTEFILE INTO OPT-X; INVALID KEY GO TO EXT.
010200 MOVE OPT-X TO OPT.
010300 MOVE OPT TO RMT-REC. PERFORM WRITE-RMT.
010400 PERFORM OPENTRBASE.
010500 IF TPS-RESULT > 0 GO TO ERR.
010600*
010700******************************************************************
010800*
010900* Create a restart transaction to be written to the TRHISTORY
011000* file along with the input transaction. Note that values are
011100* not assigned to the items of this record. Normally the values
011200* are assigned; however, for readability the code is not shown
011300* in this example.
011400*
011500******************************************************************
011600*
011700 CREATE RESTARTDETANKER IN RESTARTTRREC.
011800 MOVE "USER ID ? (X17)" TO RMT-REC.
011900 PERFORM WRITE-RMT.
0012000 READ REMOTEFILE INTO ID-X; INVALID KEY GO TO EXT.
012100 PERFORM LOGONTRUSER.
012200 IF TPS-RESULT > 0 GO TO ERR.
012300 MOVE IDNUM TO RMT-2.
012400 PERFORM WRITE-RMT.
012500*
012600 LOOP.
012700 MOVE "FUNCTION NAME (OR HELP)" TO RMT-REC.
012800 PERFORM WRITE-RMT.
012900 READ REMOTEFILE INTO SP; INVALID KEY GO TO EXT.
013000 IF SP = "CREATEUSER" PERFORM CREATEUSERP ELSE
013100 IF SP = "PURGEUSER" PERFORM PURGEUSERP ELSE
013200 IF SP = "CREATE" PERFORM CREATEP ELSE
013300 IF SP = "PURGE" PERFORM PURGEP ELSE
013400 IF SP = "DEPOSIT" PERFORM DEPOSITP ELSE
013500 IF SP = "WITHDRAWAL" PERFORM WITHDRAWLP ELSE
013600 IF SP = "QUIT" PERFORM QUITP ELSE
013700 IF SP = "STAT" PERFORM STATUSP ELSE
013800 IF SP = "NEWUSER" PERFORM NEWUSERP ELSE
013900 IF SP = "REOPEN" PERFORM REOPENP ELSE
014000 IF SP = "SEEK" PERFORM SEEKP ELSE
014100 IF SP = "R" PERFORM READP ELSE
014200 IF SP = "HELP" PERFORM HELPP ELSE
0014300 IF SP = "GETLAST" PERFORM GETLASTP THRU GETLASTP-EXIT
014400 ELSE
014500 IF SP = "SW" PERFORM SWITCHP ELSE
014600 IF SP = "STAT" PERFORM STATISTICSP ELSE
014700 DISPLAY "DID NOT RECOGNIZE FUNCTION NAME".
014800 GO TO LOOP.
014900 EXT.
015000 STOP RUN.
015100******************************************************************
015200 CREATEP.
015300*********
015400 MOVE "FUNCTION IS CREATE" TO RMT-REC.
015500 PERFORM WRITE-RMT.
015600 PERFORM GETACCT.
015700 MOVE "CUSTOMER NAME? (X17) " TO RMT-REC.
015800 PERFORM WRITE-RMT.
015900 READ REMOTEFILE INTO USER-NAME; INVALID KEY GO TO EXT.
016000 CREATE CREATEACCT IN TRIN.
016100 MOVE ACCT TO ACCTNUM OF CREATEACCT OF TRIN.
016200 MOVE USER-NAME TO NAME OF CREATEACCT OF TRIN.
016300 PERFORM PROCESSTR THRU PROCESSTR-EXIT.
016400*
016500 PURGEP.
016600********
016700 MOVE "FUNCTION IS PURGE" TO RMT-REC.
016800 PERFORM WRITE-RMT.
016900 PERFORM GETACCT.
017000 CREATE PURGEACCT IN TRIN.
017100 MOVE ACCT TO ACCTNUM OF PURGEACCT OF TRIN.
017200 PERFORM PROCESSTR THRU PROCESSTR-EXIT.
017300*
017400 STATUSP.
017500*********
017600 MOVE "FUNCTION IS STATUS" TO RMT-REC.
017700 PERFORM WRITE-RMT.
043400 PURGETRUSER.
042500 CALL "PURGETRUSER OF BANKTR/CODE/HOSTLIB"
042600 USING IDNUM
042700 GIVING TPS-RESULT.
042800*
042900 LOGONTRUSER.
043000 CALL "LOGONTRUSER OF BANKTR/CODE/HOSTLIB"
043100 USING ID-X, IDNUM
043200 GIVING TPS-RESULT.
043300*
043400 LOGOFFTRUSER.
043500 CALL "LOGOFFTRUSER OF BANKTR/CODE/HOSTLIB"
043600 USING IDNUM
043700 GIVING TPS-RESULT.
043800*
043900 RETURNRESTARTINFO.
044000 CALL "RETURNRESTARTINFO OF BANKTR/CODE/HOSTLIB"
044100 USING IDNUM, TROUT
044200 GIVING TPS-RESULT.
044300*
044400 RETURNLASTRESPONSE.
044500 CALL "RETURNLASTRESPONSE OF BANKTR/CODE/HOSTLIB"
044600 USING IDNUM, TROUT
044700 GIVING TPS-RESULT.
044800*
044900 TANKTRNORESTART.
045000 CALL "TANKTRNORESTART OF BANKTR/CODE/HOSTLIB"
045100 USING IDNUM, TRIN
045200 GIVING TPS-RESULT.
045300*
045400 PROCESSTRANSACTION.
045500 CALL "PROCESSTRANSACTION OF BANKTR/CODE/HOSTLIB"
045600 USING IDNUM, TRIN, TROUT, RESTARTTRREC
045700 GIVING TPS-RESULT.
045800*
045900 OPENTRBASE.
046000 CALL "OPENTRBASE OF BANKTR/CODE/HOSTLIB"
046100 USING OPT, TIMEOUTV
046200 GIVING TPS-RESULT.
046300*
046400 CLOSETRBASE.
046500 CALL "CLOSETRBASE OF BANKTR/CODE/HOSTLIB"
046600 GIVING TPS-RESULT.
046700*
048000 SEEKTRANSACTION.
048100 CALL "SEEKTRANSACTION OF BANKTR/CODE/HOSTLIB"
048200 USING FILENUMBER, BLOCKNUMBER, OFFSETS
048300 GIVING TPS-RESULT.
048400*
048500 READTRANSACTION.
048600 CALL "READTRANSACTION OF BANKTR/CODE/HOSTLIB"
048700 USING TRIN
048800 GIVING TPS-RESULT.
048900*
049000 SWITCHTRFILE.
049100 CALL "SWITCHTRFILE OF BANKTR/CODE/HOSTLIB"
049200 GIVING TPS-RESULT.
049300*
049400 HANDLESTATISTICS.
049500 CALL "HANDLESTATISTICS OF BANKTR/CODE/HOSTLIB"
049600 USING STATOPTION
049700 GIVING TPS-RESULT.
002400 01 TRIN.
002500 01 TROUT.
002600 01 LASTINPUT.
002700 01 LASTRESPONSE.
002800 WORKING-STORAGE SECTION.
002900.
003000.
003100*
003200******************************************************************
003300 PROCEDURE DIVISION.
003400 MAIN SECTION.
003500.
003600.
003700.
003800 STOP RUN.
003900******************************************************************
004000*
004100 CREATETRUSER.
004200 CALL "CREATETRUSER OF BANKTR/CODE/HOSTLIB"
004300 USING ID-X, IDNUM
004400 GIVING TPS-RESULT.
004500*
004600 PURGETRUSER.
004700 CALL "PURGETRUSER OF BANKTR/CODE/HOSTLIB"
004800 USING ID-X
004900 GIVING TPS-RESULT.
005000*
005100 LOGONTRUSER.
005200 CALL "LOGONTRUSER OF BANKTR/CODE/HOSTLIB"
005300 USING ID-X, IDNUM
005400 GIVING TPS-RESULT.
005500*
005600 LOGOFFTRUSER.
005700 CALL "LOGOFFTRUSER OF BANKTR/CODE/HOSTLIB"
005800 USING IDNUM
005900 GIVING TPS-RESULT.
006000*
006100 RETURNRESTARTINFO.
006200 CALL "RETURNRESTARTINFO OF BANKTR/CODE/HOSTLIB"
006300 USING IDNUM, TROUT
006400 GIVING TPS-RESULT.
006500*
006600 RETURNLASTRESPONSE.
006700 CALL "RETURNLASTRESPONSE OF BANKTR/CODE/HOSTLIB"
006800 USING IDNUM, TROUT
006900 GIVING TPS-RESULT.
007000*
007100 TANKTRNORESTART.
007200 CALL "TANKTRNORESTART OF BANKTR/CODE/HOSTLIB"
007300 USING IDNUM, TRIN
007400 GIVING TPS-RESULT.
007500*
007600 PROCESSTRNORESTART.
007700 CALL "PROCESSTRNORESTART OF BANKTR/CODE/HOSTLIB"
007800 USING IDNUM, TRIN, TROUT
007900 GIVING TPS-RESULT.
008000*
008100 OPENTRBASE.
008200 CALL "OPENTRBASE OF BANKTR/CODE/HOSTLIB"
008300 USING OPT, TIMEOUTV
008400 GIVING TPS-RESULT.
008500*
008600 CLOSETRBASE.
008700 CALL "CLOSETRBASE OF BANKTR/CODE/HOSTLIB"
008800 GIVING TPS-RESULT.
008900*
009000 SEEKTRANSACTION.
009100 CALL "SEEKTRANSACTION OF BANKTR/CODE/HOSTLIB"
009200 USING FILENUMBER, BLOCKNUMBER, OFFSETS
009300 GIVING TPS-RESULT.
009400*
009500 READTRANSACTION.
009600 CALL "READTRANSACTION OF BANKTR/CODE/HOSTLIB"
009700 USING TRIN
009800 GIVING TPS-RESULT.
009900*
010000 SWITCHTRFILE.
010100 CALL "SWITCHTRFILE OF BANKTR/CODE/HOSTLIB"
010200 GIVING TPS-RESULT.
010300*
010400 HANDLESTATISTICS.
010500 CALL "HANDLESTATISTICS OF BANKTR/CODE/HOSTLIB"
010600 USING STATOPTION
010700 GIVING TPS-RESULT.
Screen Design Facility (SDF) is a tool to help programmers design and process forms for
applications. SDF provides form processing that eliminates the need for complicated
format language or code, and it enables you to provide validation for data entered on
forms by application users.
You can use SDF with the Advanced Data Dictionary System (ADDS) and with the
Communications Management System (COMS).
When you use SDF with ADDS, you can take advantage of the following ADDS
capabilities:
• Defining prefixes for entities, including DMSII database elements, COBOL74 data
description items, or fields of SDF or SDF Plus forms
• Defining a synonym, which means referring to an entity by another name
For further information about defining prefixes and synonyms for entities, refer to the
InfoExec ADDS Operations Guide.
Refer to the product documentation for information on the concepts and programming
considerations for using ADDS and COMS with SDF. For more information on the
extensions used with these products, refer to Section 2, “Using the ADDS Program
Interface” and Section 3, “Using the COMS Program Interface.”
Note: A program can invoke only one dictionary. Therefore, if a program accesses
both a SIM database (from a dictionary) and SDF forms, both must be in the
same dictionary.
General Format
The general format of the DICTIONARY statement is as follows:
Ú ¿
³, DICTIONARY IS literal-1³
À ïïïïïïïïïï Ù
DICTIONARY
This clause enables you to identify the function name of the dictionary library.
literal-1
This literal is the function name that is equated to a library code file using the SL (System
Library) system command. See the SDF Operations and Programming Guide for
instructions on equating these names.
Example
The following example uses the DICTIONARY statement to identify the SCREENDESIGN
function name:
The SAME RECORD AREA clause, when used in the DATA DIVISION, applies only to SDF
forms. The clause invokes all form descriptions in the formlibrary as redefinitions of the
first form in the formlibrary. Only one record area is allocated for the formlibrary. If the
SAME RECORD AREA clause is not used, each form in the formlibrary is invoked as a
separate form description with its own record area.
The SAME RECORD AREA clause is used with general files in the ENVIRONMENT
DIVISION; refer to Volume 1 for more information on its use in that division.
The REDEFINES clause enables the same storage area to be described by different data
descriptions. In the data-description entry for SDF, the REDEFINES clause facilitates
redefinition of a formlibrary that has previously been invoked with the SAME RECORD
AREA clause. The REDEFINES clause enables multiple formlibraries to have the same
record area. In addition, multiple redefinitions of the same formlibrary are allowed.
Only information specific to the REDEFINES clause used in the data-description entry for
SDF is covered in this section. For the general syntax and rules of the REDEFINES clause,
refer to Volume 1.
General Format
The general format of the data-description entry is as follows:
level-number-1 formlibrary-name-1
FROM DICTIONARY
ïïïï ïïïïïïïïïï
[; VERSION IS literal-1 ] [; DIRECTORY IS literal-2 ]
ïïïïïïï ïïïïïïïïï
[; SAME RECORD AREA ]
ïïïï
[; REDEFINES formlibrary-name-2]. [ ; ]
ïïïïïïïïï ï
level-number-1
formlibrary-name-1
The clauses can be written in any order. However, formlibrary-name-1 must immediately
follow level-number-1 and FROM DICTIONARY must immediately follow form-
library-name-1.
FROM DICTIONARY
VERSION IS literal-1
This format element is used only with ADDS and specifies a numeric literal that identifies
a version of the file. Literal-1 comprises from 1 to 6 digits.
DIRECTORY IS literal-2
This format element is used only with ADDS and specifies a nonnumeric literal that
identifies the directory under which the file is stored in the data dictionary.
The SAME RECORD AREA and REDEFINES options can be used only with formlibrary
invocations in the WORKING-STORAGE, LINKAGE, and LOCAL-STORAGE sections. All
other uses of the clauses cause a syntax error.
The formlibrary invocation using the REDEFINES option must immediately follow either
the formlibrary-name-1 invocation that it is redefining, or another formlibrary invocation
that is using a REDEFINES option of formlibrary-name-1. The REDEFINES option can be
used to redefine only formlibraries that previously have been invoked using the SAME
RECORD AREA option.
formlibrary-name-2
; (semicolon)
This option, the semicolon following the ending period, controls the behavior of compiler
control records (CCRs) and format listings. The semicolon must be separated from the
ending period of the data invocation by at least one space.
If a CCR immediately follows a data item invoked from the dictionary, the compiler
control option changes might occur before the compiler processes the information
invoked from the dictionary. You can avoid this situation by using the optional semicolon
after the ending period. The semicolon ensures that the compiler processes the invoked
information before the compiler control option changes.
Example
The following example shows code for a data-description entry:
Reading Forms
The READ FORM statement is used to read a form from a station to a program. The
options enable you to read forms with message keys and to use default forms.
When the logical records of a file are described with more than one record description,
these records automatically share the same storage area. This sharing is equivalent to an
implicit redefinition of the area. The contents of any data items that are beyond the range
of the current data record depend on previous events.
The appropriate formlibrary reads data from the station for the form, validates the input
for the record, performs input error handling if necessary, and passes the valid record or
detected error condition to the program.
One of the error conditions that can be passed to the program is a COMS error message.
For information on how to process COMS errors, refer to the COMS Programming Guide.
General Format
The general format of the READ FORM statement is as follows:
ä å
³formlibrary-name-1 ³
READ FORM file-name-1 USING ã â
ïïïï ïïïï ïïïïï ³form-name-1 [ FROM DEFAULT FORM ]³
æ ïïïï ïïïïïïï ç
[ INTO identifier-1 ]
ïïïï
[;ON ERROR imperative-statement-1 ]
ïï ïïïïï
file-name-1
This format element identifies the file that must be open in the input or I/O mode when
this statement is executed. When the READ FORM statement is executed, the value of the
file status data item associated with file-name-1 is updated. The file status data item must
be defined in the DATA DIVISION as a 2-character, alphanumeric data item. For further
information on status reporting, see Volume 1.
If the read operation is successful, the data is made available in the record storage area
associated with file-name-1. For general information on opening files, see Volume 1.
The storage area associated with identifier-1 and the record area associated with
file-name-1 must not be the same area.
When form-name-1 is not invoked in the file description for file-name-1, the data is read
into the file-name-1 record area and transferred to form-name-1. To avoid truncation of
trailing characters in the message, make sure the record description for file-name-1 is as
large as the declaration of the largest form to be used with the file.
formlibrary-name-1
This format element is used in the USING clause to read self-identifying forms.
Self-identifying forms are forms that contain a Message Key field in the same location in
all forms in the formlibrary. The Message Key field is used to determine programmatically
which form record format has been read.
The READ FORM statement used with self-identifying forms requires the formlibrary
name rather than the form name, because the form is identified by its message key.
If you specify the message key option for the formlibrary, you must define message keys
for each form in the formlibrary. However, you can read a form using the READ FORM
statement for either a specific or a self-identifying form.
Refer to the appropriate sample program later in this section for an illustration of using
message keys. For an explanation of message keys and ways to specify them in SDF, refer
to the SDF Operations and Programming Guide.
form-name-1
This format element is used in the USING clause to read specific forms that are identified
by form-name-1.
This option can be used only with a form name. When the FROM DEFAULT FORM option
is specified, the formlibrary writes a form with default values in each field before
performing the read and record validation.
INTO identifier-1
If the INTO option is specified, the record being read is moved from the record area to the
area specified by the identifier, according to the rules specified for the MOVE statement.
The sending area is considered to be a group item equal in size to the maximum record
size for this file.
The INTO option can be used only if form-name-1 or formlibrary-name-1 is invoked in the
file description associated with file-name-1.
The implied move operation does not occur if the READ FORM statement cannot be
executed. Any subscripting or indexing associated with the identifier is evaluated after the
record is read and immediately before the record is moved to the data item.
When the INTO option is used, the record being read is available in both the input record
area and the data area associated with the identifier. For more information on the MOVE
statement, refer to Volume 1.
For general information on error-handling with remote files, see the SDF Operations and
Programming Guide.
ON ERROR imperative-statement-1
Execution of the ON ERROR option is the same as for an Invalid Key condition. When the
ON ERROR condition is recognized, imperative-statement-1 is performed. For information
on the Invalid Key condition, see Volume 1.
• A read is executed on a specific form and that form no longer resides in the
formlibrary.
• The compile-time form version does not equal the run-time form version.
Examples
The following examples illustrate the use of the READ FORM statement.
Example of a Read Operation for a Self-Identifying Form When Message Keys Are Used
.
.
WORKING-STORAGE SECTION.
01 TEMPSAMPLEFORM PIC X(2000).
.
.
PROCEDURE DIVISION.
.
READ FORM REMFILE USING SAMPLEFORM1
INTO TEMPSAMPLEFORM
ON ERROR STOP RUN.
Writing Forms
The WRITE FORM statement is used to write forms from a program to a station. The
DEFAULT FORM option enables you to write a form with default values in each field.
The execution of the WRITE FORM statement releases a logical record to a file. The file
must be open in the output, I/O, or extend mode when the statement is executed. For
general information on opening files, see Volume 1.
Execution of a WRITE FORM statement does not affect the contents or accessibility of the
record area. If a file is named in a SAME RECORD AREA clause, the logical record is also
available as a record of other files referenced in that SAME RECORD AREA clause.
The current record pointer also is unaffected by the execution of a WRITE FORM
statement.
General Format
The general format of the WRITE FORM statement is as follows:
ä å Ú ä å ¿
³record-name USING form-name-2³ ³ ³identifier-1³ ³
WRITE FORM ã ïïïïï â ³FROM ã â ³
ïïïï ïïïï ³form-name-1 ³ ³ïïïï ³DEFAULT FORM³ ³
æ ç À æïïïïïïï ç Ù
[;ON ERROR imperative-statement-1 ].
ïï ïïïïï
record-name
This format element is the name of a logical record in the FILE SECTION of the DATA
DIVISION and can be qualified. Record-name and identifier-1 must not reference the same
storage area.
These form names must be uniquely named forms in the formlibrary identified in the file
description (FD) for this file. A formlibrary is a run-time library containing one or more
form-processing procedures.
USING
This clause enables you to write the forms of a formlibrary previously invoked in the
WORKING-STORAGE SECTION. The normal record area (record-name) of the file is
ignored and the record area for form-name-2 is written.
FROM identifier-1
A WRITE FORM statement with the FROM option is equivalent to the statement MOVE
identifier-1 TO record-name (according to MOVE statement rules) followed by the
WRITE FORM statement without the FROM phrase. For more information on the MOVE
statement, refer to Volume 1.
The DEFAULT FORM option causes the formlibrary to write a form with default values in
each field.
ON ERROR imperative-statement-1
Execution of the ON ERROR option is the same as for an Invalid Key condition. When the
ON ERROR condition is recognized, imperative-statement-1 is performed. For information
on the Invalid Key condition, see Volume 1.
The appropriate formlibrary performs the write. Any detected error condition is returned
to the program. For general information on error-handling when using remote files, refer
to the SDF Operations and Programming Guide.
A form error message (82) is returned when either of the following occurs:
• A write operation is executed on a specific form and that form no longer resides in the
formlibrary.
• The compile-time form version does not equal the run-time form version.
Example
This example shows the WRITE FORM statement used with the ON ERROR option.
When using SDF with COMS, you must perform these steps before the program can
execute a SEND statement.
• Use the FORM-KEY function to move the form key into the first word of the
conversation area of output.
• Declare the location to which the value produced by this function is moved USAGE
REAL. Other USAGEs will almost certainly cause data corruption. The value
produced by the FORM-KEY function is a collection of 48 binary bits, in which both
position and value are significant, and those characteristics are preserved only with
USAGE REAL.
General Format
The general format of the FORM-KEY function is as follows:
FORM-KEY (form-name-1)
ïïïï ïïï
form-name-1
This format element is an internal 48-bit binary number uniquely identifying the form
name.
See Also
• Refer to “SDF Sample Programs” later in this section for examples of using the
FORM-KEY function in an application program.
• Information about using SDF extensions with COMS is provided later in this section in
“Using SDF with COMS.”
• Refer to Section 3, “Using the COMS Program Interface,” for information about the
extensions developed for COMS.
Examples
The following is an example of the function syntax within the MOVE statement. The item
SAVEKEY must be declared USAGE REAL. For more information on numeric functions or
the MOVE statement, refer to Volume 1.
The following example shows the FORM-KEY function used with the COMS interface to
move the form key SDFFORM to the first word of the conversation area. If the item
COMS-OUT-CONVERSATION is an elementary item, it must be declared USAGE REAL.
The symbolic name for SDF default programmatic flags takes the form
<entity name><-suffix>. If you do not use the default suffix names that SDF provides, the
suffixes you specify must be unique for each flag type. The symbolic name, including its
suffix, can contain a maximum of 30 characters.
Example
In the following example of manipulating data using a programmatic control, assume that
a field is defined as EMPLOYEE. Assume also that you define the Cursor programmatic
control for the EMPLOYEE field and use the default Cursor flag suffix (-CURSOR). These
definitions generate a data area in your program, as follows:
02 EMPLOYEE-CURSOR
In the program, you can assign a value for the flag setting, as shown in the following
example:
01 CONSTANTS.
02 TRUE-FLAG PIC 9 COMP VALUE 1.
02 FALSE-FLAG PIC 9 COMP VALUE 0.
In the program, you can use the following syntax to cause the cursor to be placed in the
EMPLOYEE field. SDFFORM is the name of the form to be written.
See Also
• For a detailed discussion of programmatic controls, refer to the SDF Operations and
Programming Guide.
• Refer to the sample programs in “SDF Sample Programs” at the end of this section for
another example of using programmatic controls in an application.
SDF does not reset any form control flags. If you set a form control flag in a program, you
must also reset that flag when you no longer desire the control function served by the flag.
The following tables summarize the programming information presented in the SDF
Operations and Programming Guide and provide the COBOL74 picture representations
generated by the flags.
Table 6–1 contains the programmatic control default suffixes and contains flag setting
information for each programmatic control.
The syntax for the default name of individual groups for each type of flag is
• In a group for all flags in a record or in a group for each type of flag, you use the
hexadecimal value @00@.
• In individual flag fields, you can use the figurative constant LOW-VALUES.
You cannot use the constant LOW-VALUES for flag groups because the destination is
alphanumeric, causing spaces rather than zeros to be placed in the group. Spaces in the
group cause unexpected results.
See Also
• For information on specifying and using flag groups, refer to the SDF Operations and
Programming Guide.
• For information on the use of the LOW-VALUES figurative constant, refer to Volume 1.
Example
The following example shows the use of flag groups in an application. The statement to
reset all flags to the value 0 at the group level is
The statement to reset all the highlight flags to the value 0 at the flag group level is
In the example,FORM-1 has two fields, FIELD-1 and FIELD-2. If each field had all the
possible programmatic flags set, and the form had all possible programmatic flags set, the
01 record in COBOL74 would appear as shown in the example.
01 FORM-1.
02 FIELD-1 PIC X(10).
02 FIELD-2 PIC 9(6) V9(2).
02 FORM-1-FLAGS.
03 FORM-1-PAGE-FLAGS.
04 FORM-1-PAGE. PIC 9 COMP.
03 FORM-1-SPECIFY-FLAGS.
04 FORM-1-SPECIFY PIC 9(4) COMP.
04 FIELD-1-SPECIFY PIC 9(4) COMP.
04 FIELD-2-SPECIFY PIC 9(4) COMP.
03 FORM-1-IOTYPE-FLAGS.
04 FIELD-1-IOTYPE PIC 9 COMP.
04 FIELD-2-IOTYPE PIC 9 COMP.
03 FORM-1-CURSOR-FLAGS.
04 FIELD-1-CURSOR PIC 9 COMP.
04 FIELD-2-CURSOR PIC 9 COMP.
03 FORM-1-SUPPRESS-FLAGS.
04 FIELD-1-SUPPRESS PIC 9 COMP.
04 FIELD-2-SUPPRESS PIC 9 COMP.
03 FORM-1-HIGHLIGHT-FLAGS.
04 FIELD-1-HIGHLIGHT PIC 9 COMP.
04 FIELD-2-HIGHLIGHT PIC 9 COMP.
03 FORM-1-DATA-FLAGS.
04 FORM-1-DATA PIC 9 COMP.
04 FIELD-1-DATA PIC 9 COMP.
04 FIELD-2-DATA PIC 9 COMP.
03 FORM-1-NOINPUT-FLAGS.
04 FIELD-1-NOINPUT PIC 9 COMP.
04 FIELD-2-NOINPUT PIC 9 COMP.
The following guidelines explain the extensions you can include in your application when
using SDF and COMS together:
• You can use the REDEFINES and SAME RECORD AREA options when the
formlibrary is invoked in the WORKING-STORAGE SECTION for use with the COMS
direct-window interface.
The SAME RECORD AREA clause makes efficient use of record space, but an
additional WORKING-STORAGE SECTION might be needed to save SDF information
from the last SEND or RECEIVE statement for each form.
The following example illustrates the use of the SAME RECORD AREA clause in a
COBOL74 program using both SDF and COMS, where SAMPLELIB is the SDF
formlibrary name:
The SDF-MESSAGE-KEY size should be the same size as the SDF input message key.
The total COMS-MESSAGE-AREA size must be large enough to hold any expected
COMS input message.
• It is recommended that you program the main processing loop so that the RECEIVE
statement uses a working storage area for the input message. Messages or errors
might arrive at the program from sources other than your formlibrary. Once the
program determines that a valid input has been received from a form in your
formlibrary, you can process the data received.
In the following example, COMS-IN is the COMS header name:
006300 RECEIVE COMS-IN MESSAGE INTO COMS-MESSAGE-AREA.
006310* CHECK FOR COMS ERRORS
Once the COMS error checking has been processed, you can determine which form
was used for input and move the data in COMS-MESSAGE-AREA to the SDF form
record for further processing. For further information about COMS error checking,
refer to the COMS Programming Guide.
In the following example, SDF-MESSAGE-KEY is checked for the form message key
and then the SDF form SAMPLEFORM1 or SAMPLEFORM2 is processed.
Note: A hyphen (-) is not allowed as a character in a COMS trancode. The
corresponding COMS trancode with a length of 3 would be "ADD" for
"ADD-ITEM" and "MOD" for "MODIFY-ITEM".
Furthermore, only uppercase letters and numbers are allowed for COMS
trancodes, while SDF allows almost any combination of uppercase,
lowercase, and special characters, and blanks for a message key, providing
that the first 17 characters of the Message Key field are unique.
• It is recommended that you process all fields containing the Specify programmatic
control before you check for No input programmatic control data and process other
form input data.
• You must use the FORM-KEY function to move the form key into the first word of the
conversation area of output. In the following example, COMS-OUT is the COMS
header name and SAMPLEFORM2 is the form name. The FORM-KEY syntax must
precede a SEND statement from the form. The following is an example of the code:
006360 MOVE 1 TO COMS-OUT-COUNT.
006400 MOVE COMS-IN-STATION TO COMS-OUT-DESTINATION.
006700 MOVE 60 TO COMS-OUT-TEXT-LENGTH.
006720 MOVE SDF-AGENDA-DESIGNATOR TO COMS-OUT-AGENDA.
006740 MOVE FORM-KEY(SAMPLEFORM2) TO COMS-OUT-CONVERSATION.
006800 SEND COMS-OUT FROM SAMPLEFORM2.
006810* CHECK FOR COMS-OUT SEND ERRORS
007100 END-OF-JOB.
• You must do the following to transmit a default form (that is, a form with only default
values):
− Move spaces to display items.
− Move zeros to numeric items and programmatic control.
• You cannot use a SEND or RECEIVE statement between BEGIN-TRANSACTION and
END-TRANSACTION statements. Doing so violates the rules of synchronized
recovery. COMS will not allow you to send a request to a station for data correction
while your program is in transaction mode.
See Also
• Refer to the COMS Programming Guide for detailed information on the use of the
COMS direct-window interface and for an illustration of the use of SDF and COMS in
an application.
• For information about the extensions used with COMS, refer to the Section 3, “Using
the COMS Program Interface.”
• See “Using the FORM-KEY Function” earlier in this section for more information
about that function.
015200*****************************************************************
015300* Invoke the formlibrary in the FILE SECTION, and associate *
015400* it with the file. This action also causes the proper maximum *
015500* record size (MAXRECSIZE) to be designated for the file. *
015600*****************************************************************
015700
016000 DATA DIVISION.
017000 FILE SECTION.
018000 FD REMFILE.
021200 01 SAMPLELIB FROM DICTIONARY.
021400
021450*****************************************************************
021460* Include program record descriptions for all forms in the *
021470* formlibrary that are automatically invoked and copied into the*
021480* program during compilation (see the following dictionary data *
021490* lines identified with the D flag). *
021600*****************************************************************
023000
000100*-DICTIONARY D
000110*-DICTIONARY FORMLIST <SAMPLELIB>. D
000130 01 SAMPLEFORM1. D
000140 02 ACTION PIC X(10). D
000150 02 ACCOUNT-NO PIC 9(9). D
000160 02 NAME PIC X(15). D
000170 02 STREET PIC X(25). D
000180 02 CITY PIC X(15). D
000190 02 STATE PIC X(2). D
000200 02 ZIP PIC 9(9). D
024000 PROCEDURE DIVISION.
024500 MAIN-PARA.
025000
025200****************************************************
025400* Open remote file I/O *
025600****************************************************
026000 OPEN I-O REMFILE.
026100
026200***********************************************************
026300* WRITE FORM statements are not necessary when you are *
026350* sending a form with only default values to the *
026400* screen. The statement writes form SAMPLEFORM1 *
026500* with its default values in the fields, and then reads *
026550* the form. *
026600***********************************************************
032000 READ FORM REMFILE USING SAMPLEFORM1 FROM DEFAULT FORM.
038000STOP RUN.
Example 6–2. SDF Sample Program with READ and WRITE Statements
Sections of the program are explained in comment lines within the code.
As you read this example, you should be aware of the following programming information
about flags. (The example does not contain lines of code demonstrating this information.)
• If your forms use either Specify or No input flags, your program should check to see if
these flags are set after a READ operation before you begin processing data from the
form fields.
• If you use both Specify and No input flags, check the Specify flag first.
• If the value in any Specify flag field is greater than zero, the values in the data fields of
the form are unchanged from the previous operation.
Example 6–4 shows the use of message keys and of the independent record area in a
COBOL74 program using SDF. SAMPLELIB is the SDF formlibrary name, and
SAMPLEFORM1 and SAMPLEFORM2 are the form names. The Action field is defined as
the Message Key field.
Sections of the program are explained in comment lines within the code.
002260
000100*--DICTIONARY D
000110*--DICTIONARY FORMLIST <SAMPLELIB>. D
000130 01 SAMPLEFORM1. D
000140 02 ACTION PIC X(11). D
000150 02 ACCOUNT-NO PIC 9(9). D
000160 02 NAME PIC X(15). D
000170 02 STREET PIC X(25). D
000180 02 CITY PIC X(15). D
000190 02 STATE PIC X(2). D
000200 02 ZIP PIC 9(9). D
000210 01 SAMPLEFORM2. D
000220 02 ACTION PIC X(11). D
000230 02 ACCOUNT-BALANCE PIC 9(9). D
000240 02 PAYMENT-DUE-DATE PIC X(6). D
000250 02 DATE-LAST-PAYMENT PIC X(6). D
000260 02 FINANCE-CHARGE PIC 9(5). D
002262
002264******************************************************************
002266* The SDF-MESSAGE-KEY size should be the same size as the SDF *
002268* input message key. The total SDF-MESSAGE-AREA size must be *
002270* large enough to hold any SDF input message. *
002272******************************************************************
002274
002280 WORKING-STORAGE SECTION.
002282 01 SDF-MESSAGE-AREA.
002284 02 SDF-MESSAGE-KEY PIC X(011).
002286 02 SDF-MESSAGE PIC X(2500).
002288
002300******************************************************************
002306* You program the main processing loop so that the RECEIVE *
002310* statement uses a working storage area, SDF-MESSAGE-AREA, for *
002314* the input message. Messages or errors might arrive for the *
002316* program from your formlibrary. *
002320******************************************************************
002322
002300 PROCEDURE DIVISION.
002400 MAIN-PARA.
002500
002600*************************************
002700* Open remote file I/O. *
002800*************************************
002900 OPEN I-O REMFILE.
003000
003110***************************************************************
003120* Move values to the fields of the form so that a write can be*
003120* done to display the form with those values. *
003130***************************************************************
003200
003300 MOVE SPACES TO NAME.
003400 MOVE SPACES TO STREET.
003500 MOVE SPACES TO CITY.
• Extensions that enable you to read and write form records or form record libraries
easily
• Extensions that enable you to send and receive form records or form record libraries
easily
• Extensions that enable you to invoke form record library descriptions into your
program as COBOL74 declarations
This section provides information about the extensions developed for SDF Plus. Each
extension is presented with its syntax and examples; sample programs are also included.
For an alphabetized list of the extensions, see “SDF Plus Extensions” in Section 1,
“Introduction to COBOL74 Program Interfaces.” Refer to the Screen Design Facility Plus
(SDF Plus)Capabilities Manual for information defining the concepts and principles of
SDF Plus. For information on general implementation and operation considerations, and
for information on describing the process of migrating SDF form libraries to SDF Plus,
refer to the Screen Design Facility Plus (SDF Plus) Installation and Operations Guide.
Consult the Screen Design Facility Plus (SDF Plus) Technical Overview for information
on general programming concepts and considerations.
You can use SDF Plus with the Advanced Data Dictionary System (ADDS), the Semantic
Information Manager (SIM), and the Communications Management System (COMS). Refer
to the product documentation for information on the concepts and programming
considerations for using these products with SDF Plus. More information on the
extensions used with these products is provided in Section 2, “Using the ADDS Program
Interface;” Section 3, “Using the COMS Program Interface;” and Section 8, “Using the SIM
Program Interface,” in this volume.
interface, you can interact with SDF Plus applications by means of remote files. If you use
the COMS interface, you can interact with SDF Plus applications through COMS windows,
and have access to all COMS capabilities and features.
Form Records
Form records are elements of form record libraries. Form records represent records of
data. This data is used either to output data from a form or to input data to a form. A form
can require several form records; therefore, a one-to-one relationship between forms and
form records does not exist.
In some manuals, the term message type is a synonym for form record.
Forms and form processing are established through the use of SDF Plus. The COBOL74
program reads and writes data to the forms. This arrangement provides complete
separation between data entered on a terminal and actions completed within the program.
A user interface can be completely reconstructed through the use of SDF Plus without
modifying the application program, providing the form records are not changed.
In some manuals, the term message type number is a synonym for form record number.
A form record number for a form record library is an attribute of the form record library.
Form record numbers determine I/O operations for form record libraries, allowing the
form record to be specified at run time.
A self-identifying read is used when the executing program has not established which form
record in a specific form record library is being read. The program must access the form
record number attribute for the form record library to determine the form record that has
been read.
A self-identifying write enables the executing program to specifically identify the form
record to be written by placing the appropriate form record number value into the form
record number attribute of the form record library.
Transaction Types
Transaction types are elements of form record libraries. A transaction type contains a pair
of form records: an input form record and an output form record. A transaction type
identifies the relationship of the two form records that are under it, namely, the input form
record to the transaction type and the output form record from the transaction type.
Transaction Numbers
Transaction numbers are similar to form record numbers. A transaction number is a
unique integer assigned at compile time to each transaction in a form record library.
A transaction number for a form record library is an attribute of the form record library.
This attribute contains the transaction number of a specific transaction type. Transaction
numbers provide another means to determine I/O operations for form record libraries at
run time.
After a self-identifying read, the application program must access the transaction number
attribute of the form record library being read in order to determine the transaction type
that has been executed.
Example
The following example shows the invocation of form record library MSGKEYS. The syntax
is constructed by the compiler. The form record library contains two transaction types and
two forms. Each form has the same response message (MSGKEYSSR).
Note: A program can invoke only one dictionary. Therefore, if a program accesses
both a SIM database (from a dictionary) and SDF forms, both must be in the
same dictionary.
General Format
The general format for the DICTIONARY clause is as follows:
[, DICTIONARY IS literal-1]
ïïïïïïïïïï
DICTIONARY
This clause enables you to identify the function name of the dictionary library.
literal-1
This format element is the function name that is equated to a library source code using the
SL (support library) system command. See the SDF Plus Installation and Operations
Guide for instructions on equating these names.
Example
The following example shows code that identifies the SDFPLUSDICT dictionary:
In the DATA DIVISION, either the SAME RECORD AREA option or the SEPARATE
RECORD AREA option can be used, but not both; all other options can be present.
The clauses and options can be written in any order. However, form-record-library-name-1
must immediately follow the level number, and the REDEFINES option, when used, must
immediately follow form-record-library-name-1.
General Format
The general format of the data-description entry is as follows:
level-number form-record-library-name-1
FROM DICTIONARY
ïïïï ïïïïïïïïïï
Úä å ¿
³³; SAME RECORD AREA ³ ³
³ã ïïïï â ³
³³; SEPARATE RECORD AREA ³ ³
³æ ïïïïïïïï ç ³
³; VERSION IS literal-1 ³ . [ ; ]
³ ïïïïïïï ³ ï
³; DIRECTORY IS literal-2 ³
³ ïïïïïïïïï ³
³; REDEFINES form-record-library-name-2 ³
³ ïïïïïïïïï ³
³; GLOBAL ³
À ïïïïïï Ù
level-number
form-record-library-name-1
FROM DICTIONARY
The FROM DICTIONARY clause is used in the DATA DIVISION to obtain a form record
library from the dictionary. If the LIST compiler control option is also set, the form data
descriptions are listed in the DATA DIVISION of the COBOL74 program.
This option applies to SDF Plus form records only when the option is used in the DATA
DIVISION; however, this option cannot be used in the FILE SECTION of the DATA
DIVISION. This option invokes all form record descriptions in the form record library as
redefinitions of the first form record description in the form record library.
This option applies to SDF Plus form records only when the option is used in the DATA
DIVISION; however, this option cannot be used in the FILE SECTION of the DATA
DIVISION. The SEPARATE RECORD AREA option is used to invoke each form record in
the form record library as a separate data description with its own record area.
VERSION
This option imports the version of the form record library being used.
literal-1
This format element must be a numeric literal, consisting of up to six digits, that identifies
a version of the form record library.
DIRECTORY
This option specifies the directory under which the form record library is stored in the
data dictionary. This option enables you to access form record libraries stored under
different usercodes.
literal-2
This format element must describe the directory under which the form record library is
stored in the data dictionary.
REDEFINES form-record-library-name-2
The REDEFINES option applies to SDF Plus form records only when the option is used in
the DATA DIVISION; however, this option cannot be used in the file description (FD)
entry of the DATA DIVISION. The REDEFINES option enables different data descriptions
to describe the same memory. This option allows multiple form record libraries to have
the same record area. Multiple redefinitions of the same form record library are also
allowed.
The REDEFINES option can be used to redefine only form record libraries that previously
have been invoked using the SAME RECORD AREA option.
The form record library invocation using the REDEFINES option must immediately follow
either the form-record-library-name-2 invocation that it is redefining, or another form
record library invocation that is using a REDEFINES option for
form-record-library-name-2.
GLOBAL
This option is required in subprograms to reference form record libraries that were
declared in the host program. You cannot declare a local form record library in a
subprogram unless there is a matching form record library in the host program.
; (semicolon)
This option controls the behavior of compiler control records (CCRs) and format listings.
The semicolon must be separated from the ending period of the data invocation by at least
one space.
If a CCR immediately follows a data item invoked from the dictionary, the compiler
control option changes might occur before the compiler processes the information
invoked from the dictionary. You can avoid this situation by using the optional semicolon
after the ending period. The semicolon ensures that the compiler processes the invoked
information before the compiler control option changes.
Form record libraries can be invoked within the FILE SECTION, the WORKING-STORAGE
SECTION, the LINKAGE SECTION, or the LOCAL-STORAGE SECTION.
The SAME RECORD AREA, SEPARATE RECORD AREA, and REDEFINES options can be
used only with form record library invocations in the WORKING-STORAGE SECTION, the
LINKAGE SECTION, and the LOCAL-STORAGE SECTION. All other uses of the options
cause a syntax error.
The SAME RECORD AREA and SEPARATE RECORD AREA options cannot be used in the
same form record library.
A form record library cannot be given an alias using the INVOKE clause.
See Also
See “Identifying Specific Entities” and “Assigning Alias Identifiers” in Section 2, “Using the
ADDS Program Interface,” for additional information on these two topics.
Examples
The following examples illustrate the use of the FROM DICTIONARY clause.
• In this example, the form record library SAMPLELIB is imported from the dictionary:
DATA DIVISION.
FILE SECTION.
FD REMFILE.
01 SAMPLELIB FROM DICTIONARY.
• In this example, version 2 of form record library SAMPLELIB is imported from the
data dictionary. The directory is SMITH.
DATA DIVISION.
FILE SECTION.
FD REMFILE.
01 SAMPLELIB FROM DICTIONARY
VERSION IS 2
DIRECTORY IS "SMITH".
DATA DIVISION.
FILE SECTION.
FD REMFILE.
WORKING-STORAGE SECTION.
01 SAMPLELIB FROM DICTIONARY.
01 SAMPLELIB3 FROM DICTIONARY;
REDEFINES SAMPLELIB.
• In this example, the form record library SAMPLELIB is redefined as SAMPLELIB4 and
SAMPLELIB5:
DATA DIVISION.
FILE SECTION.
FD REMFILE.
01 REM-REC PIC X(2400).
WORKING-STORAGE SECTION.
01 SAMPLELIB FROM DICTIONARY; SAME RECORD AREA.
01 SAMPLELIB4 FROM DICTIONARY;
REDEFINES SAMPLELIB.
01 SAMPLELIB5 FROM DICTIONARY;
REDEFINES SAMPLELIB.
General Format
The general format of the SELECT statement is as follows:
This clause is used to import global form record libraries to subprograms. The global form
record libraries and the remote file (file-name-1) are declared in host programs.
Examples
The remote file REMFILE is declared in the host program as follows:
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT REMFILE
ASSIGN TO REMOTE.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT GLOBAL REMFILE
ASSIGN TO REMOTE.
The appropriate form record library reads the form record, validates the record, performs
screen error handling, and returns to the program the valid form record or any detected
error condition.
When the logical records of a file are described with more than one record description,
these records automatically share the same storage area. This sharing is equivalent to an
implicit redefinition of the area. The contents of any data items that are beyond the range
of the current data record are undefined after you execute the READ FORM statement.
The implied move operation does not occur if the READ FORM statement cannot be
executed. Any subscripting or indexing associated with the identifier is evaluated after the
record is read and immediately before the record is moved to the data item.
General Format
The general format of the READ FORM statement is as follows:
ä å
³form-record-library-name-1 ³
READ FORM file-name-1 USING ã â
ïïïï ïïïï ïïïïï ³form-record-name-1 [ FROM DEFAULT FORM ]³
æ ïïïï ïïïïïïï ç
[ INTO identifier-1 ]
ïïïï
Ú ¿
³ ³
³ ä å ³
³ ³imperative-statement-1 ³ ³
³; ON ERROR ã â ³ .
³ ïï ïïïïï ³conditional-statement-1 ³ ³
³ æ ç ³
À Ù
file-name-1
The file must be open in the input or I/O mode at the time this statement is executed.
When the READ FORM statement is executed, the value of the file status data item
associated with file-name-1 is updated. If the read is successful, the data is made available
in the record storage area associated with file-name-1. For general information on opening
files, refer to Volume 1.
The storage area associated with identifier-1 and the record area associated with
file-name-1 must not be the same storage area.
USING form-record-library-name-1
USING form-record-name-1
When form-record-name-1 is invoked in the DATA DIVISION and not in the file description
for file-name-1, the data is read into the file-name-1 record area and transferred to
form-record-name-1. To avoid truncating the trailing characters in the message, you
should make sure the record description for file-name-1 is as large as the declaration of
the largest form to be used with the file.
This option can be used only with a form record name. When the FROM DEFAULT FORM
option is specified, the form record library writes a form record with default values in
each field before performing the read and record validation.
INTO identifier-1
When the INTO option is used, the record being read is available in both the input record
area and the data area associated with the identifier. For more information on the MOVE
statement, refer to Volume 1.
If the INTO option is specified, the record being read is moved from the record area to the
area specified by identifier-1, according to the rules specified for the MOVE statement.
The sending area is considered to be a group item equal in size to the maximum record
size for this file. The INTO option can be used only if form-record-name-1 or
form-record-library-name-1 is invoked in the file description associated with file-name-1.
ON ERROR
The ON ERROR option actions are the same as for an Invalid Key condition. For
information on the Invalid Key condition, see Volume 1. For general information on error
handling with remote files, see the SDF Plus Technical Overview.
• A read is executed on a specific form record and that form record no longer resides in
the form record library.
• The compile-time form record version does not equal the run-time form record
version.
Examples
The following examples illustrate the use of the READ FORM statement.
• The following example shows a READ FORM statement that causes a default form
record to be read:
• This example shows a READ FORM statement that causes a specific form record to be
read:
• The following example illustrates the use of the USING, INTO, and ON ERROR
clauses:
WORKING-STORAGE SECTION.
01 TEMPSAMPLEFORM PIC X(2400).
PROCEDURE DIVISION.
.
.
.
READ FORM REMFILE-A
USING FORMLIB-A
INTO TEMPSAMPLEFORM
ON ERROR STOP RUN.
The execution of the WRITE FORM self-identifying WRITE statement releases a logical
record to a remote file. The file must be open in the output, I/O, or extend mode at the
time this statement is executed. For general information on opening files, refer to
Volume 1.
Execution of a WRITE FORM statement does not affect the contents or accessibility of the
record area. If a file is named in the SAME RECORD AREA clause, the logical record is
also available as a record of other files referenced in that SAME RECORD AREA clause.
If you are not using the attribute form record number to place the form record number
into the form record number field of the form record library before the self-identifying
write operation, the self-identifying WRITE statement uses the existing value in the form
record number field of the form record library.
The appropriate form record library performs the write operation. Any detected error
condition is returned to the program when the WRITE FORM statement is performed.
See Also
• For more information on the form record number attribute, see “Using the Form
Record Number Attribute” later in this section.
• For general information on error handling when using remote files, refer to the
SDF Plus Technical Overview.
General Format (Format 1)
The general format of the WRITE FORM statement to perform a self-identifying write
operation is as follows:
ä å
³form-record-library-name-1 ³
WRITE FORM ã â
ïïïïï ïïïï ³record-name USING form-record-library-name-2³
æ ïïïïï ç
Ú ¿
³ ³
³ ä å ³
³ ³imperative-statement-1 ³ ³
³; ON ERROR ã â ³ .
³ ïï ïïïïï ³conditional-statement-1 ³ ³
³ æ ç ³
À Ù
form-record-library-name-1
This format element is used when the form record library is invoked from the file
description (FD) of the DATA DIVISION.
USING
Record-name is the name of the logical record area in a specified remote file. When a
WRITE FORM statement that contains a USING clause is executed, the data in
form-record-library-name-2 is written directly to the device without affecting the logical
record area of the file. The specification of the record area only identifies the file to which
the data in form-record-library-2 is written.
ON ERROR
When the ON ERROR condition occurs, the actions that follow are the same as for an
Invalid Key condition. Refer to Volume 1 for a discussion of an Invalid Key condition on a
WRITE statement.
• A write operation is executed on a specific form and that form no longer resides in the
form record library.
• The compile-time form record version does not equal the run-time form record
version.
Examples
The following examples illustrate the use of the WRITE FORM statement for a
self-identifying WRITE statement.
• In this example, the CHANGE statement places the form record number of
FORMREC-1 into the form record number field of the FORMRECLIB form record
library before the self-identifying WRITE FORM statement is performed.
The execution of the WRITE FORM statement releases a logical record to a remote file.
The file must be open in the output, I/O, or extend mode at the time this statement is
executed. For general information on opening files, refer to Volume 1.
Execution of a WRITE FORM statement does not affect the contents or accessibility of the
record area. If a file is named in the SAMERECORD AREA clause, the logical record is
also available as a record of other files referenced in that SAME RECORD AREA clause.
The current record pointer is unaffected by the execution of a WRITE FORM statement.
The appropriate form record library performs the write operation. Any detected error
condition is returned to the program. For general information on error-handling when
using remote files, refer to the SDF Plus Technical Overview.
ä å
³form-record-library-name-1 ³
WRITE FORM ã â
ïïïïï ïïïï ³record-name-1 USING form-record-name-2 ³
æ ïïïïï ç
Ú ä å ¿
³ ³identifier-1³ ³
³ FROM ã â ³
³ ïïïï ³DEFAULT FORM³ ³
À æïïïïïïï ç Ù
Ú ¿
³ ³
³ ä å ³
³ ³imperative-statement-1 ³ ³
³; ON ERROR ã â ³ .
³ ïï ïïïïï ³conditional-statement-1 ³ ³
³ æ ç ³
À Ù
form-record-name-1
This format element is used when the form record of a form record library is declared in
the FILE SECTION of the DATA DIVISION.
record-name-1
This format element is the name of the logical record in the FILE SECTION of the DATA
DIVISION and can be qualified. Record-name-1 and identifier-1 must not reference the
same storage area.
Record-name-1 with the USING clause enables the write operation to write the form
records of a form record library that is invoked in the WORKING-STORAGE SECTION.
USING
form-record-name-2
When the WRITE FORM statement that contains a USING clause is executed, the data in
form-record-name-2 is written directly to the device without affecting the logical record
area of the file. The specification of the record area only identifies the file to which the
data in form-record-2 is written.
FROM
A WRITE FORM statement with the FROM phrase is equivalent to the statement MOVE
identifier-1 TO form-record-name-1 (according to MOVE statement rules) followed by
the WRITE FORM statement without the FROM phrase. For more information on the
MOVE statement, refer to Volume 1.
identifier-1
This format element must be an 01-level record that is declared in the DATA DIVISION.
DEFAULT FORM
This option is an SDF Plus feature. The DEFAULT FORM option causes the form record
library to write a form record with default values in each field.
ON ERROR
When the ON ERROR condition is recognized, the actions that follow are the same as for
an Invalid Key condition. Refer to Volume 1 for a discussion of an Invalid Key condition on
a WRITE statement.
• A write is executed on a specific form and that form no longer resides in the form
record library.
• The compile-time form record version does not equal the run-time form record
version.
Examples
The following examples show the use of the WRITE FORM statement to write the
contents of a form record.
• In this example, the form record FORMREC-A is written. FORMREC-A is invoked from
the FILE SECTION.
• In this example, the WRITE FORM statement writes the form record FORMREC-B.
FORMREC-B is invoked from the WORKING-STORAGE SECTION. The record name
for the remote file is REMF-REC.
• In this example, the contents of the identifier TEMP-FORM-A are moved to form
record FORMREC-C before FORMREC-C is written.
You define transaction errors using the SDF Plus Forms Editor, which assigns a unique
transaction error number to each transaction error you define for the transaction. For
each transaction error, you define an error message and a list of fields that are highlighted
when the error occurs. The transaction error number you specify using format 3 identifies
which of the transaction errors is to be processed by SDF Plus.
You can perform more than one WRITE FORM FOR ERROR MESSAGE statement in order
to indicate multiple transaction errors.
Each WRITE FORM FOR ERROR MESSAGE statement must be followed by an additional
WRITE FORM statement, either format 1 or format 2, in order to initiate SDF Plus
transaction error processing. At that point, SDF Plus redisplays the form that resulted in
the transaction error, including the user's data, any highlights associated with the
transaction error, and the transaction error message specified for the transaction error.
The cursor is positioned in the first highlighted field.
Because the last WRITE FORM statement is used only to initiate transaction error
processing, SDF Plus ignores any data received as the result of the last WRITE FORM
statement (format 1 or format 2).
You use format 3 of the WRITE FORM statement only with update transactions; you
cannot use it with prefill transactions.
ä å
³form-record-library-name-1 ³
WRITE FORM ³form-record-name-1 ³
ïïïïï ïïïï ãrecord-name USING ä form-record-library-name-2 å â
³ ïïïïï ã â ³
æ æ form-record-name-2 ç ç
ä å
³identifier-1 ³
FOR ERROR MESSAGE ã â .
ïïï ïïïïï ïïïïïïï ³numeric-literal-1³
æ ç
For explanations of these format elements, refer to the explanations of format 1 and
format 2 of the WRITE FORM statement.
This format element indicates that a transaction error has occurred and identifies which
transaction error has occurred.
identifier-1
This format element must be a numeric data item. Identifier-1 contains the transaction
error number corresponding to the user-predefined transaction error to be processed by
SDF Plus.
numeric-literal-1
This format element must be an integer. It specifies the transaction error number
corresponding to the user-predefined transaction error to be processed by SDF Plus.
Examples
The following examples show the use of the WRITE FORM FOR ERROR MESSAGE
statement.
• In this example, the WRITE FORM statement indicates that transaction error
number 5 has occurred:
• In this example, the WRITE FORM statement indicates that the transaction error
stored in identifier A1 has occurred:
The WRITE FORM TEXT statement must be used with the standard WRITE FORM
statement. A standard WRITE FORM statement immediately after a WRITE FORM TEXT
statement causes the contents of the text array to be written at the bottom of the standard
form.
A WRITE FORM TEXT statement has no effect unless the next I/O related to SDF Plus that
is performed on the remote file is a WRITE FORM statement.
ä å
³form-record-library-name-1³
WRITE FORM ãform-record-name-1 â USING TEXT data-name-1
ïïïïï ïïïï ³record-name-1 ³ ïïïïï ïïïï
æ ç
Ú ¿
³ ä å ³
³ ³integer-1 ³ ³
³FOR ã â CHARACTERS ³.
³ïïï ³identifier-1³ ïïïïïïïïïï ³
³ æ ç ³
À Ù
If a form record library is invoked within an FD entry, the WRITE FORM TEXT statement
is performed by using either form-record-name-1 or form-record-library-name-1, followed
by the USING TEXT clause.
record-name-1
This format element is the logical record area for a remote file that is used in the SDF Plus
remote file interface. If a form record library is invoked in the WORKING-STORAGE
SECTION, record-name-1 followed by the USING TEXT clause writes the text.
USING TEXT
This clause writes text to the end of the previous write form.
data-name-1
This format element specifies the name of the text array. Data-name-1 must be at the
01-level. Data-name-1 is moved to record-name-1 before the write occurs.
This format element identifies the number of characters of the text array to be written.
This format element identifies the numeric identifier used to specify the number of
characters that are to be written.
Examples
The following examples illustrate the use of the WRITE FORM TEXT statement.
• In this example, the first 100 characters of the text array TEXT-A are written. The
form record library is invoked from the WORKING-STORAGE SECTION; therefore,
the FILE-FD-REC logical record area for the remote file writes the text. Format 1 or
Format 2 of the WRITE FORM statement must follow this code to provide a
meaningful context for the example.
• In this example, FORMRECLIB-2 is invoked under the FD section. The TEXT-B text
array is written to the bottom of the FORMREC-1 form record for FORMRECLIB-2.
• In this example, the form record library FORMRECLIB-3 is invoked under the FD
section. Text TEXT-C is written to the bottom of FORMRECLIB-3. A self-identifying
WRITE FORM statement follows the WRITE FORM TEXT statement.
The form record number attribute associated with individual form records is preassigned
by SDF Plus at compile time.
The form record number attribute associated with form record libraries is used to perform
self-identifying read operations and self-identifying write operations at run time.
General Format
The general format of the form record number attribute is as follows:
ä å
³ OF form-record-library-name-1³
ATTRIBUTE FORMRECNUM ã ïï â
ïïïïïïïïï ïïïïïïïïïï ³ OF form-record-name-1 ³
æ ïï ç
form-record-library-name-1
When the form record number attribute is used with form record libraries, the attribute
accesses the form record number of a particular form record that is returned on a
self-identifying read operation. This is necessary when you do not know the form record
that has been read, as is the case with self-identifying read operations.
Before a self-identifying write operation can be completed, you must move the form
record number attribute of the form record to the form record number attribute of the
form record library.
The value of the form record number attribute might change for each self-identifying I/O
operation (read or write). The returned value is valid immediately after a self-identifying
I/O operation is performed and continues to be valid until the next self-identifying I/O
operation is performed.
form-record-name-1
When the form record number attribute is used with individual form records, the attribute
enables the compiler to return the form record number integer of the form record name
for programmatic purposes.
Examples
The following examples illustrate the use of the form record number attribute.
• In the following example, NUM-1 is assigned the unique value of the form record
number of form record FORMREC-A:
• In this example, the form record number of FORMLIB-A is assigned the form record
number of FORMREC-A:
• The following example illustrates the use of a check to determine whether the form
record number of form record library FORM-LIB is equal to the form record number of
FORMREC-B after a self-identifying read operation:
General Format
The general format of the transaction number attribute is as follows:
ä å
³ OF form-record-library-name-1³
ATTRIBUTE TRANSNUM ã ïï â
ïïïïïïïïï ïïïïïïïï ³ OF form-record-name-1 ³
æ ïï ç
form-record-library-name-1
This format element identifies the name of the form record library. When used with form
record libraries, the transaction number attribute accesses the transaction number of a
particular form record that is returned on a self-identifying read operation. You can
retrieve the returned value from the transaction number attribute that indicates the
transaction that was performed on a self-identifying read operation.
The value of a transaction number attribute might change for each self-identifying read
operation. The returned transaction number attribute value is valid immediately after the
self-identifying read operation is performed and continues to be valid until the next
self-identifying read operation is executed.
form-record-name-1
This format element identifies the form record name. When used with individual form
records, the transaction number attribute returns the preassigned transaction number of a
designated transaction.
Examples
The following examples illustrate the use of the transaction number attribute.
• In this example, NUM-1 is assigned the transaction number that was last read using
the self-identifying syntax:
Refer to the COMS Programming Guide for detailed information on the use of the COMS
direct-window interface. The following guidelines explain the steps to follow when using
SDF Plus with COMS.
The SDFINFO field is used to identify specific form message processing requests (on
output) or to return form message processing errors (on input).
On the output (sending) path, the SDFINFO field can contain the following values:
Value Explanation
On the input (receiving) path, the SDFINFO field can contain the following values, which
indicate the status of the requested form message processing:
Value Explanation
0 No error
The SDFFORMRECNUM field is used to specify the form record to be written (on output)
or the form record that was received (on input).
The SDFTRANSNUM field is meaningful only on input and contains the number of the
SDF Plus transaction that was received. This field should not be altered by the user
application.
• It is recommended open notification for the window. Using open notification ensures
that the correct initialization is sent to the program. The program can then be written
to display the correct initial form without user input. If the initialization test has a
transaction code (trancode), the trancode must be created under the default input
agenda.
• Message sending requires the application program to first move the value 0 (zero) into
the SDFINFO field of the output header. The application program must also move the
form record number of the form record library into the SDFFORMRECNUM field. The
buffer of the form record library must be passed as the message area in the SEND
statement.
• Message receiving has the following significance for the application program:
− If the SDFINFO field contains the value 0 (zero), then the application program can
query the form record number and transaction number attributes for the form
record library from the SDFFORMRECNUM and SDFTRANSNUM fields of the
input header.
− If the SDFINFO field contains a value less than 0 (zero), then this field contains an
error code that indicates a problem with message processing. In addition, the
FUNCTION-INDEX field of the input header contains the value 100.
• SEND or RECEIVE statements cannot be used between BEGIN-TRANSACTION and
END-TRANSACTION statements. Doing so violates the rules of synchronized
recovery. COMS will not allow you to send a request to a station for data correction
while SDF Plus is in transaction mode.
• Move the value 100 into the SDFINFO field of the output header.
• Move the value of the transaction error into the SDFFORMRECNUM field of the
output header.
• Move the SDFTRANSNUM field from the input header to the output header.
• Send the output header to display the message.
The user program can send any arbitrary message area along with the output header.
SDF Plus processes only the information within the output header.
Example
The following example shows code in which transaction error number 1 is sent.
SDF-BUFFER is the user-defined buffer area.
• Move the value 200 into the SDFINFO field of the output header.
• Move the text message into a message area to be sent through COMS.
• Use the SEND statement to store the text message.
• Move the value 0 (zero) to the SDFINFO field of the output header.
• Send the form to display the text message.
See Also
For information about the extensions used with COMS, refer to Section 3, “Using the
COMS Program Interface.”
Example
The following example shows code in which literal text is moved into the message area.
The form to display the text message is FORM1. The first MOVE statement moves the
length of the message to COMS_OUT.
The program accepts two string or binary inputs from a remote file, concatenates or adds
them together, and returns the original input and the results as output on the terminal
screen. The form record library was created in SDF Plus.
023200 01 AGETALPHASPRE. D
023250 04 GASTRING1 PIC X(25). D
023300 04 GASTRING2 PIC X(25). D
023350 04 GASTRING PIC X(50). D
023400*01 AGETALPHASPRE. D
023500*--SDF TRANSACTION (AGETALPHASTT ). D
023550 01 AGETALPHAS. D
023600 04 GASTRING1 PIC X(25). D
023650 04 GASTRING2 PIC X(25). D
023700 04 GASTRING PIC X(50). D
023750*01 DATATYPE6BSR. D
023800*--SDF TRANSACTION ( APUTBINARYTT ). D
023850 01 APUTBINARY. D
023900 04 PBNUMBER1 PIC 9(3) BINARY. D
023950 04 PBNUMBER2 PIC 9(3) BINARY. D
024000*01 DATATYPE6BSR. D
024025*--SDF TRANSACTION ( AGETBINARYPTT ). D
024050 01 AGETBINARYPRE. D
024075 04 GBNUMBER1 PIC 9(3) BINARY. D
024100 04 GBNUMBER2 PIC 9(3) BINARY. D
024125 04 GBNUMBER PIC 9(4) BINARY. D
024150*01 AGETBINARYPRE. D
024175*--SDF TRANSACTION (AGETBINARYTT ). D
024200 01 AGETBINARY. D
024225 04 GBNUMBER1 PIC 9(3) BINARY. D
024250 04 GBNUMBER2 PIC 9(3) BINARY. D
024500 04 GBNUMBER PIC 9(4) BINARY. D
024510*01 DATATYPE6BSR. D
024530*01 APUTALPHAS. D
024540*01 AGETALPHAS. D
024545*01 APUTBINARY. D
024547*01 AGETBINARY. D
024549*
024550 01 OUT-LINE PIC X(72).
024600*
024650 WORKING-STORAGE SECTION.
024660*
024670 01 REMFILE-STATUS PIC X(02).
024680 01 REMFILE-RSN PIC 9(04).
024700 01 CONSTANTS.
024750 02 TRUE-FLAG PIC 9 COMP VALUE 1.
024800 02 FALSE-FLAG PIC 9 COMP VALUE 0.
024850
024900 01 END-PGMV PIC 9 COMP VALUE 0.
024950 01 TRANSTYPE PIC 9(8) VALUE 0.
025000 01 MYSTRING.
025100 03 MYSTRING1 PIC X(25) VALUE SPACES.
025150 03 MYSTRING2 PIC X(25) VALUE SPACES.
025200 01 MYBNUMBER PIC 9(4) BINARY VALUE ZERO.
025250 01 MYBNUMBER1 PIC 9(3) BINARY VALUE ZERO.
025300 01 MYBNUMBER2 PIC 9(3) BINARY VALUE ZERO.
025350
025375*
025400 PROCEDURE DIVISION.
025450 MAIN-PARA.
025475***
025500 OPEN I-O REMFILE.
025700 PERFORM MAIN-FORM THRU MAIN-FORM-EXIT
025750 UNTIL END-PGMV = TRUE-FLAG.
025800 CLOSE REMFILE.
025850 STOP RUN.
025875***
025900 MAIN-FORM.
025950 READ FORM REMFILE USING DATATYPE6B
026000 ON ERROR DISPLAY "READ FORM ERROR"
026100 MOVE TRUE-FLAG TO END-PGMV
026150 GO TO MAIN-FORM-EXIT.
026200 IF ATTRIBUTE TRANSNUM OF DATATYPE6B =
026250 ATTRIBUTE TRANSNUM OF AGETALPHASPTT THEN
026300 CHANGE ATTRIBUTE FORMRECNUM OF DATATYPE6B TO
026350 ATTRIBUTE FORMRECNUM OF AGETALPHASPRE
026400 PERFORM GETALPHAS
026450 ELSE IF ATTRIBUTE TRANSNUM OF DATATYPE6B =
026500 ATTRIBUTE TRANSNUM OF AGETBINARYPTT THEN
026550 CHANGE ATTRIBUTE FORMRECNUM OF DATATYPE6B TO
026600 ATTRIBUTE FORMRECNUM OF AGETBINARYPRE
026650 PERFORM GETBINARY
026700 ELSE IF ATTRIBUTE TRANSNUM OF DATATYPE6B =
026750 ATTRIBUTE TRANSNUM OF APUTALPHASTT THEN
026800 CHANGE ATTRIBUTE FORMRECNUM OF DATATYPE6B TO
026850 ATTRIBUTE FORMRECNUM OF DATATYPE6BSR
026900 PERFORM CONCATSTRINGS
026950 ELSE IF ATTRIBUTE TRANSNUM OF DATATYPE6B =
027000 ATTRIBUTE TRANSNUM OF APUTBINARYTT THEN
027100 CHANGE ATTRIBUTE FORMRECNUM OF DATATYPE6B TO
027150 ATTRIBUTE FORMRECNUM OF DATATYPE6BSR
027200 PERFORM BINARYADD
027205 ELSE IF ATTRIBUTE TRANSNUM OF DATATYPE6B =
027210 ATTRIBUTE TRANSNUM OF AGETALPHASTT OR
027220 ATTRIBUTE TRANSNUM OF DATATYPE6B =
027230 ATTRIBUTE TRANSNUM OF AGETBINARYTT THEN
027240 CHANGE ATTRIBUTE FORMRECNUM OF DATATYPE6B TO
027245 ATTRIBUTE FORMRECNUM OF DATATYPE6BSR
027250 ELSE MOVE TRUE-FLAG TO END-PGMV.
027275*
027300 WRITE FORM DATATYPE6B ON ERROR
027350 DISPLAY "WRITE FORM ERROR"
027400 MOVE TRUE-FLAG TO END-PGMV.
027425 MAIN-FORM-EXIT.
027430 EXIT.
027450***
027500 CONCATSTRINGS.
027550 MOVE PASTRING1 TO MYSTRING1.
027600 MOVE PASTRING2 TO MYSTRING2.
The Semantic Information Manager (SIM) is a database system that provides for the
control, retrieval, and maintenance of data. SIM is a member of the InfoExec family of
products.
The compiler translates statements into symbolic SIM queries and generates calls to SIM
at compile time and run time to process the queries. The program interface for SIM
consists of extensions to COBOL74 that perform the following functions:
• Use the RESERVE clause to recognize SIM keywords as reserved words in a program.
• Declare a database.
• Map SIM types into COBOL74.
• Qualify attributes in single-perspective and multiple-perspective queries.
• Declare query variables and records used in a query.
• Open and close a database.
• Use statements for transaction states and transaction points.
• Declare an entity reference variable to explicitly hold a reference to a database entity.
• Use functions and selection expressions to manipulate data and determine entities or
values within database statements.
• Select a set of entities and associate it with the query.
• Retrieve entities to make them available to the program.
• Deactivate a query using the DISCARD statement.
• Alter level values in retrieval that involve transitive closure.
• Update entities with single-statement or multiple-statement update statements, assign
database attributes, and delete entities.
• Process SIM exceptions.
In an InfoExec environment, the Advanced Data Dictionary System (ADDS) is used to
define Data Management System II (DMSII) or SIM databases. For information about the
extensions available with the ADDS program interface, refer to Section 2, “Using the
ADDS Program Interface.”
Some optional features available to SIM through ADDS include the following:
• Declaring a dictionary using the DICTIONARY statement when the location of the SIM
database is in a data dictionary other than the ADDS default DATADICTIONARY.
• Specifying program tracking in the DICTIONARY statement. Program tracking
provides information about databases as components invoked in a program. If you do
not specify program tracking, it is not used.
When opening a SIM database, if you declared a dictionary in the DICTIONARY statement,
the dictionary is used to locate the database. If you did not declare a dictionary in the
DICTIONARY statement, or if the database was not found in the declared dictionary,
standard file searching conventions are used to locate the database.
For further information about the REPOSITORY option of the release specifications in the
InfoExec Configuration file, refer to the Data Management Software Installation Guide.
Note: A program can invoke only one dictionary. Therefore, if a program accesses
both a SIM database (from a dictionary) and SDF forms, both must be in the
same dictionary.
The information in this section explains how to use COBOL74 to manipulate data in a SIM
database and provides samples of typical applications used with SIM.
For an alphabetical list of the extensions used with SIM, refer to “SIM Extensions” in
Section 1, “Introduction to COBOL74 Program Interfaces.”
Refer to the InfoExec Semantic Information Manager (SIM) Programming Guide for the
concepts and programming considerations for using SIM. For information on defining
COBOL74 files and elements and for information about program tracking in SIM, refer to
the InfoExec ADDS Operations Guide.
The RESERVE SEMANTIC option must be specified if databases with the clause VALUE
OF DBKIND IS SEMANTIC are declared in the program.
If you use COBOL74 reserved words in a SIM database, the program will not compile. If
you must use a COBOL74 reserved word, declare it with an internal name and reference
the reserved word as a literal.
See Also
For information on the database declaration, refer to “Declaring a Database in SIM,” later
in this section.
General Format
The general format of the RESERVE option is as follows:
SPECIAL-NAMES.
ïïïïïïïïïïïïï
Ú ¿
³ ä å ³
³ ³SEMANTIC³ ³
³RESERVE WORDS LIST IS ãïïïïïïïïâ ... CAPABLE³ .
³ïïïïïïï ³NETWORK ³ ³
³ æïïïïïïï ç ³
À Ù
SEMANTIC
The following words are reserved only in programs that specify RESERVE SEMANTIC in
the SPECIAL-NAMES paragraph:
DMERRORFLAG DMVERIFYNAME QD
DMLUCNAME EXCLUDES
NETWORK
The reserved words for programs that specify the NETWORK option are explained in
Volume 1.
Example
The following example uses the RESERVE SEMANTIC option. The internal database name
is equated with the name of the database as specified in ADDS.
ID DIVISION.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES. RESERVE SEMANTIC.
DATA DIVISION.
DATA-BASE SECTION.
DB PROJEMP = "ORGANIZATION" VALUE OF DBKIND IS SEMANTIC.
QD PEMPQ OF PROJECT-EMPLOYEE.
QD ASSIQ OF ASSIGNMENT.
You can specify an internal and an external name for the database. You can also declare
the database to be either a SIM or a DMSII database. If multiple SIM databases are
specified, the database name can be used as the final item to resolve qualification
conflicts.
The COBOL74 interface supports the use of both DMSII and SIM databases in the same
program and in separately compiled modules. A program can also have DMSII and SIM
access to a single database. This support enables you to migrate programs with DMSII
databases to SIM databases more easily.
The maximum number of SIM databases that can be declared in a single program is 47, of
which 5 can be open simultaneously. The system can have up to 50 databases open at one
time.
General Format
The general format for a database declaration is as follows:
DB data-name-1 [ = data-name-2 ]
ïï
[GLOBAL]
ïïïïïï
Ú ¿
³ ä å ³
³ ³DMSII ³ ³
³VALUE OF DBKIND IS ãïïïïï â ³
³ïïïïï ïï ïïïïïï ³SEMANTIC³ ³
³ æïïïïïïïïç ³
À Ù
Úä å ¿
³³repository-qualifier³ ³
³ãï â ³ .
³³database-qualifier ³ ³
Àæï ç Ù
[VERSION IS integer-1]
ïïïïïïï
[DIRECTORY IS literal-1]
ïïïïïïïïï
Ú ä å ¿
³ ³PRODUCTION³ ³
³STATUS IS ãïïïïïïïïïïâ ³
³ïïïïïï ³TEST ³ ³
À æïïïï ç Ù
[ USERCODE IS literal-2 ]
ïïïïïïïï
[ FAMILYNAME IS literal-3 ]
ïïïïïïïïïï
data-name-1
data-name-2
This format element identifies the name of the database as specified in ADDS.
By default, if no dictionary is specified, the system searches for the database in the ADDS
default DATADICTIONARY. If the SIM database is in an ADDS data dictionary other than
the default DATADICTIONARY, you must use the DICTIONARY statement to identify the
name of the dictionary.
GLOBAL
VALUE OF DBKIND
This option specifies the database management system that is to manage the specified
database.
DMSII or SEMANTIC
If the DBKIND is SEMANTIC, the RESERVE clause with the SEMANTIC option must be
specified. For more information, refer to “Using the RESERVE Clause” earlier in this
section. DMSII is the default database management system.
repository-qualifier
This option identifies the exact entity to be retrieved from a repository. These options are
valid only when the database is specified as SEMANTIC.
database-qualifier
This option can be used when a SIM database is invoked without a repository. In order to
use the database-qualifier, DICTIONARY must not have been specified under the
SPECIAL-NAMES section, and the SIM configuration must include an optional repository.
If DICTIONARY has not been specified, the repository is optional, and no
database-qualifier is specified; the default usercode and familyname is used by SIM to
locate the database. The database-qualifier is valid only when the database is specified as
SEMANTIC.
VERSION IS integer-1
This option provides the version of the database. Integer-1 must be a numeric literal with a
maximum of 6 digits. The literal must be a valid version number in the dictionary.
DIRECTORY IS literal-1
This optional literal provides the name of the directory under which the database is
stored. It is valid only when the database is specified as SEMANTIC. It must be a valid
directory in the dictionary.
You can define the status of the database in the dictionary to be PRODUCTION or TEST.
Use of these options restricts the invocation of entities to those with a particular status or
subordinate status. The status specified in the database declaration takes precedence over
any program status that is declared using the DICTIONARY compiler control option.
USERCODE
This option provides the usercode of the database control file. It must be a valid usercode
on the system.
FAMILYNAME
This option provides the name of the family where the database control file resides. It
must be a valid family on the system.
DATA DIVISION.
DATA-BASE SECTION.
DB UNIVERSITY-DATABASE
VALUE OF DBKIND IS SEMANTIC.
DB MY-DATABASE = ACCOUNTING-DATABASE
GLOBAL
VALUE OF DBKIND IS SEMANTIC.
DB NEW-DATABASE = PAYROLL-DATABASE
VALUE OF DBKIND IS SEMANTIC
VERSION IS 2
DIRECTORY IS "FRED"
STATUS IS PRODUCTION.
DB PAYROLL-DB.
DB STAT-DB
VALUE OF DBKIND IS DMSII.
DATA-BASE SECTION.
DB UNIVDB
VALUE OF DBKIND IS SEMANTIC
USERCODE IS "FRED"
FAMILYNAME IS "TEST".
Table 8–1 describes the COBOL74 data types and indicates those that are valid for use
with corresponding SIM types.
Symbolic SIM types (in the SIM Type column of Table 8–1) can be of any PIC X(n)
DISPLAY query record type; however, the preferred representation is PIC X(30).
A literal value must be declared in the database as an allowable value without quotation
marks for the specific SIM item of symbolic type to which it is assigned. For example,
ASSIGN SINGLE TO MSTATUS gives the desired result, but ASSIGN “SINGLE” TO
MSTATUS receives a syntax error.
Boolean PIC 9(n) COMP BINARY, COMP, DOUBLE, PIC 9(n) DISPLAY,
REAL
Compound Group Group
attribute
Entity reference ENTITYREFERENCE ENTITYREFERENCE
Range Base type Base type
Enumeration Base type Base type
The SIM types for date and time (Table 8–1) must use a representation that enables the
slash or colon dividers to be included in the appropriate form, as shown below. The
MM/DD/YY form is valid only for input to SIM.
Note that to reference a compound attribute, you must explicitly list one or more of its
constituents. If you do not include at least one constituent, the program might compile but
you could get unexpected results.
QD EMP-Q.
01 EMP-REC.
02 E-NAME.
03 E-LASTNAME PIC X(20).
03 E-MIDINITIAL PIC X.
03 E-FIRSTNAME PIC X(15).
02 E-RESIDENCE.
03 E-STREET PIC X(30).
03 E-CITY PIC X(20).
Table 8–2 describes all the COBOL74 data types, indicating with Y (yes) those types that
are valid for use with the corresponding SIM types. The types that are labeled N (no) are
not valid for use in any context in SIM.
The SIM data types are shown horizontally across the top, and the COBOL74 usage is
shown vertically in the left-hand column.
COBOL74 Query N N N N N N Y N
Computational Y Y Y Y N N N N
REAL/ Double Y Y Y Y N N N N
EBCDIC PIC X N N N N Y N N N
EBCDIC PIC 9 Y Y Y Y N N N N
Continued
Legend
BCD Binary-coded decimal
EVA Entity-valued attribute
ASCII N N N N N N N N
Kanji N N N N N Y N N
Index N N N N N N N N
Event/Lock N N N N N N N N
Control Point N N N N N N N N
Entity-reference N N N N N N N Y
Legend
BCD Binary-coded decimal
EVA Entity-valued attribute
Qualifying Attributes
The following information explains the qualification that is needed for single-perspective
and multiple-perspective queries.
Examples
The examples presented in the following text use the following declaration:
QD EMP-Q.
01 EMP-REC.
02 E-LASTNAME PIC X(20).
02 E-SALARY PIC 9(9)V2.
02 MNGR-LASTNAME PIC X(20).
The following example shows that if the attributes are extended attributes of the
perspective class, you qualify them by using the OF clause with the name of an
entity-valued attribute. In the following example, the explicitly declared perspective class
is EMPLOYEE with the immediate attributes LAST-NAME and EMPLOYEE-SALARY. The
extended attribute is also LAST-NAME but it connects to the MANAGER class through the
EMPLOYEE-MANAGER attribute.
A qualification path can range over several classes through the use of several OF clauses.
The path can even return to the perspective class. You can also access such circular paths
with transitive closure, which uses the SET statement. In the following example, the path
ranges over the DEPARTMENT class, through the use of the DEPT-TITLE OF
DEPT-ASSIGNED attribute, and over the PROJECT class, through the use of the
SUB-PROJECT-OF OF PROJECT attribute.
See Also
See “SET Statement” in this section for information on accessing circular paths with
transitive closure.
Example
The following example uses the following declaration:
QD EMP-Q.
01 EMP-Q-REC.
02 E-NAME PIC X(20).
02 STATUS PIC X(10).
02 MNGR-NAME PIC X(20).
02 BONUS PIC 9(9).
The query variable contains information about the state of the query.
The query record is basically a normal COBOL74 record (data area) into which data is
placed when a retrieval query is executed. A query record can be used for multiple query
statements, as long as the structure of the record is compatible with the data to be
retrieved.
The two basic types of queries are retrieval queries and update queries. The CURRENT
function can be used with both types of queries.
Retrieval Retrieval queries are always used with the SELECT statement. A retrieval
query always has only one record (at the 01-level) for each query. The
SELECT statement activates a query.
• If a query is activated within a transaction state (that is, between a
BEGIN-TRANSACTION and an END-TRANSACTION statement), SIM
automatically discards the query at the end of the transaction.
• If a query is activated outside of transaction state, you must use a
DISCARD statement to discard the query when it is no longer needed. If
you do not discard the query, it might cause SIM to consume all the
available resources resulting in a run-time limit error.
Update Update queries are used in transaction state to update entities using the
attribute assignment statements START MODIFY and START INSERT. They
can also be used for limited purposes with the SELECT statement.
Instead of using the SIM program interface, you can submit update and retrieval queries
against a SIM database by using the SIM library entry points. A description of these entry
points is provided in the InfoExec Semantic Information Manager (SIM) Object
Manipulation Language (OML) Programming Guide.
See Also
• For information on functions, refer to “Using Functions.”
• For information on the CURRENT function, refer to “Special Constructs.”
• Refer to the InfoExec SIM Programming Guide for information about query
concepts, use of update and retrieval queries, and the use of the CURRENT function
with queries.
• For more information about the statements used with queries, refer to “Using
Transactions,” “Updating and Deleting Entities,” and “Selecting and Retrieving
Entities.”
• For information on deactivating a query, refer to “DISCARD Statement.”
General Format
The general format for a query declaration is as follows:
DATA-BASE SECTION .
ïïïïïïïïï ïïïïïïï
Ú ¿
³QD query-name-1 [ GLOBAL ] ³
³ïï ïïïïïï ³
³ ä å ³
³ ³[ OF data-name-1. ] ³ ³
³ ã ïï â ³
³ ³. ³ ³
³ æ ç ³
³ Ú ¿ ³
³ ³01 data-name-2. ³ ³
³ ³ ³ ³
³ ³ Úlevel-number-1 data-name-3 ¿ ³ ³ ...
³ ³ ³ ³ ³ ³
³ ³ ³ [ usage-clause-1 ] ³ ³ ³
³ ³ ³ ³ ³ ³
³ ³ ³ [ picture-clause-1 ]. ³ ³ ³
³ ³ ³ ³ ³ ³
³ ³ ³ Ú ¿ ³ ³ ³
³ ³ ³ ³level-number-2 data-name-4 ³ ³ ³ ³
³ ³ ³ ³ [ usage-clause-2 ] ³ ³ ³ ³
³ ³ ³ ³ ³ ³ ³ ³
³ ³ ³ ³ [ picture-clause-2 ]. ³ ³ ³ ³
À À À À Ù Ù Ù Ù
QD query-name-1
The level indicator QD identifies the beginning of a query declaration and must precede
the name of the query variable. The name of the query variable is identified by
query-name-1.
GLOBAL
OF
If the query is used for retrieving data, a query record is required. For updates, or for
CURRENT-only retrieval, the OF option is required. A query record cannot contain a
FILLER item at any level.
data-name-1
01 data-name-2
The 01 data-name-2 option is the COBOL74 form for the query record, which allocates a
data area for the query.
These format elements can be any number from 02 to 49. Level-number-1 and
level-number-2 are generally the same number. In the case of components of compound
attributes, level-number-2 is greater than level-number-1 to show nesting.
• The SELECT statement is associated with a QD and contains 0 (zero), one, or more
mapping clauses. Each mapping clause has one of the following formats:
− <item-name>
This is a simple-item format. The item-name must be a DVA in the perspective
class. The DVA must be in the QD.
− <item-name> = <DM-expression>
This is an assigned-item format. The item must match a user-defined name in the
QD. The DM-expression must be an attribute in the database, not necessarily in
the perspective class. If it is in a different class, it must include a qualification
path that connects it to the perspective class (for example, OF <EVA-name-1> [OF
<EVA-name-2>]...).
• Every item-name in a mapping clause must match a data-name in the QD. The QD can
contain additional data-names that do not match any item-name in a mapping clause.
The compiler assumes that any unmatched data-names are DVAs in the perspective
class and puts those data-names in the target list of the query. If the SELECT
statement has no mapping clauses, then the compiler generates the target list entirely
from the data-names in the QD.
The following example and accompanying explanation shows the way qualification is
interpreted:
QD EMP-Q OF EMPLOYEE.
01 EMP-REC.
02 SALARY PICTURE S9999999V99.
02 NAME.
03 FIRST-NAME PICTURE X(20).
03 LAST-NAME PICTURE X(20).
02 EMP-AGE PICTURE 999.
02 MGR-ID PICTURE 99999.
These format elements are described in Volume 1. Only the PICTURE and USAGE clauses
are allowed on levels below 01.
Examples
QD PROJ-Q OF PROJECT.
The following example shows a query declaration with PEMP-REC as the COBOL74 form
for the query record. Two elementary items are declared at the 02 level.
DATA DIVISION.
DATA-BASE SECTION.
QD PEMP-Q.
01 PEMP-REC.
02 PEMP-LASTNAME PIC X(20).
02 PEMP-AGE PIC 9(3).
The following example shows a query declaration with more than one level number:
QD MAN-Q.
01 MAN-Q-REC.
02 MAN-LASTNAME PIC X(20).
02 MAN-RES.
03 MAN-STREET PIC X(20).
03 MAN-ZIP PIC 9(5) COMP.
02 MAN-AGE PIC 9(11) BINARY.
OPEN Statement
The OPEN statement opens a database for subsequent access and specifies the access
mode.
General Format
The general format for the OPEN statement is as follows:
Ú ¿
³INQUIRY³
OPEN ³ïïïïïïï³ data-name-1
ïïïï ³UPDATE ³
Àïïïïïï Ù
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
INQUIRY
This option enforces read-only access to the database. It is specified when no update
operations are to be performed on the database. The default option is INQUIRY. If this
option is specified, an exception is returned to the following statements:
ABORT-TRANSACTION END-TRANSACTION
BEGIN-TRANSACTION INSERT
UPDATE
This option enables the program to modify the database. An exception is returned if the
database is already open. If an exception is returned, the state of the database remains
unchanged.
data-name-1
ON EXCEPTION
The ON EXCEPTION option is described under “Handling SIM Exceptions” later in this
section.
Example
The following example shows the OPEN statement used with the UPDATE option:
CLOSE Statement
The CLOSE statement closes a database when further access is no longer required.
General Format
The general format for the CLOSE statement is as follows:
CLOSE data-name-1
ïïïïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
data-name-1
ON EXCEPTION
The ON EXCEPTION option is described under “Handling SIM Exceptions” later in this
section. An exception is returned if the database is not open.
Example
The following example shows the use of the CLOSE statement:
CLOSE PROJEMPDB.
Using Transactions
You usually use two or more query statements as a unit; however, for SIM to treat two or
more statements as a unit, you must group them within a transaction. During transaction
state, you can update the database.
You can create and cancel intermediate transaction points within the transaction with the
SAVE TRANSACTION POINT and CANCEL TRANSACTION POINT statements. The
advantage of using intermediate transaction points is that you can better control and
correct transactions. Changes made against a database can be undone and the progress of
one or more transactions can be rolled back to a previously consistent state. For example,
if you use the SAVE TRANSACTION POINT statement to create intermediate points, a
CANCEL TRANSACTION POINT statement can be used to back out data applied since an
intermediate point or since the BEGIN-TRANSACTION statement, without terminating the
transaction or leaving transaction state.
Although you can select and retrieve either in or out of transaction state, you can update
the database only in transaction state. The following statements can be executed only in
transaction state:
ABORT-TRANSACTION EXCLUDE
END-TRANSACTION
A transaction can update only one database. The database to be updated is identified by
the first operation, which can be one of the above update operations or a data retrieval
operation. Updating a database that is different from the one identified causes an
exception condition.
See Also
• For information on updating a database, see “Updating and Deleting Entities” later in
this section.
• Information on selecting and retrieving data is provided in “SELECT Statement” and
“RETRIEVE Statement” later in this section.
Example
The following example shows the use of transaction statements in a program:
P-1.
BEGIN-TRANSACTION.
DELETE PERSON WHERE FIRST-NAME OF NAME = "John"
AND LAST-NAME OF NAME = "Doe".
ON EXCEPTION
ABORT-TRANSACTION
GO TO P-1-EXIT.
SAVE TRANSACTION POINT 1.
MODIFY PERSON
ASSIGN 34 TO AGE
WHERE FIRST-NAME OF NAME = "Mary"
AND LAST-NAME OF NAME = "Jones".
DELETE PERSON WHERE FIRST-NAME OF NAME = "John"
AND LAST-NAME OF NAME = "Smith".
ON EXCEPTION
CANCEL TRANSACTION POINT.
P-1-EXIT.
EXIT.
The following information explains the statements used to begin, cancel, and end
transaction state. It also describes the statements used to create and cancel intermediate
transaction points. The statements are presented in alphabetical order.
ABORT-TRANSACTION Statement
The ABORT-TRANSACTION statement backs out all data applied since the
BEGIN-TRANSACTION statement and takes the program out of transaction state.
General Format
The general format for an ABORT-TRANSACTION statement is as follows:
ABORT-TRANSACTION [COMS-header-name-1]
ïïïïïïïïïïïïïïïïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
COMS-header-name-1
This option specifies the COMS header. This call is made before the exception-handling
procedure is executed.
ON EXCEPTION
The ON EXCEPTION option is described under “Handling SIM Exceptions” later in this
section.
See Also
Refer to Section 3, “Using the COMS Program Interface” for more information on COMS.
BEGIN-TRANSACTION Statement
The BEGIN-TRANSACTION statement places a program in transaction state.
General Format
The general format of a BEGIN-TRANSACTION statement is as follows:
BEGIN-TRANSACTION [EXCLUSIVE]
ïïïïïïïïïïïïïïïïï
[COMS-header-name-1 [USING identifier-1]]
ïïïïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
EXCLUSIVE
This option is used to perform a long transaction against a SIM database. If you specify
this option, you are assigned to an exclusive transaction state. In this transaction state,
you are guaranteed exclusive access to the database and have exclusive control of all
structures in the database. However, to prevent deadlocks, the program must wait until all
other programs have finished processing before it can gain exclusive access. Because
exclusive access has a high performance cost, it should be used sparingly.
This option is used only with COMS. Identifier-1 specifies the message area. These
constructs enable a program interfacing with COMS to support transactions and a batch
option when using archival recovery.
is made and the message area specified by identifier-1 is passed to the DCIENTRYPOINT
of the DCI library.
ON EXCEPTION
The ON EXCEPTION option is described under “Handling SIM Exceptions” later in this
section.
See Also
For more information on recovery, refer to the COMS Programming Guide.
General Format
The general format of a CANCEL TRANSACTION POINT statement is as follows:
arithmetic-expression-1
The CANCEL TRANSACTION POINT statement backs out all database changes made
between the current point in the transaction and the point specified by
arithmetic-expression-1.
ON EXCEPTION
The ON EXCEPTION option is described under “Handling SIM Exceptions” later in this
section.
See Also
For details on arithmetic expressions, see “Arithmetic Expressions” later in this section.
END-TRANSACTION Statement
The END-TRANSACTION statement commits all updates applied within a transaction, and
takes a program out of transaction state.
General Format
The general format of an END-TRANSACTION statement is as follows:
COMS-header-name-1
This option specifies the COMS output header. This call is made before the
exception-handling procedure is executed.
USING data-name-1
The USING option enables the message area indicated by data-name-1 to be passed to the
DCIENTRYPOINT when the call is made on the DCI library.
ON EXCEPTION
The ON EXCEPTION option is described under “Handling SIM Exceptions” later in this
section.
See Also
Refer to Section 3, “Using the COMS Program Interface,” for more information on COMS.
General Format
The general format of a SAVE TRANSACTION POINT statement is as follows:
arithmetic-expression-1
For details on arithmetic expressions, see “Arithmetic Expressions” later in this section.
ON EXCEPTION
The ON EXCEPTION option is described under “Handling SIM Exceptions” later in this
section.
Variables that contain entity reference values are called entity reference variables. These
variables can be assigned and compared only with other entity reference variables that
have been declared with ENTITYREFERENCE usage of the same class. Entity reference
values are valid only in the transaction state in which they are retrieved.
See Also
For detailed information about entity reference variables, refer to the InfoExec SIM
Programming Guide.
General Format
The general format of the declaration for the entity reference variable is as follows:
level-number-1 data-name-1
USAGE IS ENTITYREFERENCE OF data-name-2
ïïïïïïïïïïïïïïï ïï
Úä å ¿
³³OCCURS ³ ³
³ãïïïïï â integer-1 [TIMES]³ .
³³OC ³ ïïïïï ³
Àæïï ç Ù
level-number1
data-name-1
This format element is associated with the entity-valued attributes of the database.
USAGE IS ENTITYREFERENCE OF
An item with ENTITYREFERENCE usage is compatible only with other items of the same
class having ENTITYREFERENCE usage. The item is not alphabetic, alphanumeric, or
numeric, so it cannot be used in statements that associate it with such items.
An item with ENTITYREFERENCE usage can be accessed only within transaction state.
data-name-2
OCCURS or OC
This option functions in the same way as any COBOL74 OCCURS clause. See Volume 1 for
details on the use of this clause.
Example
The following is an example of a declaration for an entity reference variable:
See Also
For a detailed discussion of the use of functions and expressions in SIM, refer to the
InfoExec SIM Programming Guide.
Using Functions
SIM supports the following functions:
• Aggregate functions
• Arithmetic functions
• Special constructs
• String functions
• Symbolic functions
• Time and date functions
Aggregate Functions
Table 8–3 summarizes the aggregate functions available in the COBOL74 program
interface with SIM. Aggregate functions apply a function to a set of entities to produce a
single scalar result. Some of these functions appear in the diagrams for expressions shown
later in this section.
Function Explanation
Example
The following example shows the use of the AVG aggregate function:
Arithmetic Functions
SIM supports the arithmetic functions shown in Table 8–4.
Function Explanation
ABS (expression) Absolute value. Returns the absolute value of the argument. The result
is of the same type as the argument.
ROUND (expression) Returns an expression rounded to the nearest integer.
SQRT (expression) Square root. Returns a real number that is the square root of the
argument. The value of the expression must evaluate to a nonnegative
number.
TRUNC (expression) Truncate. Returns the integer portion of the argument.
Special Constructs
Table 8–5 summarizes the special constructs available in the COBOL74 interface with SIM.
These constructs cannot be categorized as traditional functions. Note that the
introductory word DMFUNCTION does not precede these constructs when they are used
in a program.
The quantifiers ALL, NO, and SOME can be used when specifying entities for selection to
• Create a new reference variable that ranges over the class or multivalued attribute
(MVA) represented by the identifier
• Apply to the results of a path expression
• Embed quantifiers in an extended qualification
You cannot quantify a reference variable created by using the CALLED construct.
For the EQUIV construct, the ordering sequence is the arrangement of members of a
character set according to a predetermined scheme. Different elements can have the same
ordering attribute, for example, the letters a and A.
Construct Explanation
ALL Indicates that each value of the attribute must meet the condition.
CALLED Assigns a variable to a certain set of entities for reference by the variable.
CURRENT Refers to an entity specified in a selection expression for an active retrieval
query.
EQUIV Performs an equivalent comparison by using the ordering sequence values
(OSVs) of characters. This construct is valid only for string expressions.
The syntax for the EQUIV construct is as follows:
EQUIV (string1 Relational Operator clause string2)
INVERSE Accesses the inverse of an entity-valued attribute.
NO Indicates that no value can meet the condition.
SOME Indicates that at least one value must meet the condition.
TRANSITIVE Returns the transitive closure of a cyclical path expression. An END clause
can be used to specify levels of recursion to be included, if a complete
closure is not performed. The TRANSITIVE function can be used only with
the embedded SELECT statement. Additional information is provided in the
InfoExec SIM Programming Guide.
Examples
The following are examples of special constructs:
CURRENT OF PEMP-Q
TRANSITIVE (SUB-PROJECTS)
String Functions
String functions can perform either or both of the following:
Table 8–6 describes the string functions and their use with SIM.
EXT("Monday",1,3) = "Mon"
EXT("Monday",4,*) = "day"
POS("e","December") = 2
POS("e","December",3) = 4
POS("e","December",5) = 7
Example
The following example shows the use of the LEN function to find the length of a string:
Symbolic Functions
Table 8–7 lists the symbolic functions available in SIM for use in a COBOL74 program.
Symbolic functions operate upon SIM symbolic types, which have values that are
identifiers.
Function Explanation
PRED Predecessor. This function operates on ordered symbolics and returns the
previous symbolic value.
SUCC Successor. This function operates on ordered symbolics and returns the
successive symbolic value.
See Also
For information on the SIM types for date and time, refer to “Mapping SIM Types into
COBOL74,” earlier in this section.
Function Explanation
ADD-DAYS Takes the date and a positive or negative increment in days to produce a
new date. A positive increment returns a future date and a negative
increment returns a previous date. The date must be a valid constant
without quotation marks, for example 09/08/88.
ADD-TIME Takes the time and an increment in seconds to produce a new time. A
positive increment returns a future time and a negative increment returns
a previous time. The time must be a valid constant without quotation
marks, for example 14:01:22.
CURRENT-DATE Parameterless function of type DATE that returns the date for today.
CURRENT-TIME Parameterless function of type TIME that returns the current time of day.
DAY Returns a day of the month, in numeric form 1 through 31.
DAY-OF-WEEK Returns a day of the week, as a string.
ELAPSED-DAYS Returns elapsed days between two dates.
ELAPSED-TIME Returns the difference in seconds between two expressions of time.
HOUR Returns the hour portion of a time expression.
Function Explanation
Examples
The following are examples of date and time functions.
The following are examples of the CURRENT-TIME, HOUR, MINUTE, and SECOND time
functions:
DMFUNCTION CURRENT-TIME
The following are examples of the ELAPSED-TIME and ADD-TIME time functions:
DMFUNCTION ADD-TIME(EST-PERSON-HOURS,3600)
The following examples show the CURRENT-DATE, YEAR, MONTH, and DAY date
functions:
DMFUNCTION CURRENT-DATE
DMFUNCTION YEAR(EMPLOYEE-HIRE-DATE)
DMFUNCTION MONTH(EMPLOYEE-HIRE-DATE)
DMFUNCTION DAY(EMPLOYEE-HIRE-DATE)\
The following are examples of the ELAPSED-DAYS and ADD-DAYS date functions:
DMFUNCTION ADD-DAYS(EMPLOYEE-HIRE-DATE,7)
The following examples show the DAY-OF-WEEK and MONTH-NAME date functions:
DMFUNCTION DAY-OF-WEEK(EMPLOYEE-HIRE-DATE)
DMFUNCTION MONTH-NAME(EMPLOYEE-HIRE-DATE)
Using Expressions
Data management (DM) expressions are used within database statements to determine
values or entities. The selection expression is a special kind of DM expression used to
select entities for retrieval and update.
The following expressions are available in the program interface. The formats and
conventions of each expression are explained in the discussion that follows this list.
• Arithmetic expressions
• Conditional expressions
• Selection expressions
• String expressions
• Formats for expressions used with SIM
See Also
• For a detailed explanation of the use of selection expressions with SIM, refer to
InfoExec SIM Programming Guide.
• For general information on conditions and arithmetic expressions, refer to Volume 1.
Arithmetic Expressions
Arithmetic expressions can contain constants, built-in or user-defined functions, and
arithmetic attributes. Only one multivalued attribute (MVA) can be used in an arithmetic
expression.
If either operand of an arithmetic expression is null, the result is null. Note that at least
one space must appear between each operand and operator within an expression.
Expression Meaning
+ Addition
-- Subtraction
* Multiplication
/ Division
MOD Modulus
** Exponentiation
Conditional Expressions
Conditional expressions identify conditions that are tested so the program can choose
between two paths of control, depending on the truth value of the condition.
Table 8–9 specifies the valid operators. These operators can be used to test ordered types.
Two type-compatible operands can be compared using IS EQUAL TO or IS NOT EQUAL
TO. Only IS EQUAL TO or IS NOT EQUAL TO can be used with compound types or any
nonordered types (such as Kanji or entity). A compound type can be compared only to
another compound type with the same sequence of components; a compound type cannot
be compared to any COBOL74 type. To compare a compound type to a COBOL74 group,
you must write individual comparisons for the components and elementary items. Scalar
relational operators can be used with multivalued expressions.
Operator Explanation
See Also
• For information on the use of operators in the Condition and Relational Operator
expression clauses used with SIM, see “Expression Formats” later in this section.
• For information on the IS IN operator, refer to “String Expressions” later in this
section.
• For general information about conditional expressions, refer to Volume 1.
Selection Expressions
A selection expression can be used to identify the set of entities upon which a query is to
operate. It narrows the group of entities in the perspective class and in classes of interest
for the scope of the query. A selection expression can be either global or local.
A global selection expression applies to the whole query. A local selection expression
applies only to specific attributes.
WHERE selection-expression-1
ïïïïï
WITH selection-expression-1
ïïïï
WITH
This clause can appear only in the target list of a query, or within a built-in function. The
selection expression in the WITH clause affects only the attribute to which it is applied.
When you use RETRIEVE statements with statements that contain local selection
expressions, each RETRIEVE statement obtains the next entity in the query and then
compares the values of the entity against the criteria in the local selection expression. If
the values of an entity do not satisfy the local selection expression, a null value is returned
to the program for the attribute with the local selection expression, instead of the actual
value of the attribute. An error exception only occurs when there are no more entities to
be retrieved.
String Expressions
Concatenation is supported in SIM. The operator used in COBOL74 for concatenation is
CAT.
Character Explanation
Examples
The following examples use the IS IN operator for pattern matching.
• The code in this example returns the value FALSE because the only item generated
from the pattern "123ABC" is "123ABC". The string expression "ABC" is not equal to
"123ABC".
"ABC" IS IN "123ABC"
• The code in this example returns the value TRUE because the pattern "123|ABC"
contains two string items: 123 and ABC. The string expression "ABC" matches the ABC
in the pattern.
"ABC" IS IN "123|ABC"
• This example returns the value TRUE because the pattern "{ABC}*" contains all the
strings that have zero or more concatenations of the literal ABC. Examples of these
concatenations include blank ( ), ABC, ABCABC, and ABCABCABC.
"ABC" IS IN "{ABC}*"
• The code in this example returns the value TRUE if MY-STRING contains zero or more
concatenations of the literal 123 followed by AB.
MY-STRING IS IN "{123}*AB"
See Also
For additional information on the string expression, refer to the InfoExec SIM
Programming Guide.
Expression Formats
Expressions are used to perform the following:
Information on expression formats is presented in three parts: a list that contains each DM
expression clause and its description; a presentation of the general format for each
expression clause; and an explanation of the components of each general format.
The clauses for DM expressions and selection expressions include the following:
Expression Description
Boolean Expression clause Selection expression used with Boolean operators AND, NOT,
and OR
Transitive Specification Control for the level at which an entity search is done in
clause transitive closure
General Formats
The general format for each expression format follows.
Úä å ¿
³³AND³ ³
[NOT] Boolean Primary clause ³ãïïïâ [NOT] Boolean Expression clause³
ïïï ³³OR ³ ïïï ³
Àæïï ç Ù
ä å
³TRUE ³
³ïïïï ³
³FALSE ³
³ïïïïï ³
ãQualification Term clause [ OF Qualification Term clause ] ...â
³ [ OF Transitive Specification clause ] ³
³ ³
³( Boolean Expression clause ) ³
³ï ï ³
æCondition clause ç
äEXISTS å
³ïïïïïï ³
³ä å ³
³³ISA ³ ³
Expression clause ã³ïïï ³ â
³ãIS IN â Expression clause³
³³ïï ïï ³ ³
³³Relational Operator clause³ ³
ææ ç ç
Úä å ¿
³³- ³ ³
³³ ³ ³
³³+ ³ ³
³³ ³ ³
³³* ³ ³
Úä-å ¿ ³³ ³ ³
³ã â ³ Primary clause ³ã/ â Expression clause ³
Àæ+ç Ù ³³ ³ ³
³³** ³ ³
³³ ³ ³
³³CAT³ ³
³³ïïï³ ³
³³DIV³ ³
³³ïïï³ ³
³³MOD³ ³
Àæïïïç Ù
ä ä å å
³ ³EQUAL TO ³ ³
³ ³ïïïïï ³ ³
³ ³= ³ ³
³ ³ ³ ³
³ ³AFTER ³ ³
³ ³ïïïïï ³ ³
ãIS [NOT] ãGREATER THANâ â
³ ïïï ³ïïïïïïï ³ ³
³ ³> ³ ³
³ ³ ³ ³
³ ³BEFORE ³ ³
³ ³ïïïïïï ³ ³
³ ³LESS THAN ³ ³
³ ³ïïïï ³ ³
³ ³< ³ ³
æ æ ç ç
TRANSITIVE
ïïïïïïïïïï
( [ INVERSE OF ] DB-data-name
ï ïïïïïïï ïï
[ OF [ INVERSE OF ] DB-data-name ]...
ïï ïïïïïïï ïï
[ END LEVEL literal ]
ïïï ïïïïï
)
ï
[ OF Qualification Term clause ]...
ïï
Boolean Expression NOT, AND, and OR These format elements are Boolean
clause operators.
Boolean Primary
clause
Boolean Expression
clause
continuedBoolean TRUE, FALSE These format elements are Boolean values.
Primary clause
Qualification Term The qualification term in the Boolean Primary
clause clause must be a SIM Boolean item.
Transitive
Specification
clause
Boolean Expression
clause
Condition clause
Condition clause ISA, IS IN, and Information about these operators is provided
EXISTS in “String Expressions” and “Conditional
Expressions” earlier in this section.
Expression clause
Relational Operator
clause
Expression clause –, +, *, /, **, CAT, More information about these operators is
DIV, MOD provided in “Arithmetic Expressions” earlier in
this section.
Primary clause
Expression clause
• The SELECT statement is used to associate a selected set of entities with the query. It
also enables you to assign database attributes to query variables you have defined.
Selection expressions can be used within the SELECT statement to specify one, some,
or all entities from a set.
• The SET statement is used to manipulate the levels of an attribute involving a
selection and retrieval in transitive closure.
• The RETRIEVE statement is used to retrieve the query.
• The DISCARD statement terminates an activated query.
SELECT Statement
The SELECT statement selects a set of entities from a database and associates it with the
query.
General Format
The general format of the SELECT statement is as follows:
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
query-name-1
FROM
This clause specifies the perspective through which SIM associates the attributes. The
FROM clause is optional if you have declared the query using the OF phrase to specify a
class. The FROM clause is required when you have declared the query using the 01-level
clause to specify a query record.
This option assigns a reference variable to a specific set of entities. Data-name-2 and
data-name-4 are data names that are local to the SELECT statement.
DISTINCT
This option removes any duplicates, and selects only a unique set of data. DISTINCT is
valid only for tabular formatting.
mapping-clause-1
There are several options available for the mapping clause. They are explained in
“Explanation of Mapping Clause Format Options,” which follows this discussion of the
SELECT statement.
ORDER BY
These options are used in ordering output in the ORDER BY phrase. ASCENDING is the
default. If more than one sort key is indicated, the leftmost is the most significant for
ordering.
These options select the sequence for the retrieved data that is sorted in the ORDER BY
option. The BINARY option is the default for the ASERIESNATIVE ccsversion and
double-octet strings. The COLLATING option is the default for eight-bit strings that are not
native to the MCP environment.
The collating sequence is the arrangement of members of a character set according to the
ordering sequence values (OSVs) and the priority sequence values (PSVs). Elements
occupy different code positions. Elements that have the same OSV are differentiated by
the PSV assigned to the code position.
These format elements must be of a type that is ordered and must result in a single value
unless tabular formatting is requested.
WHERE selection-expression-1
This option is used for a global selection expression that applies to the entire query.
ON EXCEPTION
See Also
For information on declaring a query, see “Using the Query Declaration to Declare a
Query.”
• For tabular formatting, do not use embedded SELECT clauses. The compiler requests
tabular format if no embedded SELECT clauses are specified; otherwise, the compiler
requests hybrid selection.
• For hybrid selection, which combines structured with tabular formats, use the
Attribute Map clause for items to be displayed in a table, and use embedded SELECT
clauses for items to be displayed in a structure.
• For structured formatting, use embedded SELECT clauses. Structured formatting is a
subset of hybrid selection.
When the Attribute Map clause is used with the subset embedded SELECT clause, all
attributes must be listed before any embedded SELECT clauses.
You do not have to specify attributes in the order in which they were declared, except
when factoring for qualification. For an example of factoring, refer to the examples later
in this section.
äattribute-map-clause-1 å
³ ³
ãembedded-select-clause-1 â
³ ³
æattribute-map-clause-2, embedded-select-clause-2ç
ä å
³ ä å³
³ ³data-name-5 [ = DM-expression-3 ] ³³
³ ³ ï ä å³³
ã,ã ³ Qualification Term clause ³ââ ...
³ ³(attribute-map-clause-5) OF ã â³³
³ ³ï ï ïï ³Transitive Specification clause³³³
³ ³ æ ç³³
æ æ çç
ä äSELECT query-name-2 åå
³ ³ïïïïïï ³³
³ ³ ä å³³
³ ³ ³Qualification Term clause [OF Qualification Term clause]³³³
³ ³ ³ ïï ³³³
ã,ã FROM ã [ OF Transitive Specification clause ]... âââ
³ ³ ïïïï ³ ïï ³³³
³ ³ ³Transitive Specification clause ³³³
³ ³ æ ç³³
³ ³ [ ( mapping-statement-2 ) ] ³³
æ æ ï ï çç
data-name-5
If data-name-5 appears without DM-expression-3, the name must be a COBOL item name
declared in the query declaration; the name must also be a database identifier that is one
of the following: a data-valued attribute (single-valued or multivalued), an entity-valued
attribute, or a database transitive specification. The compiler retrieves each matching
attribute in the COBOL item. If the matching attribute is the name of a COBOL group item,
it is also a compound attribute name. In this case, there must be a component attribute
within the compound with the same name as each corresponding elementary item within
the group. The compiler maps all of the matching components into the elementary items.
DM-expression-3
DM-expression-3 must be a data management expression that could, possibly, be the name
of a single attribute.
When the name of an elementary item in the query declaration does not appear in an
Attribute Map clause, the compiler assumes an implicit Attribute Map clause without
DM-expression-3. For each elementary item, the class must contain an attribute with a
matching name. The compiler then maps matching attributes in elementary items.
When the compiler maps an attribute into an elementary item, the rules for a COBOL
MOVE statement apply. When a Boolean expression is mapped to its COBOL item, a false
value is represented by 0 (zero) and a true value is represented by a nonzero value (not
necessarily 1). The COBOL item should be tested to determine its value.
This format element specifies the Qualification Term clause. The format for this clause is
described in “Expression Formats” earlier in this section.
FROM
This phrase specifies the perspective through which SIM associates the attributes.
This clause describes the entity search level for transitive closure. The format for this
clause is explained under “Expression Formats” earlier in this section.
query-name-2
See Also
• For information on the use of the embedded SELECT clause with the TRANSITIVE
function, refer to the InfoExec SIM Programming Guide.
• See Volume 1 for an explanation of the rules for the COBOL MOVE statement.
• See “Using Expressions” earlier in this section for information on DM expressions.
Examples
The following examples show Mapping clause options.
The following example uses a combination of options shown in the Mapping clause:
MY-AGE = AGE,
MY-NAME = LAST-NAME OF NAME
SELECT Q-2 FROM DEPT-IN
(MY-DEPT = DEPT-TITLE)
SELECT Q-3 FROM CURRENT-PROJECT
(MY-PROJECT = PROJECT-TITLE).
The following example illustrates a tabular selection. Default attributes are obtained from
the query record associated with DEPTQ.
The following three examples use the SELECT statement for a query in three distinct
versions of the Mapping clause.
The following example uses the CALLED construct. For more information, see “Special
Constructs” earlier in this section.
SET Statement
The SET statement alters the value for the level expected in a retrieval involving transitive
closure. Refer to the InfoExec SIM Programming Guide for detailed information about
transitive closure and about using entities in a tabular or structured format.
By default, a retrieval traverses the same level, then ends. The SET statement can be used
to manipulate level changes during traversal. This use of the SET statement is especially
valuable when the attribute is multivalued, with multiple values at each level.
General Format
The general format of the SET statement is as follows:
ä å
³UP ³
SET query-name-1 LEVEL ãïï â
ïïï ïïïïï ³DOWN³
æïïïïç
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
query-name-1
UP and DOWN
The UP phrase adjusts the level up one level from the base of the query tree. The DOWN
phrase adjusts the level down one level. Set the appropriate level before a retrieval.
ON EXCEPTION
Example
The following example uses the SET statement to adjust the level up from the base of the
query tree, PQ:
RETRIEVE Statement
The RETRIEVE statement requests information from a database. While the SELECT
statement specifies and selects entities to be used, the RETRIEVE statement actually
makes the entities available to your program.
Information about the options for a retrieval involving transitive closure is provided in
“SET Statement” earlier in this section.
General Format
The general format for the RETRIEVE statement is as follows:
RETRIEVE query-name-1
ïïïïïïïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
query-name-1
Query-name-1 designates the name of the query. If query-name-1 is declared with a query
record that contains an entity reference variable, the RETRIEVE statement must be used
within transaction state, or a run-time error occurs.
ON EXCEPTION
See Also
• For more information, refer to “Using the Query Declaration to Declare a Query” and
“Declaring an Entity Reference Variable” earlier in this section.
• For information about transaction statements, see “Using Transactions” earlier in this
section.
Example
The following line of code shows the use of the RETRIEVE statement:
RETRIEVE PEMPQ.
DISCARD Statement
The DISCARD statement discards, or terminates, a currently active query.
General Format
The general format of the DISCARD statement is as follows:
DISCARD query-name-1
ïïïïïïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
query-name-1
ON EXCEPTION
Example
The following example shows the use of the DISCARD statement:
DISCARD PROJQ.
• The INSERT statement or clause is used to create an entity in a particular class with
specified attribute assignments, or to create a new role or roles for an entity.
There are two types of updates. You cannot use both types of updates in the same query.
The updates include
See Also
For more detailed information about the types of updates and their use, refer to the
InfoExec SIM Programming Guide.
INSERT Statement
An INSERT statement creates an entity in the specified class with specific attribute
assignments or creates a new role or roles for an entity. There are two types of INSERT
statements: single-statement update and multiple-statement update.
Single-Statement Update
General Format
The general format of the single-statement update INSERT statement is as follows:
INSERT data-name-1
ïïïïïï
[FROM data-name-2 WHERE selection-expression-1]
ïïïï ïïïïï
ä å Ú ä å ¿
³assign-clause ³ ³ ³assign-clause ³ ³
³ ³ ³ ³ ³ ³
ãexclude-clauseâ ³,ãexclude-clauseâ ³ ...
³ ³ ³ ³ ³ ³
³include-clause³ ³ ³include-clause³ ³
æ ç À æ ç Ù
ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
If the FROM clause is used, data-name-1 and data-name-2 must have one of the following
two relationships. If data-name-1 and data-name-2 do not have either of these two
relationships, an INSERT statement cannot be used.
• data-name-1 and data-name-2 must have a common superclass. For example, if the
EMPLOYEE class and the EX_EMPLOYEE class both have the superclass PERSON,
you can do the following:
− Insert an entity from the EMPLOYEE class into the EX_EMPLOYEE class.
− Insert an entity from the EX_EMPLOYEE class into the EMPLOYEE class.
• data-name-1 must be a subclass of data-name-2. For example, if the EMPLOYEE class
is a subclass of the PERSON class, then the following statements are true:
− You can insert an entity from the PERSON class into the EMPLOYEE class.
− You cannot insert an entity from the EMPLOYEE class into the PERSON class.
These options specify an existing entity for which a new role is created.
Clauses
ON EXCEPTION
Examples
The following examples use the INSERT statement.
Example of the INSERT Statement with the ASSIGN and INCLUDE Clauses
The following example shows the INSERT statement with the ASSIGN and INCLUDE
clauses used to represent the database attribute assignment clauses:
INSERT PROJECT-EMPLOYEE
ASSIGN ["John" TO FIRST-NAME, "Doe" TO LAST-NAME]
TO NAME
ASSIGN 19 TO AGE
INCLUDE PROJECT WITH PROJECT-TITLE = "Payroll"
INTO CURRENT-PROJECT.
The following example uses the INSERT statement with the FROM and WHERE options:
Multiple-Statement Update
In a multiple-statement update, the START INSERT statement describes the type of
selection, if any, and associates a query name with the statement. The APPLY INSERT
statement applies all multiple-statement update INSERT statements between the START
and APPLY statements. An example of both statements is provided at the end of the
description of the APPLY INSERT statement later in this section.
The START INSERT statement causes the database system to prepare for a
multiple-statement update insertion.
General Format
The general format of the START INSERT statement is as follows:
query-name-1
This format element designates the query name to be associated with the statement.
These options specify an existing entity for which a new role is created.
The INSERT superclass that appears after FROM can be the immediate superclass of the
INSERT subclass named in the query-name following INSERT; there can be many
intermediate class levels between the two. For each intermediate level, SIM creates the
entity as part of the execution of the INSERT FROM statement. If an entity already exists
at an intermediate level, or at the insert subclass level, a “subrole already exists” error
message appears.
You can use attribute assignment statements to reference attributes in the intermediate
classes; however, the error message “required attribute” appears if you execute a required
attribute before an APPLY INSERT statement is run.
If the INSERT subclass includes multiple superclasses, SIM create entities in any
intermediate classes between it and the INSERT superclass; but for any superclasses not
in the same hierarchy as the INSERT superclass, an entity must already exist when the
INSERT FROM statement is executed, or a “missing superclass entity” error message
appears.
data-name-1
In general, you can use a subclass in place of a class; however, in a START INSERT
statement using the FROM option,data-name-1 must be a database class.
ON EXCEPTION
The APPLY INSERT statement causes the database system to perform the
multiple-statement update insertion.
General Format
The general format of the APPLY INSERT statement is as follows:
query-name-1
This format element associates the query name with the statement.
ON EXCEPTION
Example
The following example shows a multiple-statement update:
MODIFY Statement
A MODIFY statement causes the update of existing entities in the specified class through
the accompanying attribute assignments. There are two types of MODIFY statements:
single-statement update and multiple-statement update.
Single-Statement Update
General Format
The general format of the single-statement update MODIFY statement is as follows:
Ú ä å ¿
³ ³LIMIT = arithmetic-expression-1³ ³
MODIFY ³( ãïïïïï ï â )³ data-name-1
ïïïïïï ³ï ³NO LIMIT ³ ï³
À æïï ïïïïï ç Ù
ä å Ú ä å ¿
³assign-clause ³ ³ ³assign-clause ³ ³
³ ³ ³ ³ ³ ³
ãexclude-clauseâ ³,ãexclude-clauseâ ³ ...
³ ³ ³ ³ ³ ³
³include-clause³ ³ ³include-clause³ ³
æ ç À æ ç Ù
[WHERE selection-expression-1]
ïïïïï
ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
LIMIT or NO LIMIT
These options limit the number of entities that can be modified. If the limit is exceeded, an
exception is produced, and no entities are updated.
arithmetic-expression-1
For details on arithmetic expressions, see “Arithmetic Expressions” earlier in this section.
data-name-1
Clauses
The clauses refer to statements used to assign values to attributes. Refer to “Attribute
Assignment Statements” later in this section for more information.
WHERE selection-expression-1
This option is a global selection expression that applies to the entire query. It is required
for all attributes except class attributes. It is not allowed for class attributes.
ON EXCEPTION
Examples
The following examples illustrate the use of the MODIFY statement.
The following example uses the MODIFY statement with the NO LIMIT option:
The following example uses the MODIFY statement with a LIMIT option:
The following example uses the MODIFY statement with the INCLUDE, EXCLUDE, and
ASSIGN database attribute assignments. The WHERE option is also used.
MODIFY PROJECT-EMPLOYEE
INCLUDE PROJECT WITH PROJECT-TITLE =
"Supplies Inventory" AND
PROJECT-NO = 101
INTO CURRENT-PROJECT
EXCLUDE PROJECT WITH PROJECT-TITLE = "Office Inventory" AND
PROJECT-NO = 58
FROM CURRENT-PROJECT
ASSIGN MANAGER WITH CURRENT OF MQ = MANAGER
TO EMPLOYEE-MANAGER
WHERE FIRST-NAME OF NAME
OF PROJECT-EMPLOYEE = "John" AND
LAST-NAME OF NAME OF PROJECT-EMPLOYEE = "Doe".
Multiple-Statement Update
A multiple-statement update uses the START MODIFY and APPLY MODIFY statements.
The START MODIFY statement causes the database system to prepare for a
multiple-statement update modification.
General Format
The general format of the START MODIFY statement is as follows:
Ú ä å ¿
³ ³LIMIT = arithmetic-expression-1³ ³
START MODIFY ³( ãïïïïï â )³ query-name-1
ïïïïï ïïïïïï ³ï ³NO LIMIT ³ ï³
À æïï ïïïïï ç Ù
[WHERE selection-expression-1]
ïïïïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
LIMIT or NO LIMIT
These options limit the number of entities that can be modified. If the limit is exceeded, an
exception is produced.
arithmetic-expression-1
For details on arithmetic expressions, see “Arithmetic Expressions” earlier in this section.
query-name-1
This format element associates the query name with the statement.
WHERE selection-expression-1
This clause is a global selection expression that applies to the entire query. It is required
for all attributes except class attributes. It is not allowed for class attributes.
ON EXCEPTION
The APPLY MODIFY statement causes the database system to perform the
multiple-statement update modification. This update modification includes all
multiple-statement update assignments that have occurred since the START MODIFY
statement.
General Format
The general format of the APPLY MODIFY statement is as follows:
query-name-1
This format element associates the query name with the statement.
ON EXCEPTION
Example 1
Example 2
The Compound clause assigns or adds values to compound attributes. This is an optional
clause that is used with the ASSIGN and INCLUDE statements.
The statements and clauses are presented alphabetically on the following pages.
ä å
³DM-expression-1 ³
ASSIGN ã â TO data-name-1
ïïïïïï ³compound-clause-1³ ïï
æ ç
assign-clause-1 OF query-name-1
ïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
DM-expression-1
compound-clause-1
TO data-name-1
assign-clause-1
query-name-1
This format element associates the query name with the statement.
ON EXCEPTION
For information on the ON EXCEPTION clause, refer to “Handling SIM Exceptions” later
in this section.
See Also
For information on expressions, refer to “Using Expressions” earlier in this section.
Examples
The following examples show the use of the ASSIGN clause and the ASSIGN statement
with simple attributes:
The following example uses the ASSIGN clause with a Boolean expression:
Compound Clause
The Compound clause is used to assign or add values to compound attributes. It is used
only with the ASSIGN or INCLUDE attribute assignment statements and clauses.
General Format
The format of the Compound clause is as follows:
ä å
³DM-expression-1 TO data-name-1 ³
³ ïï ³
[ ãEXCLUDE data-name-2 â
ï ³ïïïïïïï ³
³compound-clause-1 TO data-name-3³
æ ïï ç
Ú ä å ¿
³ ³DM-expression-2 TO data-name-4 ³ ³
³ ³ ïï ³ ³
³, ãEXCLUDE data-name-5 â ³ ...]
³ ³ïïïïïïï ³ ³ ï
³ ³compound-clause-2 TO data-name-6³ ³
À æ ïï ç Ù
data-name-1 through 6
EXCLUDE
This phrase excludes a part of the compound attribute. For example, in a compound
attribute consisting of first, middle, and last names, you could exclude middle names. You
can use the EXCLUDE phrase on all data-valued and entity-valued attributes, both
single-valued and multivalued. The phrase cannot be used with an INSERT or START
INSERT statement.
ASSIGN
[ "1234 Main" TO STREET, "Santa Ana" TO CITY ]
TO CURRENT-RESIDENCE OF PEMPQ.
ASSIGN
[ "23 Broadway" TO STREET, EXCLUDE STATE ]
TO CURRENT-RESIDENCE OF MANQ.
Ú ä å ¿
³ ³LIMIT = arithmetic-expression-1³ ³
EXCLUDE ³( ãïïïïï â )³
ïïïïïïï ³ï ³NO LIMIT ³ ï³
À æïï ïïïïï ç Ù
[DM-expression-1] FROM data-name-1
ïïïï
exclude-clause-1 OF query-name-1
ïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
LIMIT or NO LIMIT
These options limit the number of entities that can be excluded. If neither of these options
is specified, the default is one. If the limit is exceeded, an exception is produced.
arithmetic-expression-1
DM-expression-1
FROM
This phrase specifies the perspective through which SIM associates the attributes. The
omission of the clause containing the DM-expression-1 removes all values from the
attribute for the entity (in other words, the attribute value does not exist).
data-name-1
exclude-clause-1
This format element designates the use of the EXCLUDE clause in the statement.
query-name-1
This format element associates the query name with the statement.
ON EXCEPTION
For information on the ON EXCEPTION clause, refer to “Handling SIM Exceptions” later
in this section.
See Also
For information on expressions, see “Using Expressions” earlier in this section.
Examples
The following are examples of the EXCLUDE clause and statement.
The following example uses the EXCLUDE clause with DM-expression-1. For each project
employee with a current project of PROJECT-ERV, the information about the current
project is removed.
The following example shows the removal of information about education from the record
containing the educational qualifications of each employee (PEQ) with a BS degree:
INCLUDE
ïïïïïïï
ä å
³DM-expression-1 [, DM-expression-2] ... ³
ã â
³compound-clause-1 [, compound-clause-2]...³
æ ç
INTO data-name-1
ïïïï
include-clause-1 OF query-name-1
ïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
INTO data-name-1
include-clause-1
This format element associates the INCLUDE clause with the statement.
OF query-name-1
This format element associates the query name with the statement.
ON EXCEPTION
For information on the ON EXCEPTION clause, refer to “Handling SIM Exceptions” later
in this section.
See Also
For information on expressions, refer to “Using Expressions” earlier in this section.
Examples
The following examples use the INCLUDE statement.
The following example illustrates the use of the INCLUDE statement with simple
attributes. Each project employee is assigned a current project.
The following example uses the INCLUDE statement with compound attributes.
Educational qualifications are assigned to each project employee.
DELETE Statement
The DELETE statement causes the entities in the specified class that meet the specified
selection to be deleted from the database.
General Format
The general format of the DELETE statement is as follows:
Ú ä å ¿
³ ³LIMIT = arithmetic-expression-1³ ³
DELETE ³( ãïïïïï â )³ data-name-1
ïïïïïï ³ï ³NO LIMIT ³ ï³
À æïï ïïïïï ç Ù
WHERE selection-expression-1
ïïïïï
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
LIMIT or NO LIMIT
These options indicate the number of entities deleted. With the NO LIMIT option, all
entities designated by selection expressions will be deleted. If neither of these options is
specified, the default is one. An exception is produced if the limit is exceeded.
arithmetic-expression-1
data-name-1
WHERE selection-expression-1
This clause is a global selection expression that applies to the entire query.
ON EXCEPTION
This option is described under “Handling SIM Exceptions” later in this section.
Examples
The following are examples of the DELETE statement.
This example shows the DELETE statement with a WHERE clause. The name Fred Jones
is removed from the list of project employees. Note that his name still exists as an
EMPLOYEE and as a PERSON in the database.
The following example shows the DELETE statement with a WHERE clause that contains
a CURRENT function. All managers are removed who fit the condition specified by
MANAGER. Note that a deleted manager still exists in the EMPLOYEE and PERSON
classes.
The following example shows the DELETE statement with a LIMIT option. The statement
deletes all projects with a project number less than 100. If there are more than 5 projects
with project numbers less than 100, no projects are removed.
The following example shows the DELETE statement with a NO LIMIT option. The
statement deletes all managers. The names of the managers still exist in the PERSON and
EMPLOYEE classes.
DMSTATE is a database status word that is associated with each COBOL74 program that
accesses a SIM database. The value of DMSTATE indicates whether an exception has
occurred and specifies the nature of the exception. You can also obtain additional or
specific information about exceptions by using the CALL SYSTEM statement.
The following pages explain the DMSTATE database status word, the CALL SYSTEM
statement, and methods for handling exceptions.
For information on exception category values and mnemonics, refer to the InfoExec SIM
Programming Guide.
DMSTATE Statement
The value of the DMSTATE database status word is set by the system at the completion of
each data management statement. This value indicates whether an exception has occurred
and the nature of the exception.
If you do not specify a field for the DMSTATE database status word, a value of TRUE is
returned if an error has occurred.
Úä å ¿
³³DMEXCEPTION ³ ³
³³ïïïïïïïïïïï ³ ³
³³DMSUBEXCEPTION ³ ³
³ãïïïïïïïïïïïïïï â ³ OF DMSTATE
³³DMMOREEXCEPTION³ ³ ïï ïïïïïïï
³³ïïïïïïïïïïïïïïï³ ³
³³DMUPDATECOUNT ³ ³
Àæïïïïïïïïïïïïï ç Ù
VALUE category-mnemonic
ïïïïï
DMEXCEPTION
This option yields a numeric value identifying a major error category involved in the
exception.
DMEXCEPTION can be compared to major error category mnemonics with the VALUE
phrase.
DMSUBEXCEPTION
This option yields a numeric value that identifies the subcategory of the major error
category involved in the exception.
DMMOREEXCEPTION
DMUPDATECOUNT
This option yields a numeric value that identifies the number of entities updated. When no
entities are updated, the value of DMUPDATECOUNT is 0 (zero).
General Format
The general format of the CALL SYSTEM statement is as follows:
ä å
³DMEXCEPTIONMSG GIVING data-name-1³
³ïïïïïïïïïïïïïï ïïïïïï ³
CALL SYSTEM ãDMNEXTEXCEPTION â .
ïïïï ïïïïïï ³ïïïïïïïïïïïïïïï ³
³DMEXCEPTIONINFO ³
æïïïïïïïïïïïïïïï ç
DMEXCEPTIONMSG
This system name causes the system text associated with the current exception to be
moved into data-name-1.
data-name-1
This format element is the required parameter for the DMEXCEPTIONMSG system name
and must be a PIC X DISPLAY item of at least 156 characters. The message returned is
formatted in two 78-character lines.
DMNEXTEXCEPTION
This system name causes the next exception in a multiple error list to become the current
exception.
DMEXCEPTIONINFO
This system name updates the DMEXCEPTIONINFO structure with additional information
concerning the present exception. (The DMEXCEPTIONINFO structure is built into the
program by the compiler.) You access the structure as a group item and access the
subfields of the structure for specific information. For a list of the fields of the structure
and an explanation of the information they contain, refer to the InfoExec SIM
Programming Guide.
RETRIEVE MAN-QUERY.
IF DMSTATE
CALL SYSTEM DMEXCEPTIONMSG GIVING OUT-TEXT
DISPLAY OUT-TEXT
CALL SYSTEM DMEXCEPTIONINFO
IF DMMOREEXCEPTIONS OF DMSTATE
CALL SYSTEM DMNEXTEXCEPTION
CALL SYSTEM DMEXCEPTIONMSG GIVING OUT-TEXT
DISPLAY OUT-TEXT.
MOVE DMEXCEPTIONINFO
TO WS-A.
DISPLAY DMSTRUCTURENAME
OF DMEXCEPTIONINFO.
ON EXCEPTION Option
The ON EXCEPTION option can be placed after particular data management statements
to handle exceptions. These statements include the following:
ABORT-TRANSACTION INCLUDE
ASSIGN OPEN
BEGIN-TRANSACTION RETRIEVE
CLOSE SELECT
DELETE SET
EXCLUDE
General Format
The general format of the ON EXCEPTION option is as follows:
Ú ä å ¿
³ ³imperative-statement-1 ³ ³
³ON EXCEPTION ãconditional-statement-1â ³ .
³ ïïïïïïïïï ³NEXT SENTENCE ³ ³
À æïïïï ïïïïïïïï ç Ù
These format elements are executed if an exception occurs. Refer to Volume 1 for
information about these statements.
Example
The following is an example of the ON EXCEPTION option:
RETRIEVE DEPT-Q
ON EXCEPTION
GO TO PARA-EXIT.
The DMERROR Use procedure is called each time an exception occurs during the
execution of a data management statement, unless an ON EXCEPTION option is
associated with the statement. Control is returned from the DMERROR Use procedure to
the statement following the data management statement that encountered the exception.
The DMERROR Use procedure can appear by itself or in any order with other Use
procedures in the DECLARATIVES SECTION. Only one DMERROR Use procedure can be
declared in a COBOL74 program. The DMERROR Use procedure cannot contain GO TO
statements that reference labels outside the procedure.
If both a DMERROR Use procedure and an ON EXCEPTION option are used, the ON
EXCEPTION option takes precedence, and the DMERROR Use procedure is not executed.
Example
The following example shows the declaration of the DMERROR Use procedure:
DECLARATIVES.
DMERR-SECT SECTION.
USE ON DMERROR.
DMERR-PARA.
IF DMEXCEPTION OF DMSTATE = VALUE DMCOMPLETE
THEN ...
END DECLARATIVES.
In the sample program in Example 8–1, you can add or drop a project for employees in the
database. If you choose to drop a project, the program completes all related assignments
by recalculating the ratings of project employees. The program then updates the overall
ratings for those employees.
The code in this sample program shows how to use single-statement and
multiple-statement updates, tabular retrieval, and the AVERAGE and CURRENT functions.
000100 ID DIVISION.
000200 ENVIRONMENT DIVISION.
000300 CONFIGURATION SECTION.
000400 SPECIAL-NAMES. RESERVE SEMANTIC.
000500 DATA DIVISION.
000600 DATA-BASE SECTION.
000600 DB PROJEMPDB = "ORGANIZATION" VALUE OF DBKIND IS SEMANTIC.
000700 QD PEMP-Q OF PROJECT-EMPLOYEE.
000800 QD ASSI-Q.
000900 01 ASSI-Q-REC.
001000 02 ASSI-START-DATE PIC X(10).
001100
001200 WORKING-STORAGE SECTION.
001300 01 PROJECT-INDICATOR PIC X(4).
001400 88 PROJ-ADD VALUE "ADD".
001500 88 PROJ-DROP VALUE "DROP".
001600 01 PROJ-NUM PIC 9(11) BINARY.
001700 01 SS-NUM PIC 9(11) BINARY.
001800 01 INPUT-RATING PIC 9V9.
001900
002000 PROCEDURE DIVISION.
002100 BEGIN.
002200 OPEN UPDATE PROJEMPDB.
002300
002400******************************************************************
002500* Input the project indicator, project number, and social *
002600* security number. *
002700******************************************************************
002800 BEGIN-TRANSACTION.
002900 START MODIFY PEMP-Q WHERE PERSON-ID EQUAL SS-NUM.
003000 IF PROJ-ADD THEN
003100 INCLUDE PROJECT WITH PROJECT-NO EQUAL PROJ-NUM
Example 8–2 shows a sample program that cleans up the database by removing
assignments that were completed at least five years ago. The assignments are stored on
tape.
The sample program shows hybrid retrieval including program formats, and extended
attributes in both tabular and structured form.
000100 ID DIVISION.
000200 ENVIRONMENT DIVISION.
000300 CONFIGURATION SECTION.
000400 SPECIAL-NAMES. RESERVE SEMANTIC.
000500 DATA DIVISION.
000600 DATA-BASE SECTION.
000700 DB PROJEMPDB= "ORGANIZATION" VALUE OF DBKIND IS SEMANTIC.
000800
000900 QD PEQ.
001000 01 PEQ-REC.
001100 02 PEQ-NAME PIC X(20).
001200 02 PERSON-ID PIC 9(11) BINARY.
001300 02 DEPT PIC X(20).
001400 QD AQ.
001500 AQ-REC.
001600 02 AQ-START-DATE PIC X(10).
001700 02 AQ-END-DATE PIC X(10).
001800 02 AQ-EST-PERSON-HOURS PIC 9V9.
001900 02 AQ-RATING PIC 9(2)V9.
002000 WORKING-STORAGE SECTION.
002100 01 DEADLINE PIC X(8) VALUE "01/01/85".
002200 01 OUT-TEXT PIC X(156).
002300
002400 PROCEDURE DIVISION.
002500 BEGIN.
002600 OPEN UPDATE PROJEMPDB.
002700 BEGIN-TRANSACTION.
002800 SELECT PEQ FROM PROJECT-EMPLOYEE
002900******************************************************************
003000* PERSON-ID does not need to be specified in the mapping list *
003100* because the name of field is the same as the name of the *
003200* immediate attribute. *
003300******************************************************************
003400 ( PEQ-NAME = LAST-NAME OF NAME,
003500
003600******************************************************************
003700* DEPT is retrieved in tabular form with the rest of the *
003800* immediate attributes. *
003900******************************************************************
004000 DEPT = DEPT-TITLE OF DEPT-IN,
004100 SELECT AQ FROM ASSIGNMENT-RECORD
004200******************************************************************
004300* The assignment attributes are retrieved as a substructure of *
004400* PROJECT-EMPLOYEE. *
004500******************************************************************
004600 ( AQ-START-DATE = START-DATE,
004700 AQ-END-DATE = END-DATE,
004800 AQ-EST-PERSON-HOURS = EST-PERSON-HOURS,
004900 AQ-RATING = RATING ) )
005000 WHERE SOME ( END-DATE OF ASSIGNMENT-RECORD ) BEFORE DEADLINE.
005100 PERFORM DO-EMPLOYEE THRU DO-EMPLOYEE-EXIT UNTIL DMSTATE.
005200 END-TRANSACTION.
005300 CLOSE PROJEMPDB.
005400 STOP RUN.
005500
005600 DO-EMPLOYEE.
005700 RETRIEVE PEQ
005800 ON EXCEPTION
005900 GO TO DO-EMPLOYEE-EXIT.
006000******************************************************************
006100* Write the employee information on tape. *
006200******************************************************************
006300 PERFORM DO-ASSIGNMENT THRU DO-ASSIGNMENT-EXIT UNTIL DMSTATE.
006400
006500 DO-EMPLOYEE-EXIT.
006600 EXIT.
006700
006800 DO-ASSIGNMENT.
006900 RETRIEVE AQ
007000 ON EXCEPTION
007100 IF DMEXCEPTION OF DMSTATE NOT = VALUE DMCOMPLETE THEN
007200 CALL SYSTEM DMEXCEPTIONMSG GIVING OUT-TEXT
007300 DISPLAY OUT-TEXT
007400 GO TO DO-ASSIGNMENT-EXIT
007500 ELSE
007600 GO TO DO-ASSIGNMENT-EXIT.
007700******************************************************************
007800* Write the assignment information to tape. *
007900******************************************************************
008000 DELETE ASSIGNMENT WHERE ASSIGNMENT EQUAL CURRENT OF AQ.
008100
008200 DO-ASSIGNMENT-EXIT.
008300 EXIT.
The sample program shows how to use transitive closure and the related SET statements.
000100 ID DIVISION.
000200 ENVIRONMENT DIVISION.
000300 CONFIGURATION SECTION.
000400 SPECIAL-NAMES. RESERVE SEMANTIC.
000500 DATA DIVISION.
000600 DATA-BASE SECTION.
000700 DB PROJEMPDB = "ORGANIZATION" VALUE OF DBKIND IS SEMANTIC.
000800 QD PQ.
000900 01 PQ-REC.
001000 02 PQ-TITLE PIC X(30).
001100 QD SQ.
001200 01 SQ-REC.
001300 02 SQ-TITLE PIC X(30).
001400 WORKING-STORAGE SECTION.
001500 01 MASTER-PROJECT PIC X(30).
001600 01 KOUNTER PIC 9(11) BINARY VALUE 0.
001700 01 DONE-STATUS PIC X(3).
001800 88 NOT-DONE VALUE "NO".
001900 88 ALL-DONE VALUE "YES".
002000
002100 PROCEDURE DIVISION.
002200 MAIN.
002300 OPEN PROJEMPDB.
002400******************************************************************
002500* Enter the MASTER-PROJECT. *
002600******************************************************************
002700 SELECT PQ FROM PROJECT
002800 ( PQ-TITLE = PROJECT-TITLE
002900 SELECT SQ FROM TRANSITIVE( SUB-PROJECTS )
003000 ( SQ-TITLE = PROJECT-TITLE ))
003100 WHERE PROJECT-TITLE OF PROJECT EQUAL MASTER-PROJECT.
003200 RETRIEVE PQ
003300 ON EXCEPTION
003400 DISPLAY "NO SUCH PROJECT"
003500 GO TO MAIN-END.
003600 MOVE "NO" TO DONE-STATUS.
003700 PERFORM GET-SUBPROJECT UNTIL ALL-DONE.
003800
003900 MAIN-END.
004000 CLOSE PROJEMPDB.
004100 STOP RUN.
004200
004300 GET-SUBPROJECT.
TransIT Open/OLTP for ClearPath HMP NX and A Series enables an application program
to update multiple DMSII databases in a coordinated fashion. That is, TransIT Open/OLTP
for ClearPath HMP NX and A Series ensures that either all updates are committed or all
are rolled back. Pre-TransIT Open/OLTP for ClearPath HMP NX and A Series (traditional
online transaction processing) software enables an application to update multiple
databases, but it is the responsibility of the application program to coordinate the updates
and the recoveries of those databases.
TransIT Open/OLTP for ClearPath HMP NX and A Series also implements a client/server
model. Clients invoke services but do not update the databases directly. Service providers
can provide multiple services where a service is used to update a DMSII database. The
client/server model applies to COMS online programs only because the implementation of
services is provided by COMS.
TransIT Open/OLTP for ClearPath HMP NX and A Series is based on the X/Open
Distributed Transaction Processing (DTP) model, which is specified in standards
developed by the X/Open Company, Ltd.
Example
The following example shows the logic for a client:
Open databases.
Close Databases.
Section 3, “Using the COMS Program Interface,” of this manual, describes the following
service functions related to the XATMI interface:
• GET_BUFFER_DESIGNATOR
• GET_DESIGNATOR_USING_DESIGNATOR
• GET_ERRORTEXT_USING_NUMBER
• GET_INTEGER_USING_DESIGNATOR
For More Information
For complete information about creating applications that can use TransIT Open/OLTP for
ClearPath HMP NX and A Series software, refer to the TransIT Open/OLTP for ClearPath
HMP NX and A Series Programming Guide.
A user-defined word is a COBOL74 word that must be supplied by the user to satisfy the
format of a clause or statement. Each character of a user-defined word is selected from
the set of characters A through Z, 0 through 9, and the hyphen (-). The hyphen cannot
appear as the first or last character of a word.
A list of the words that you can define is shown below. For detailed information about
user-defined words, refer to Volume 1.
alphabet-name cd-name
COMS-header-name condition-name
data-name family-name
file-name formlibrary-name
form-name group-list-name
index-name level-number
library-name mnemonic-name
paragraph-name program-name
record-name report-name
routine-name section-name
segment-number text-name
conditional expressions
in SIM, 8-36
D
CONFIRMFLAG COBOL74 field name
DASDL, See Data and Structure Definition
in COMS, 3-9
Language (DASDL)
CONFIRMKEY COBOL74 field name
data alias
in COMS, 3-9
using the INVOKE clause in, 2-4
constant
Data and Structure Definition Language
in Primary clause in SIM, 8-46
(DASDL)
control items
in DMSII
inquiring about in TPS, 5-16
data sets, 4-11
conversation area
link items, 4-22
in COMS header declaration, 3-4
naming, 4-2
using SDF interface with COMS, 6-10
in TPS, sample program for, 5-29
CONVERSATION AREA option
data communications interface (DCI) library
in COMS header declaration, 3-5
example of library object, 3-15
CONVERT_TIMESTAMP service function
in COMS
parameters in COMS, 3-32
linking program, 3-11
count attribute
in DMSII
in DMSII, 4-23
for BEGIN-TRANSACTION
Count field
statement, 4-32
in DMSII, 4-23
for END-TRANSACTION statement, 4-46
COUNT function
parameters for, 3-13
in SIM, 8-29
DATA DIVISION of a program
CP 2000 station
invoking files and records from, 2-12
in COMS delivery confirmation, 3-10
data items
CREATE statement
qualifying in DMSII, 4-4
in DMSII, 1-4, 4-39
qualifying in TPS, 5-14
in TPS
data management (DM) attributes, 4-23
initializing a transaction record, 1-6
count attribute in, 4-23
initializing transaction record
in DMSII, 1-4, 4-23
formats, 5-8
population attribute in, 4-25
CREATETRUSER entry point
record type attribute in, 4-24
parameters in TPS, 5-21
data management (DM) expressions
CURRENT function, 8-15
formats in SIM, 8-40
in SIM
data management statements
used with queries, 8-15
in DMSII, 4-28
CURRENT option
Data Management System II (DMSII), 4-1
in DMSII
accessing an established database, 4-63
for REMOVE statement, 4-67
Accessroutines, 5-26
CURRENT special construct
used with TPS, 5-26, 5-27
in SIM, 8-31
ALL clause
in Primary clause, 8-46
in database declaration, 4-7
CURRENT-DATE function
and COMS
in SIM, 8-33
ABORT-TRANSACTION statement, 4-28
date type representation, 8-10
BEGIN-TRANSACTION statement, 4-32
CURRENT-TIME function
DMTERMINATE statement, 4-45
in SIM, 8-34
END-TRANSACTION statement, 4-46
time type representation, 8-10
statements used with, 3-2
cursor positioning
AND operator in GENERATE
in SDF, 6-12
statement, 4-53
ASSIGN data management statement, 4-29
effect on Count field, 4-23
PRODUCTION status
P in ADDS, 2-2
in SIM, 8-7
page flag
Program Designator field name
in SDF, 6-13
input header in COMS, 3-7
page specification
program interfaces
using in the COMS SEND statement,
as COBOL74 extensions, 1-1
example of, 3-25
extensions, by product (list), 1-2
parameters
general concepts of, 1-1
in DCIENTRYPOINT library object, 3-13
with combined products, 1-1
in TPS
with COMS, 3-1
passing transaction record variables
program tracking
in, 5-10
in ADDS, 2-6
passing with COBOL74 constructs, 5-19
PROGRAMDESG COBOL74 field name
received by update library, 5-24
input header in COMS, 3-7
partitioned structure
PROGRAM-DIRECTORY option
in DMSII, 4-80
for program tracking in ADDS, 2-7
password
programmatic controls
in DCIENTRYPOINT library object
in SDF
parameter length, 3-13
control information (table), 6-12
pattern matching
flag settings, 6-11, 6-12
in SIM, 8-39
flag suffixes (table), 6-12
special characters (table), 8-39
generating flag groups, 6-13
using IS IN operator in, 8-39
naming conventions for, 6-11
peripherals
resetting flags, 6-14
using symbolic sources and destinations
sample program using, 6-20
with, 3-13
PROGRAM-NAME option
perspective
for program tracking in ADDS, 2-6
in SIM
PROGRAM-VERSION option
multiple, 8-13
for program tracking in ADDS, 2-7
single, 8-12
PURGETRUSER parameters
placing program in transaction state, 5-26
in TPS, 5-21
plus (+) operator
in DMSII
for GENERATE statement, 4-53
population attribute Q
in DMSII, 4-25
of a DMSII structure, 4-23 QD, See query declaration
POS function qualification
in SIM, 8-32 in DMSII
PREDECESSOR function of set and data set names, 4-2
in SIM, 8-33 in SIM
Primary clause multiple perspective, 8-13
in SIM, 8-46 single perspective, 8-12
PRIOR option in TPS
in DMSII data items, 5-14
for selection expression, 4-20 requirements for (list), 5-15
PROCESSTRANSACTION parameters Qualification Term clause
in TPS, 5-21 in SIM, 8-47
PROCESSTRFROMTANK parameters quantifiers
in TPS, 5-21 in SIM, 8-30
PROCESSTRNORESTART parameters query
in TPS, 5-21 in SIM
X
XATMI buffer
LENGTH, 3-39
type and subtype, 3-42