Sunteți pe pagina 1din 99

Essential IDMS

Bhooshan Nagaokar
June 2003

This book is a handy guide for IDMS developers. It contains concise explanation of concepts
and a guide to IDMS DML. It also contains error categorization and interpretation. At the end,
it contains a useful glossary of IDMS specific terms. The content in this book has been
collected from various sources, and much of its structure has arisen from technical notes
prepared by me during IDMS projects.

Bhooshan Nagaokar 1
Essential IDMS

TABLE OF CONTENTS
1.0 INTRODUCTION......................................................................................................................................4

2.0 AREA ..........................................................................................................................................................5

3.0 PAGE ..........................................................................................................................................................6

4.0 DB-KEY......................................................................................................................................................8

5.0 RECORD ....................................................................................................................................................9


5.1 RECORD TYPE & OCCURRENCE ................................................................................................................9
5.2 RECORD NAME .........................................................................................................................................9
5.3 RECORD IDENTIFICATION ..........................................................................................................................9
5.4 STORAGE MODE......................................................................................................................................10
5.5 RECORD LENGTH ....................................................................................................................................10
5.6 LOCATION MODE ....................................................................................................................................10
5.7 AREA NAME............................................................................................................................................11
6.0 SET............................................................................................................................................................12
6.1 SET TYPE AND OCCURRENCE ...................................................................................................................12
6.2 SET NAME...............................................................................................................................................12
6.3 SET MODE ..............................................................................................................................................12
6.4 SET LINKAGE ..........................................................................................................................................13
6.5 SET ORDER .............................................................................................................................................14
6.6 SET MEMBERSHIP ...................................................................................................................................15
6.7 RECORD LIFE CYCLE ..............................................................................................................................17
6.8 SET REPRESENTATION.............................................................................................................................19
6.9 EMBEDDED POINTERS .............................................................................................................................21
6.10 SET PATTERNS ........................................................................................................................................22
7.0 CURRENCY.............................................................................................................................................24

8.0 ACCESS RESTRICTION .......................................................................................................................26

9.0 NOTES ......................................................................................................................................................27


AREA SWEEP .......................................................................................................................................................27
CALC SET ............................................................................................................................................................28
EMPTY SET, UNCONNECTED RECORDS ................................................................................................................29
CONNECTION ......................................................................................................................................................29
MULTIPLE RECORD-TYPE RETRIEVALS ................................................................................................................30
FOREIGN KEYS ....................................................................................................................................................30
10.0 DML STATEMENTS ..............................................................................................................................31
10.01 OBTAIN CALC ................................................................................................................................33
10.02 OBTAIN DUPLICATE.....................................................................................................................34
10.03 OBTAIN DB-KEY............................................................................................................................36
10.04 OBTAIN OWNER ............................................................................................................................37
10.05 OBTAIN WITHIN SET ....................................................................................................................39
10.06 OBTAIN WITHIN AREA.................................................................................................................41
10.07 OBTAIN CURRENT ........................................................................................................................43
10.08 OBTAIN WITHIN USING ...............................................................................................................44
10.09 FIND & GET .....................................................................................................................................46

Bhooshan Nagaokar 2
Essential IDMS
10.10 MODIFY ...........................................................................................................................................48
10.11 STORE ..............................................................................................................................................50
10.12 ERASE ..............................................................................................................................................52
10.16 IF EMPTY.........................................................................................................................................53
10.17 IF MEMBER .....................................................................................................................................55
10.18 CONNECT ........................................................................................................................................56
10.19 DISCONNECT .................................................................................................................................58
10.20 ACCEPT ...........................................................................................................................................60
10.21 RETURN...........................................................................................................................................62
10.22 BIND RUN-UNIT .............................................................................................................................63
10.23 BIND RECORD ................................................................................................................................65
10.24 READY .............................................................................................................................................66
10.25 COMMIT ..........................................................................................................................................68
10.26 ROLLBACK .....................................................................................................................................69
10.27 FINISH..............................................................................................................................................70
12.0 ERROR CODES ......................................................................................................................................71
12.1 MAJOR ERROR CODES .............................................................................................................................71
12.2 MINOR ERROR CODES .............................................................................................................................73
12.3 COMMON ERRORS (MINOR CODES AND INTERPRETATION) .....................................................................77
12.3 COMMON ERRORS (MAJOR MINOR).....................................................................................................84
13.0 GLOSSARY..........................................................................................................................................90

14.0 SAMPLE PROGRAM .............................................................................................................................95

Bhooshan Nagaokar 3
Essential IDMS

1.0 INTRODUCTION
IDMS (Integrated Data management System) is a network database.

IDMS was developed by Cullinet Software Inc. It was enhanced and is currently supported by
Computer Associates (CA). Initially IDMS was developed to run on IBM mainframes.
However versions for other environments are currently available.

A network data model is regarded as an extension of hierarchical model. There is a subtle


difference between the two models. In a hierarchic model a child record is associated with
only one type of parent record. In a network model it can be associated with many types. In
both models a child is not associated with more than one parent records in a single
relationship.

IDMS database is a collection of records of different types and relationships between them.
Records are stored in pages and are related to each other through embedded links. Records
are accessed on hashed keys or via a relationship. Indexes are also stored in pages and they
provide direct and ordered access on key values. A contiguous sequence of pages makes up a
larger unit of space called area. Areas are mapped onto physical datasets or files. A number of
files make up a database.

IDMS database definition is available to an application through schema and subschema.


IDMS database is accessed by commands or statements of Data Manipulation Language
(DML). The DML statements enable a variety of access operations to perform navigation and
manage relationships. The DML statements can be invoked using on-line utilities like DMLO
or can be embedded in application programs. IDMS DML statements can be categorized as:
Control, Retrieval, Modification and Save operations.

Each application when in execution builds addressability with IDMS. It then issues DML calls
to IDMS. IDMS accesses the necessary records and populates record-structures in
applications variable storage area. The subschema control forms a vital interface between the
application and IDMS.

Bhooshan Nagaokar 4
Essential IDMS

2.0 AREA
A database space is divided into logical areas. An area is a range of contiguous pages i.e.
without any numeric gaps between the lowest and highest page number. Within a database
there may be gaps between page-ranges of different areas. Page ranges of different areas
within the database are not allowed to overlap which means a page can belong to one and
only one area.

Each area is permitted to have its own page-size, but all pages in an area must be of the same
size. It is often convenient to have pages of all areas in the database of the same size. An area
can hold record-occurrences of many different record-types, however occurrences of the same
record-type can reside only in the area designated to it.

Area is a logical unit of space and is mapped onto physical files of datasets. Usually one area
is mapped onto one file. If an area is small then a number of such areas are mapped onto a
single file. On the other hand if an area is large then it is mapped onto many files. A collection
of all files that have all areas mapped onto them is a database. A database has a unique 8-
character id to distinguish itself from other databases.

Areas allow applications to deal with information that it requires and ignore that which it does
not. Division of database into areas allows an application to focus on fewer information
objects rather than database as a whole; this implies that an application uses fewer resources
during database access (e.g.: currencies).

Areas provide significant advantage during database access. It is possible to access or sweep
all records of same or different types in an area. Area-sweeps are efficient access processes,
require fewer resources, and provide improved performance. Areas also provide data
separation and hence automatic security; sensitive information can be automatically and
effectively protected from being accessed by applications that do not have required rights for
that area.

The number of pages assigned to an area would depend on two factors: record-types that are
associated with the area and maximum number of record-occurrences for each of the record-
type. An estimate of data volumes for all record-types in an area is therefore essential before
areas are configured. Indexes are often placed in a separate area; this allows IDMS to optimize
their access and storage space. Smaller areas provided improved backup and recovery
performance.

Bhooshan Nagaokar 5
Essential IDMS

3.0 PAGE
The database comprises of a number of pages that are numbered sequentially. A page is a
space on DASD that holds data. It is the smallest unit of data transfer between the auxiliary
and main memory. Page-size is determined at database configuration time and can only be
changed when database is reorganized. Page-sizes are typically between 2k and 4k, though
they can be less or more than these values.

All records of a database are stored in pages. Each page in the database has a unique page
number by which it can be directly accessed. Each record in a page has a unique line-index
number assigned to it. Hence a combination of page-number and line-number can provide
direct addressability to every record in the database. A page can potentially hold records of
different types and sizes.

Small page-sizes provide some advantages. It takes less time to read or write a page. For the
same total space smaller page-sizes would mean more number of pages; this enables hashing
algorithm to distribute records better and greatly reduces chances of collision (algorithmically
mapping more records onto the same page).

Large page-sizes provide certain other advantages. They reduce the number of I/Os when
whole areas are to be accessed; this is favorable for batch jobs dealing with large data
volumes. Large page-sizes imply that more data is transferred between auxiliary & main
memory, hence more record-occurrences handled in a single I/O. They reduce the possibility
of records overflowing into adjacent pages during collision. They also allow formation of
large VIA clusters thereby placing more member records in the same page as their owners;
this provides better performance while walking a set.

Each page comprises of a page-header, a page-body containing records, a page-index and a


page-footer. The details are as follows.

Page-header: This comprises of page number (4 bytes), next pointer for calc-set (4
bytes), prior pointer for calc-set (4 bytes), space available count (2 bytes), and unused
field (2 bytes)

Page-body: This comprises of 0-n record-occurrences, data is concentrated at


beginning of Page Body.

Page-index: This comprises of variable number of line index entries and Page number.
Each line index entry comprises of record identifier (4 bytes), displacement from start
of page, length of record and length of prefix. As the number of occurrences in page
grows, line index entries grow from end of page backwards. Once a line index is
created it remains in the page as long as the page exists. If the record-occurrence
associated with the line index is deleted, the entry still continues to remain in the page.
When a new occurrence comes into creation this unused entry gets allocated to it.

Bhooshan Nagaokar 6
Essential IDMS

Page-footer: This comprises of Line index for SR1 record (8 bytes), line space count
(2 bytes), page update count (2 bytes), and page number (4 bytes).

Bhooshan Nagaokar 7
Essential IDMS

4.0 DB-KEY
Database key or db-key is the unique identifier for each record-occurrence in the database. It
comprises of two components: page number and line-index number. A page number
represents a unique address of a page in the database, a line index number represents a unique
numeric value assigned to each record residing in a page. This combination of page number
and line index number is a unique address of a record-occurrence within a database and does
not change as long as the record exists in the database or the database is reorganized.

A db-key is a binary numeric value and occupies 4 bytes (or 32 bits). The internal structure of
db-key is such that high-order 23 bits represent page number and low-order 8 bits represent
line index number, the sign-bit of a db-key is unused. In such a configuration a db-key can
address 8,388,607 pages and a maximum of 255 occurrences within a page. For COBOL
programs the db-key is held in variables with PIC S9(8) COMP.

In an application, records that are related to each other can be accessed very efficiently using
their db-keys. Also, db-keys of accessed records can be saved in variable-storage. These saved
db-keys can be used to access their respective records at later time in the application; can be
passed across later phases or even between different programs.

Bhooshan Nagaokar 8
Essential IDMS

5.0 RECORD
A record is the basic addressable unit of data in IDMS database. It has an internal structure
for data and is related to one of the defined types in the database. It can be located in different
ways and contains links to related records.
________________________________________________________________________

5.1 Record Type & Occurrence

Record-type is the structural component that conveys form and characteristics of a single
information entity. It is a generic group of record-occurrences in the database that are similar
in form. It is synonymous to file or file structure that traditional models refer to. Record-type
is a definition in terms of some important properties such as: record-name, record-structure,
record-size, location-mode, calc-key names, via-set name and area of storage.

Record-occurrence is the actual content of data stored in the database. It is the substance of
information that is used by applications. An occurrence is the basic addressable unit of data in
the database and is always related to a record-type. It is either fixed or variable in length. A
record-occurrence as a term is synonymous to data records of traditional models or a row
of information of the relational model.

Record-occurrence has two components: Data & Prefix. Data component is a set of
bytes that represents information content required by applications. It has an internal
structure as defined in the database design and comprises of group and elementary
fields. Prefix component comprises of links or pointers that refer to physical location
of related records. The pointers in prefix are db-keys and provide direct addressability
and quickest access to related records.
_________________________________________________________________________

5.2 Record Name

Each record-type in the database has a unique 1 to 16-character name that begins with an
alphabetic character. The record-name is also the data-name of the record in variable-storage
of an application. It record-name identifies record description that DMLC copies in the
variable-storage during compilation. It is the name that is used to refer a record-type in DML
statements.
_________________________________________________________________________

5.3 Record Identification

Each record-type in the database has an internal identifier for a record-type. This identifier is a
number from 100 through 9999. It has no significance in the application program or in the
DML statement.
_________________________________________________________________________

Bhooshan Nagaokar 9
Essential IDMS

5.4 Storage Mode

Each record-type in the database has a storage mode that indicates the length of records.
Storage mode can either be Fixed or Variable. Further storage mode can be qualified as
uncompressed or compressed. The following are permissible storage modes.

Mode Description
F Fixed (uncompressed)
V Variable (uncompressed)
FC Fixed Compressed
VC Variable Compressed
________________________________________________________________________

5.5 Record Length

Record-length signifies length of data for records. For Fixed length records it is the actual
length of data. For Variable length records it is the maximum or average length of data.
Record-length is expressed in bytes.
_________________________________________________________________________

5.6 Location Mode

Each record-type is assigned a location mode. It suggests the method used to locate an
occurrence of a specific record-type. It also suggests the way IDMS decides the location of a
record occurrence at creation time. Location mode for a record-type can be CALC, VIA or
DIRECT. In very large databases the ratio of record-types with CALC to VIA location modes
is almost 1:1. The use of DIRECT location mode is rare.

CALC: For this location mode, a record is stored on or near a page calculated by
IDMS. Using the calc-key value, IDMS uses hashing algorithm to determine
the page number onto which the record is mapped. The algorithm effectively
distributes records across the database area. If many records are mapped onto
the same page then it is likely that the page may not accommodate all records
that get mapped onto it. In such cases IDMS stores those records onto adjacent
pages and uses a calc-set to link such records.

IDMS permits calc-key values to be duplicates or no duplicates. If duplicates


are permitted then they have an additional qualifier that directs IDMS to store
duplicates before or after all records with similar calc-key value. The options
for CALC thus are:
DN - duplicates Not Allowed
DF - duplicates Allowed, stored First
DL - duplicates Allowed, stored Last

Bhooshan Nagaokar 10
Essential IDMS
VIA: For this location mode, member records are stored closer to their respective
owner records with the purpose of minimizing I/Os during access. VIA
location mode suggests that IDMS forms a group of records that are likely to
be retrieved at the same time and stores them on the same page or adjacent
pages to provide a very efficient access. All records on a VIA set-occurrence,
i.e. the owner and its members, reside on the same page or in the nearest
possible neighborhood.

DIRECT: For this location mode, records are placed in page as specified by
application program; in this case the data organization abilities of IDMS are
bypassed. DIRECT location mode is used when record needs to be accessed
directly but lacks a key field for uniquely identifying the record. This location
mode is used for storing records in physical sequential order. The use of this
location mode is rare and not recommended.
_________________________________________________________________________

5.7 Area Name

Each record is associated with an area of database in which all occurrences of it are stored. All
occurrences of a specific record-type are confined to the area that is assigned to it.

Bhooshan Nagaokar 11
Essential IDMS

6.0 SET
A set expresses a relationship between two record-types where one record-type is super-
ordinate and other is subordinate. In such a relationship the subordinate records are linked to
one another to form a group; the super-ordinate record owns such a group of super-ordinate
records. The super-ordinate record is called the owner and the subordinate records are called
members. Thus a set associates one owner with zero or more member records in a one-to-
many relationship (to be more precise one-to-zero-or-many relationship).

6.1 Set type and occurrence

A set-type is a structural definition of a set; it contains details of a relationship such as: how
are records in a set linked to each other, where do new records get placed when they come into
a relationship, and is it possible to disassociated member records from the relationship. Set-
type is thus a collection of such properties such as: name, mode, linkage, order and
membership. These properties are defined in the schema.

A set-occurrence is a collection of an owner record and its associated member records. For a
set there is one set-occurrence for each owner record. In some cases an owner record may not
have any member records associated with it; this is called an empty set. In some other cases
there may be member records in the database that are not associated to any owner record on a
set; these may later be associated with one of the owner records. In a set, whenever an owner
or a member record is accessed, the set occurrence in which these belong gains significance
from the applications point-of-view; many operations are then focused on that set-occurrence.
_________________________________________________________________________

6.2 Set Name

Every set in the database has a unique name assigned to it. It is recommended that set name
embeds the name of the owner and member record in some form. Most set names are prefixed
with S-; system-owned-indexed sets are often prefixed with IX- . Set-name is used to refer to
the set in DML statements.
_________________________________________________________________________

6.3 Set Mode

Set-mode specifies the physical implementation of a set-occurrence. It suggests the manner in


which owner and member records are linked to one another. IDMS either used embedded
links or an index to associate records in a set-occurrence. Hence set-mode is either
CHAINED or INDEXED.

CHAINED: In this mode, records in a set-occurrence are associated with each other
through embedded links. These links are in form of db-keys and are stored in the
prefix component of each record.

Bhooshan Nagaokar 12
Essential IDMS

INDEXED: In this mode, an index is used to link records in a set-occurrence.


Indexed sets have the same logical capabilities as chained sets but differ in their
implementation.

Chained sets allow IDMS to use embedded links to navigate forward, backward and to the
owner records in a set-occurrence. The links provide IDMS the fastest means of accessing
records. Chained sets can have sorted order for their occurrences. However chained sets are
inappropriate when applications require direct access to a member in a set-occurrence or
require ordered access to records based on key values. Indexed sets provide those advantages.

Indexed sets allow direct access on full or partial sort-key values. They also allow ordered
access to all set-occurrences. In most cases Indexed sets have sorted set-order, although other
set-orders are permissible. For sorted sets the value of the sort-key is maintained inside the
index, and can be made available by accessing only the index. Indexed sets allow alternate
access paths to all occurrences of a record-type.

Indexed sets are of two types: User-owned-indexed sets (also known as Pointer array Indexed
sets) and System-owned-indexed sets. These are be described as follows.

User owned: In user-owned-indexed sets, the owner and its respective members are
related using an index between them. For each owner record there is an index that
contains an association of sort-key values and links to the member records. The index
allows direct and ordered access to only the members related to the owner.

System Owned: In system-owned-indexed set, record-occurrences of specific record-


type are accessible using a system-owned-index. For such a set the owner is a
SYSTEM record SR7 that is always accessed and is invisible in the Schema. Each
system-owned-indexed set on a record-type would have an index in the database that
contains an association of sort-key values and links to record-occurrences.
_________________________________________________________________________

6.4 Set Linkage

Set Linkage specifies the type of embedded links or pointers that are contained in the prefix
each record. These links enable IDMS to access related records of a set-occurrence. Set
linkage can be a combination of NEXT, PRIOR, OWNER and INDEX. Permissible
combinations are N, NP, NO, NPO, I, IO - NPO is most often used for chained sets. The
explanation of each linkage is as follows.

NEXT: This implies that - the owner record contains db-key of the first member
record, each member record contains db-key of the next member record in set-
occurrence, and the last member record contains db-key of the owner record. This is a
default linkage and is required for Chained sets. This linkage cannot be specified for
Indexed sets.

Bhooshan Nagaokar 13
Essential IDMS

PRIOR: This implies that - the owner record contains db-key of the last member
record, each member record contains db-key of the previous or prior member record in
set-occurrence, and the first member record contains db-key of the owner record. This
linkage provides ability to navigate backwards and is strongly recommended for
Sorted Chained sets. It can be optionally specified for Chained sets but cannot be
specified for Indexed sets.

OWNER: This implies that each member record contains db-key of its owner record.
This linkage provides a direct access of owner from member records. Without the
OWNER linkage the owner record can be accessed from the member record; but to do
so IDMS must walk through the set till the last occurrence (or the first) to reach the
owner; this can be expensive. This linkage can be specified for Indexed as well as
Chained set.

INDEX: This implies that each member record contain pointer to its index entry. This
linkage can be specified for Indexed sets only.

_________________________________________________________________________

6.5 Set Order

Set-order specifies the placement of a record in a set-occurrence when it is created. The record
retains this physical position in a set-occurrence until it is deleted. The record can be
repositioned in the set-occurrence; when this occurs IDMS adjusts the linkages of preceding
and succeeding records in the chain. The set-order can be either FIRST, LAST, NEXT,
PRIOR or SORTED. For set-order LAST and PRIOR, it is essential to have a PRIOR set-
linkage.

FIRST: Placement of new record is before all existing member records

LAST: Placement of new record is after all existing member records

NEXT: Placement of new record is just after the most recently accessed record in a
set-occurrence - the record that is current of the set. If owner record is current of set,
the new record is placed before all existing members. If a member record is current the
set, the new member is placed next to that record.

PRIOR: Placement of new record is just before the most recently accessed record in a
set-occurrence - the record that is current of the set. If owner record is current of set,
the new record is placed after all existing members. If a member record is current the
set, the new member is placed prior to that record.

SORTED: Placement of new record is determined by sort field value. The sequence of
stored records can be ASC - ascending or DESC - descending. If the set-occurrence

Bhooshan Nagaokar 14
Essential IDMS
already contains records with the same value then the new record is placed as per the
options DF Duplicates First, DL Duplicates Last, or DN Duplicates Not
Allowed. The SORTED order allows a member record in a set-occurrence to be
retrieved directly using a sort field value; it also allows all member records in a set-
occurrence to be retrieved in the order of sort field value. This option can be specified
for Chained and Indexed sets.
_________________________________________________________________________

6.6 Set Membership

Set membership options provide possibilities for member records to move in and out of set-
occurrences. These options suggest the kind of operations permissible on set-occurrences
while creating, deleting, associating & disassociating member records. In some cases (such as
ERASE) these options suggest the nature of cascading operations on subordinate set-
occurrences. Membership options are of two types: REMOVAL and STORAGE.

REMOVAL: This option is also known as disconnect or erase option. The option may
suggests that member records currently in a set-occurrence would continue to be in it till they
are deleted The option may also suggest that a member record can be disassociated from a set-
occurrence it is currently in and continue to remain in the database. Removal option can either
be Mandatory or Optional.

Mandatory: Suggests that if a member is associated in a relationship with its owner


then it cannot be disconnected from such a relationship, and the only way to break the
relationship is to delete the member. Hence a member can be removed from a set-
occurrence only when erased.

Optional: Suggests that if a member is associated in a relationship with its owner it is


possible to break a member from that relationship and still let it continue to exist in the
database. Hence a member can be removed from a set-occurrence to possibly be
allowed participation in another set-occurrence.

STORAGE: This option is also known as connect option. The option suggests that either a
member record automatically participates in one of the set-occurrences at the time of its
creation, or that a member record doesnt participate in any set-occurrence at the time of its
creation, but can later be associated with one of them. Storage option can either be Automatic
or Manual.

Automatic: Suggests that a members relationship with its owner is built when the
member is created; this implies that the owner needs to be identified before the
member is created. The member participates in a set-occurrence at the time of creation.

Manual: Suggest that a members relationship with its owner need not materialize at
the time the member is created; this implies that the member can be created but still
need not participate in any set-occurrence. It can later be made to participate in one.

Bhooshan Nagaokar 15
Essential IDMS

A set can have one of the four possible membership options. They are as follows:

Option REMOVAL STORAGE Brief Description


MA Mandatory Automatic This is the default combination for a set and the
most rigid one. STORAGE-Automatic implies
that the owner has to be identified before a
member is created. The member is connected to
the owner at creation time. REMOVAL-
Mandatory implies that it is not possible to
disconnect a member, unless it is deleted
MM Mandatory Manual STORAGE-Manual implies that there is no need
to identify the owner at the time of creating a
member. The record can be created and can exist
as an unconnected member on the set. It can later
be connected to one of the owners. REMOVAL-
Mandatory implies that once connected the
member can never be disconnected, unless it is
deleted.
OA Optional Automatic STORAGE-Automatic implies the need to
identify the owner before a member is created.
The member gets connected to owner at creation
time. REMOVAL-Optional implies that it is
possible to disconnect a member and let it exist
as an unconnected record to be connected to
some other owner.
OM Optional Manual This is the most flexible combination. The
member remains unconnected at creation time
to be connected to an owner. Once connected, it
can be disconnected to be connected to another
owner.

Bhooshan Nagaokar 16
Essential IDMS

6.7 Record Life Cycle

Membership options can be understood in terms of life cycle of a record occurrence. A record
occurrence goes through 4 stages.

Stage 1: when it is created in the database


Stage 2: when it participates in a set-occurrence
Stage 3: when it disassociates itself from a set-occurrence
Stage 4: when it is deleted from the database.

The following diagram represents 4 stages in a records life cycle:

The Storage option plays a role in the first two stages i.e. creation and association. When
storage option is AUTOMATIC, it implies that Stage 1 and Stage 2 are combined in a single
operation. This means that the record is associated with its owner at the time of creation.
When storage option is MANUAL, it implies that IDMS permits Stage 1 and Stage 2 to exists

Bhooshan Nagaokar 17
Essential IDMS
as separate operations in time. Thus a record can be created and remain without participating
in any set-occurrence. Later it can be made to participate in a chosen one.

Similarly Removal option plays a role in the last two stages i.e. disassociation and deletion.
When removal option is MANDATORY, it implies that Stage 3 and Stage 4 are combined in
a single operation. This means that the record is disassociated only at the time of its deletion.
When removal option is OPTIONAL, it implies that IDMS permits Stage 3 and Stage 4 to
exist as separate operations in time. Thus a record can be disassociated from a set-occurrence
and still exist in the database. Later it can be deleted from the database.

Bhooshan Nagaokar 18
Essential IDMS

6.8 Set Representation

IDMS database design is represented in form of Bachman diagrams. These diagrams are
representations of records, sets and their various attributes and properties. The following
Bachman diagram represents a very simple database that has 2 records and a set between
them.

The above database design can be interpreted as follows:

Each record-type is represented as a box that contains its attributes. The attributes are arranged
in the following manner.
The first row specifies the record name in case of employee record the name is
EMPLOYEE.
The second row contains 4 columns. The first column is an internal record id
EMPLOYEE record has an id 2003. The second column specifies the storage mode
which can be one of the following: Fixed, Fixed compressed, Variable or Variable

Bhooshan Nagaokar 19
Essential IDMS
the employee records storage mode is F Fixed. The third column specifies
record length employee record is 60 bytes long. The fourth column specifies the
location mode that can be CALC, VIA or DIRECT employee records location
mode is CALC.
The third row specifies the CALC key if the location mode is CALC, or it specifies
the VIA set-name if the location mode is VIA. The employee records CALC key
is I2003-EMP-CODE.
The fourth row specifies the area name employee record resides in area DEPT-
AREA.

Each set-type is represented as an arrow. In case of system-owned index set, the arrow
commences with a triangle and points to a record-type. In case of a user-owned set, the arrow
connects two record-types it commences from the owner and ends at the member.

The attributes of a set are arranged in the following manner.


The first line specifies the set name in the above diagram there is a set S-DEPT-
EMP whose owner is DEPARTMENT and member is EMPLOYEE.
The second line specifies linkage, membership options and duplicates clause if the
order is sorted in the above diagram the set S-DEPT-EMP is chained and has
linkages NEXT, PRIOR and OWNER, it membership options are MANDATORY
MANUAL
The third line specifies order in the above diagram the order of S-DEPT-EMP is
SORTED on key I2003-EMP-NAME and duplicates are placed FIRST.

Bhooshan Nagaokar 20
Essential IDMS

6.9 Embedded Pointers

The following diagram is a representation of database structure for the record-types


DEPARTMENT and EMPLOYEE. It also shows how the set S-DEPT-EMP is implemented
for an occurrence that has one DEPARTMENT record and two EMPLOYEE records.

The above diagram represents a single set occurrence conforming to the database design.

The DEPARTMENT occurrence has two embedded links one a NEXT pointer pointing to
the first EMPLOYEE record and the other a PRIOR pointer pointing to the last EMPLOYEE
record in the set occurrence. PRIOR linkage is optional and if this linkage is absent the owner
would not have a PRIOR pointer.

Each EMPLOYEE record has three embedded links NEXT, PRIOR and OWNER pointers.
NEXT pointers in each EMPLOYEE record point to its next record in the chain, the last
EMPLOYEE records NEXT pointer points to the owner record. PRIOR pointers in each

Bhooshan Nagaokar 21
Essential IDMS
EMPLOYEE record point to its prior record in the chain, the first EMPLOYEE records
PRIOR pointer points to the owner record. OWNER pointers in each EMPLOYEE record
point to the owner DEPARTMENT record.

PRIOR and OWNER linkage is optional, and if these are not specified for the set then the
PRIOR and OWNER pointer are not present in each EMPLOYEE record.

6.10 Set Patterns

A database design can be represented in terms of record-types and set-types. A typical


database design would contain many patterns of relationships between records. The following
diagram conveys some design patterns.

The pattern in the above diagrams are explained as follows:

1. It is an example of a single record-type in the database with no relationships with any


other record-types. There is no system-owned indexed set. Usually such a record-type
should have location mode CALC or DIRECT. Such records usually exist in the
database to hold parameter data. The occurrences of such record-type can be accessed
by CALC or by area sweeps.

Bhooshan Nagaokar 22
Essential IDMS

2. It is an example of a record-type that has a system-owned index on it. The system-


owned is generally used on the record-type to access records on a specific sort-key.
The record-type may participate in relationships with other records either as owner or
member.

3. It is an example of an owner-member relationship. The owner as well as the member


may participate in other set relationships or may have system-owned indexes on them.
Usually the location of member would be VIA, and if this member is to be clustered
with the owner then the set between the owner and member is a part of members
record attributes.

4. It is an example of multi-member set. There are two member record-types that are in a
relationship with the same owner on a single set. This implies that the set-occurrence
can be navigated and each retrieval can potentially result in retrieval of an occurrence
of any of the two member record-types. In some cases, the set can be navigated to
retrieve occurrences of a single record-type by specifying the optional record-name in
the retrieval statement (refer to OBTAIN statement for more information).

5. It is an example of an owner having multiple members each on a different set. This is


different from (4) where multiple member record-types are tied to the owner record-
type on a single set. Each owner occurrence is thus associated with different set-
occurrences for different member-types.

6. It is an example of a member with multiple owners on respective sets. This implies


that a member participates in set-occurrences on sets that have different owner record-
types. The same member is thus tied with different owner-types in different
relationships. The member is also called as a junction record. This pattern allows
many-to-many relationships between two owner types.

7. It is an example of multi-level hierarchy. An owner has a member on a set. This


member further has a member on another set.

8. It is an example of an owner having multiple relationships with the same member.


This is also known as a bill-of-material structure. This pattern enables multi-level
hierarchy without having the same number of set and owner-member relationships.
Each record in the hierarchy has an existence as an owner occurrence. One of the set
is used to represent all subordinate members for that owner. The other set enables an
upward navigation to its owner representation just in case a further downward
navigation to its subordinates is required.

Bhooshan Nagaokar 23
Essential IDMS

7.0 CURRENCY
IDMS saves db-keys of records that are accessed for an application; these are known as
currencies. IDMS uses currencies for its own navigation. Currencies are accessible by DML
statements and can be saved in variables; these could later be used to access records directly.
In some cases currencies may be NULL if the program has not accessed relevant records or it
has disconnected or erased certain records.

There are four types of currencies that IDMS maintains for an application. They are: run-unit,
area, set and record-type. The explanation of each is as follows.

Run-unit: The most recently accessed record by the application becomes current of
run-unit. MODIFY and ERASE operations require the record they are dealing with to
be current of run-unit; hence run-unit currencies should be set on those records just
before MODIFY or ERASE operation.

Area: This is the most recently accessed record in an area; IDMS maintains area
currencies for each area that the application accesses. Area-sweeps potentially may
access record-occurrences of different types; hence area currencies may be db-keys of
different record-types.

Set: This is the most recently accessed record in a set. The occurrence can be either the
owner or one of the member records; hence set currencies may be db-keys of either the
owner or the member record-type. Set currencies should point to appropriate records
before STORE and CONNECT operations.

Record-type: This is the most recently accessed record for a record-type; IDMS
maintains these for each record-type accessed by the application. Record-type
currencies should point to appropriate records before GET operations.

For an application, depending on the DML operation it is currently carrying out, IDMS would
use and would update currencies. The following table highlights this:

DML Statement RU Rec Set Area Currency Updated after Successful


Execution
ACCEPT * X X X X None
IF * X X None
FIND/OBTAIN DB-KEY Updates ALL
FIND/OBTAIN CURRENT * X X X Updates ALL
FIND/OBTAIN WITHIN SET X Updates ALL +
FIND/OBTAIN WITHIN AREA X ** Updates ALL
FIND/OBTAIN OWNER X Updates ALL
FIND/OBTAIN DUPLICATE X Updates ALL
FIND/OBTAIN USING SORT-KEY X Updates ALL
OBTAIN X None
RETURN X Updates set

Bhooshan Nagaokar 24
Essential IDMS
STORE X Updates ALL
***
MODIFY X None ++
ERASE X Nullifies currencies of all record-types
and sets involved
CONNECT X X Run-unit, set
DISCONNECT X Nullifies currency of object set; updates
current of run-unit and area
KEEP X X X X None
COMMIT None
COMMIT ALL Nullifies ALL currencies
ROLLBACK Nullifies ALL currencies
ROLLBACK CONTINUE Nullifies ALL currencies
FINISH Nullifies ALL currencies

* uses only one currency as determined by command format


** required for NEXT and PRIOR formats only
*** all in which record-type participates as an automatic member
+ index set currency is established with OBTAIN only
++ except in the case of a sorted set

Bhooshan Nagaokar 25
Essential IDMS

8.0 ACCESS RESTRICTION


Access restrictions are placed for applications in subschema definitions. These restrictions
would prohibit an application to access database objects such as areas, records and sets. Each
restriction on an object is such that it prohibits certain functions against the object. An
application using a certain subschema adheres to access restrictions defined within it.

On Areas These restrictions prohibit applications to ready areas in a specified


usage mode.

On Records These restrictions prohibit applications from performing one or more of


the following DML functions such as STORE, CONNECT, MODIFY,
DISCONNECT, FIND, GET and KEEP.

On Sets These restrictions prohibit applications from performing one or more


DML functions such as CONNECT, DISCONNECT, FIND and KEEP.

Bhooshan Nagaokar 26
Essential IDMS

9.0 NOTES

Area sweep

Sweep: Area sweep is an access of occurrences in an area. It is one of the only reliable
way by which all occurrences for a record-type can be accessed. The order in which
records are retrieved is undetermined.
Aside: An application can access all occurrences of a record-type provided there is a
system-owned index on it with membership MA. A system-owned index with other
membership options will not guarantee retrieval of all occurrences for the record-type.

The Pitfall: Applications employ area sweep by placing access operations (OBTAIN)
on a record-type in an iterative loop. During area sweep, IDMS uses area currency to
access the next record in the area. If an application accesses any other record-type
stored in the same area, it will cause area currency to shift to that record-type. This
often distorts successive retrievals of occurrences of a specific record-type and is a
typical pitfall of area sweep.
The above diagram enables an appropriate visualization of the pitfall. All member
occurrences are retrieved using area-sweep. After retrieving every member, its owner

Bhooshan Nagaokar 27
Essential IDMS
is accessed. This alters the area currency and may cause the next few member records
to be skipped (forward distortion) or may set currency on member records that are
already accessed (backward distortion).
How to Avoid it: The pitfall can be avoided by restoring area currency on the record
that was accessed in the previous iteration by using record-type currency. The code
fragment demonstrates avoidance of the pitfall.
OBTAIN FIRST EMPLOYEE WITHIN EMP-AREA
PERFORM UNTIL DB-END-OF-AREA
Potential distortion of iterative sequence
OBTAIN OWNER WITHIN DEPT-EMP

Restore area currency on previously accessed
EMPLOYEE record setting the distortion right
FIND CURRENT EMPLOYEE
Continue to access next EMPLOYEE record
OBTAIN NEXT EMPLOYEE WITHIN EMP-AREA
END-PERFORM

Calc set

While hashing, many records may get mapped onto a page. IDMS tries to
accommodate all such records on that page. If not then some records may overflow
into adjacent pages. These records are connected to the calc-set of the page that they
get mapped onto.

Each page has a calc set-occurrence. The members of such a set are all records that are
mapped onto that page through hashing. Members of a calc-set for a page need not
reside in that page. Similarly records that reside in a page need not be members of calc
set-occurrence of that page.

The following diagram is an example of a calc-set for page:1035. The header contains
a link to first occurrence in the set, each occurrence points to the next one. In this case
the page contains records that are not a part of its calc-set. Also, the page could not
accommodate more occurrences that are a part of its calc-set. These occurrences are
located in the adjacent page:1036 and are linked to the calc-set of page:1035.

Bhooshan Nagaokar 28
Essential IDMS

Empty set, unconnected records

In a set, an occurrence of a super-ordinate type may not have any subordinate


members. Similarly there may be occurrences of a subordinate type that are not
connected with any super-ordinate owner. Subordinate records lie unconnected in two
situations: when they are created and storage option is manual, or when removal
option is optional and they are disconnected.

Connection

There might be situations when a new record is to be created, or an existing record is


to be connected to its owner(s) on sets above it. In both these cases it would be
important to know membership options of all sets where the record is a member, i.e.
owners above the record.
If STORAGE option on those sets is Automatic then it would be important to access
the owner records before storing or connecting. If set order is NEXT or PRIOR then it
would be important to access an existing member record as well; this is to establish the
position which becomes relevant before storing or connecting the record.

Bhooshan Nagaokar 29
Essential IDMS
Multiple record-type retrievals

There are some DML operations like OBTAIN WITHIN area-name/set-name. For
these operations, it is optional to place record-name. In such cases the operation can
potentially retrieve an occurrence of any type that is associated with the area or the set.
It would be appropriate to check SUBSCHEMA-CTRL variable to ascertain which
record-type is retrieved by the most recently executed OBTAIN statement.

Foreign keys

Records that participate in a set have embedded links to other records. When linkage
includes OWNER, each member record contains an embedded link to its owner
record. This implies that access from member to its owner is achieved in the fastest
possible manner.
Because the embedded link to owner provides a built-in mechanism that is equivalent
to a foreign key, members need have an explicit foreign key field in them.

Bhooshan Nagaokar 30
Essential IDMS

10.0 DML statements


DML programming

An application program makes requests to IDMS to perform database relevant services. These
requests are made using IDMS Data Manipulation Language statements, or DML statements.
The DML statements are embedded within COBOL programs as if they were a part of host
language. The embedded DML statements are processed by IDMS DML COBOL processor
(DMLC) and get converted into CALL statements.

DMLC processor copies from the data dictionary all database definitions that are needed to
interact with IDMS. The data dictionary contains all predefined source modules, record
descriptions, file definitions, database record definitions and IDMS communication block.
Copying these from the data dictionary reduces a great deal of coding effort. At run-time these
CALLs pass control to IDMS database management system to perform the requested services.

DML categories:

STATEMENT DESCRIPTION
Control statements
BIND To sign-on to DBMS, start a transaction, establish
addressability
READY To prepare areas for processing
IF To detect presence/absence of relationship
COMMIT To write checkpoint, make unit of work permanent
ROLLBACK To recover unit of work
KEEP To place explicit locks on records
Retrieval statements
FIND To locate a record in the database
GET To refresh variable-storage located record
OBTAIN To locate a record and refresh variable-storage
Modification statements
STORE To create a new record in the database
MODIFY To change an existing record in the database
CONNECT To make a record participate in a set occurrence
DISCONNECT To remove a records participation in a set occurrence
ERASE To delete a record from the database
Save statements
ACCEPT To save db-keys from currencies
RETURN To save db-keys from index

The following sections explain the commonly used DML statements in detail. Each section
contains the syntax of DML statement. The section is divided to explain the following:

Bhooshan Nagaokar 31
Essential IDMS
Syntax provides syntax of the DML statement
Execution provides a description of execution & guidelines
Errors provides a list of possible errors, and their description
Example provides a sample code demonstrating the use and context
Please note that lines of code in bold are comments.

Bhooshan Nagaokar 32
Essential IDMS

10.01 OBTAIN CALC

Syntax OBTAIN CALC record-name

Execution
This statement accesses a record based on calc-key value. The record-type must
be defined in the database with location mode CALC. Ensure that the calc-key
in record-structure is populated before statement is executed.
IDMS searches the database to find a record matching the calc-key value. On
successful execution the accessed record becomes current of run-unit, area, all
sets in which it participates as member or owner and its record-type.
Do not use this statement on records with location mode VIA or DIRECT.

Errors
Code Meaning
0000 Successful
0301 The area in which the named record participates has not been
readied
0308 The object record is not in the subschema. The program has
probably invoked a wrong subschema
0310 The subschema specifies an access restriction that prohibits
retrieval of the named record
0318 The record has not been bound
0326 The record or SPF index entry cannot be found
0331 The retrieval statement conflicts with the records location mode

Example
Populate calc-key and then OBTAIN CALC
MOVE 0001 TO DEPARTMENT-CODE
OBTAIN CALC DEPARTMENT

Check for 0326 DB-REC-NOT-FOUND


IF DB-REC-NOT-FOUND
Record not found...
END-IF

Bhooshan Nagaokar 33
Essential IDMS

10.02 OBTAIN DUPLICATE

Syntax
OBTAIN DUPLICATE record-name

Execution
This statement accesses duplicate records with same calc-key value. Ensure
that the first record matching the calc-key value is accessed using OBTAIN
CALC. The statement OBTAIN DUPLICATE could then be executed
iteratively to access all records of same calc-key value.

IDMS looks for occurrences having the same calc-key value as that accessed
by the preceding OBTAIN CALC statement. On successful execution the
accessed record becomes current of run-unit, area, all sets in which it
participates as member or owner and its record-type.

Do not modify calc-key value while iteratively accessing all records with this
statement for the same calc-key. Do not use this statement on records with
location mode VIA or DIRECT.

Errors
Code Meaning
0000 Successful
0301 The area in which the named record participates has not been
readied
0308 The object record is not in the subschema. The program has
probably invoked a wrong subschema
0318 The record has not been bound
0326 No more duplicates exist for the object record
0331 The retrieval statement conflicts with the records location mode
0332 The value of calc-key in variable storage does not match value of
CALC data item in current record

Example
Populate calc-key and first OBTAIN CALC
MOVE 0001 TO DEPARTMENT-CODE
OBTAIN CALC DEPARTMENT

Check for 0326 - DB-REC-NOT-FOUND,


IF DB-REC-NOT-FOUND
Record not found, so do not try OBTAIN DUPLICATE
GO TO EXIT
END-IF

Bhooshan Nagaokar 34
Essential IDMS

PERFORM UNTIL DB-REC-NOT-FOUND


Process current record

OBTAIN DUPLICATE DEPARTMENT
END-PERFORM

Bhooshan Nagaokar 35
Essential IDMS

10.03 OBTAIN DB-KEY

Syntax
OBTAIN record-name DB-KEY IS database-key

Execution
This statement accesses record directly using a db-key value. Ensure that the
variable database key used in the statement holds a valid db-key value that
has been previously accessed by ACCEPT or RETURN statements.

On successful execution the accessed record becomes current of run-unit, area,


all sets in which it participates as member or owner and its record-type.

Errors
Code Meaning
0000 Successful
0301 The area in which the named record participates has not been
readied
0302 The db-key is inconsistent with the area in which the record is
stored. The db-key has not been initialized properly, or the record
name is incorrect
0308 The object record is not in the subschema. The program has
probably invoked a wrong subschema
0310 The subschema specifies an access restriction that prohibits
retrieval of the named record
0326 The specified record cannot be found
0371 The page requested cannot be found in the DMCL

Example
Use values of WS-DBKEY to get record
OBTAIN DEPARTMENT DB-KEY IS WS-DBKEY

Bhooshan Nagaokar 36
Essential IDMS

10.04 OBTAIN OWNER

Syntax
OBTAIN OWNER WITHIN set-name

Execution
This statement accesses owner record of the current set occurrence. It can be
used to retrieve owner record of any set whether or not the set has owner
pointer in its set-linkage. Ensure that the current set occurrence is established
before using this statement.

After successful execution the accessed record becomes current of run-unit,


area, its record-type and all sets in which it participates as member or owner.

In most cases, having accessed a member record, the statement is used to find
its owner on a specified set. When a member record is accessed, it establishes
current set occurrence in which it participates as a member. And if membership
option for the set is MA, the statement would successfully retrieve the
members owner.

However when the member record is accessed on an Optional or Manual set,


and it is not currently connected to an owner, the set occurrence is not
established and set currency is not be updated. In such situations the statement
proceeds to retrieve the owner record of the current set occurrence that may
have been established by previous retrievals.

In such cases, it is therefore essential to detect whether or not a member


participates in a set occurrence before using OBTAIN OWNER. This can be
done using the IF set-name MEMBER statement.

Errors
Code Meaning
0000 Successful
0301 The area in which the object record participates has not been readied
0306 Currency has not been established for the named record, set or area
0308 The named record or the named set is not in the subschema, or the
named record is not defined as a member of the named set. The
program has probably invoked a wrong subschema
0310 The subschema specifies an access restriction that prohibits retrieval
of the named record

Example
Populate calc-key and access member record
MOVE 0001 TO EMPLOYEE-CODE
OBTAIN CALC EMPLOYEE

Bhooshan Nagaokar 37
Essential IDMS
...
Ensure that member is connected to owner
Only then do OBTAIN OWNER
This is absolutely essential if Membership is MM, OA, and OM
IF DEPARTMENT-EMPLOYEE MEMBER
OBTAIN OWNER WITHIN DEPARTMENT-EMPLOYEE
END-IF

Bhooshan Nagaokar 38
Essential IDMS

10.05 OBTAIN WITHIN SET

Syntax
OBTAIN FIRST record-name WITHIN set-name
OBTAIN NEXT record-name WITHIN set-name
OBTAIN PRIOR record-name WITHIN set-name
OBTAIN LAST record-name WITHIN set-name
OBTAIN sequence-number record-name WITHIN set-name

Execution
This statement accesses records of the current set occurrence. The access can
be backward, forward or direct. The record is accessed as specified by formats
such as: NEXT, PRIOR, FIRST, LAST and sequence-number.

After successful execution the accessed record becomes current of run-unit,


area, its record-type and all sets in which it participates as member or owner.

On a user-owned set (indexed or chained), ensure that current set occurrence is


established before using the statement. If the owner record is current of set then
the NEXT and FIRST formats would retrieve the same record, i.e. the first
record in the set-occurrence.. And if the member record is current of set then
the NEXT and PRIOR formats would retrieve records relative to the current of
set.

The statement can retrieve PRIOR or LAST records only if the set has PRIOR
pointers in its set-linkage.

On a system-owned-index set, ensure that set-currency is established (by


FIRST, LAST or sequence-number formats or any other statements) before
using NEXT or PRIOR formats.

When a member record is retrieved using sequence-number, ensure that the


sequence-number is a positive integer and within the range of number of
records currently in the set-occurrence. Note that the sequence-number is the
physical location of the member record in the set-occurrence and can change in
time as records move in and out of the set-occurrence.

On a user-owned set, when an end-of-set condition occurs, the owner record of


the set becomes current of run-unit, current of its record-type, current of area
and current of only the set involved in the operation. Currency of other sets in
which the record participates as owner or member remains unaffected.

It may be noted that it is optional to place record-name in this statement. A


record-type can be an owner on a set of more than one member record-types. In
such a case the statement can potentially retrieve occurrences of any member

Bhooshan Nagaokar 39
Essential IDMS
record-types. By specifying the record-name the statement retrieves
occurrences only of that record-type.

Errors
Code Meaning
0000 Successful
0301 The area in which the object record participates has not been readied
0304 A sequence number of zero or a variable field containing a value of
zero was specified for the object record
0306 Currency has not been established for the named record, set or area
0307 The end of set has been reached, or the set is empty
0308 The named record or the named set is not in the subschema, or the
named record is not defined as a member of the named set. The
program has probably invoked a wrong subschema
0310 The subschema specifies an access restriction that prohibits retrieval
of the named record
0323 The area name specified has not been included in the subschema
invoked, or the record name specified has not been defined within
the named area
0326 The record or SPF index entry cannot be found

Example
MOVE 0001 TO DEPARTMENT-CODE
OBTAIN CALC DEPARTMENT
...
OBTAIN FIRST EMPLOYEE WITHIN DEPARTMENT-EMPLOYEE
PERFORM UNTIL DB-END-OF-SET
...
OBTAIN NEXT EMPLOYEE
WITHIN DEPARTMENT-EMPLOYEE
END-PERFORM
...
MOVE 10 TO WS-SEQ
OBTAIN WS-SEQ EMPLOYEE WITHIN DEPARTMENT-EMPLOYEE
...
OBTAIN 15 EMPLOYEE WITHIN DEPARTMENT-EMPLOYEE

Bhooshan Nagaokar 40
Essential IDMS

10.06 OBTAIN WITHIN AREA

Syntax
OBTAIN FIRST record-name WITHIN area-name
OBTAIN NEXT record-name WITHIN area-name
OBTAIN PRIOR record-name WITHIN area-name
OBTAIN LAST record-name WITHIN area-name
OBTAIN sequence-number record-name WITHIN area-name

Execution
This statement accesses records in an entire area. This is also known as area-
sweep. The access can be backward, forward or direct. The record is accessed
as specified by formats such as: NEXT, PRIOR, FIRST, LAST and sequence-
number.

After successful execution, the accessed record becomes current of run-unit,


area, its record-type and all sets in which it participates as member or owner.

Use the FIRST, LAST or sequence-number formats (or any other statements)
to established area currency before using the NEXT or PRIOR formats. While
using the NEXT or PRIOR formats, the order of records when retrieved is
undetermined. Accessing a record using sequence-number during area-sweep
can be expensive and should be avoided.

It may be noted that it is optional to place record-name in this statement. An


area can contain occurrences of more than one record-type. In such a case the
statement can potentially retrieve occurrences of any member record-types. By
specifying the record-name the statement retrieves occurrences only of that
record-type.

Area-sweep uses area currency for the NEXT or PRIOR formats. And area
currency is altered when any record-type in that area is accessed, either by this
statement or by any other statement that updates area currencies. If the NEXT
or PRIOR formats are used to access occurrences of a specific record-type in
an iterative sweep, then ensure that area currency points to the appropriate
record before using the NEXT or PRIOR formats.

Errors
Code Meaning
0000 Successful
0301 The area in which the object record participates has not been
readied
0304 A sequence number of zero or a variable field containing a value of
zero was specified for the object record
0306 Currency has not been established for the named record, set or area

Bhooshan Nagaokar 41
Essential IDMS
0307 The end of area has been reached, or there are no records in the area
0308 The named record or the named set is not in the subschema, or the
named record is not defined as a member of the named set. The
program has probably invoked a wrong subschema
0310 The subschema specifies an access restriction that prohibits
retrieval of the named record
0323 The area name specified has not been included in the subschema
invoked, or the record name specified has not been defined within
the named area
0326 The record or SPF index entry cannot be found

Example
Access first record within area
OBTAIN FIRST EMPLOYEE
WITHIN DEPARTMENT-AREA

This is the area-sweep iteration to access


all EMPLOYEE records
PERFORM UNTIL DB-END-OF-AREA
...
Access other records if needed
This may alter area currency
MOVE 0001 TO DEPARTMENT-CODE
OBTAIN CALC DEPARTMENT

Set & area currency back on EMPLOYEE
This is absolutely essential if area currency is
altered, which is in this case
FIND CURRENT EMPLOYEE

And now access the next EMPLOYEE
OBTAIN NEXT EMPLOYEE
WITHIN DEPARTMENT-AREA
END-PERFORM

Bhooshan Nagaokar 42
Essential IDMS

10.07 OBTAIN CURRENT

Syntax
OBTAIN CURRENT record-name
OBTAIN CURRENT WITHIN set-name
OBTAIN CURRENT WITHIN area-name

Execution
This statement accesses records based on record-type, set and area currency.
The statement is useful in establishing a proper record as current of run-unit
before executing DML statements that utilize run-unit currencies (i.e.
ACCEPT, IF, GET, MODIFY, ERASE).

Errors
Code Meaning
0000 Successful
0301 The area in which the named record participates has not been
readied
0306 Currency has not been established for the named record, set or area
0308 The object record is not in the subschema. The program has
probably invoked the wrong subschema
0310 The subschema specifies an access restriction that prohibits retrieval
of the named record
0313 A current record of run-unit has not been established or has been
nullified by a previous ERASE statement
0323 The area-name specified has not been included in the subschema
invoked

Example
OBTAIN CURRENT DEPARTMENT

OBTAIN CURRENT WITHIN DEPARTMENT-EMPLOYEE

OBTAIN CURRENT WITHIN DEPARTMENT-AREA

Bhooshan Nagaokar 43
Essential IDMS

10.08 OBTAIN WITHIN USING

Syntax
OBTAIN record-name WITHIN set-name USING sort-field
OBTAIN record-name WITHIN set-name CURRENT USING sort-field

Execution
This statement accesses a member in a set-occurrence directly based on the
sort-key value. The statement is valid for sorted-chained sets or indexed sets.
Ensure that the sort-key in the member record-structure is populated. Ensure
that the current set occurrence is established before using the statement.

The statement accesses the first member record in a set-occurrence that


satisfies sort-key value. After successful execution the accessed record
becomes current of run-unit, area, its record-type and all sets in which it
participates as member or owner.

The search begins with the owner in the set-occurrence and proceeds in the
next direction. If the term CURRENT is placed optionally in the statement,
then the search begins with the occurrence current of set and proceeds in the
next direction.

If a record with exact match on sort-key is not found, the current of set is
nullified, the next and prior of set are still maintained, and an error 0326 is
returned. This implies that the search terminates where the record would have
existed in the set-occurrence. Subsequent OBTAIN NEXT/PRIOR statements
can navigate forward and backward from that position in the set-occurrence.

Errors
Code Meaning
0000 Successful
0306 Currency is not established for record, area
or set
0326 Record with sort-key value is not found

Example
Populate calc-key and access the owner
by doing OBTAIN CALC
MOVE 0001 TO DEPARTMENT-CODE
OBTAIN CALC DEPARTMENT
...
Do a direct access of the member on sort-key value
MOVE JOHN TO EMPLOYEE-NAME
OBTAIN EMPLOYEE WITHIN DEPARTMENT-EMPLOYEE
USING EMPLOYEE-NAME

Bhooshan Nagaokar 44
Essential IDMS

If an exact match is not found proceed to access


the next member from the current position in the set-occurrence
IF DB-REC-NOT-FOUND
OBTAIN NEXT EMPLOYEE
WITHIN DEPARTMENT-EMPLOYEE
...
END-IF

Bhooshan Nagaokar 45
Essential IDMS

10.09 FIND & GET

Syntax
FIND equivalent to all forms of OBTAIN
GET record-name

Execution
For any OBTAIN statement, IDMS navigates the database to locate appropriate
record, updates currencies and finally transfers record content from database to
record-structure in the application program. Thus OBTAIN operations are
logically divided as: database access and refreshing record-structure.

FIND statement is used when the application requires all database access
operations to be performed but doesnt require the record contents. This saves
some I/Os that are required to transfer information from database to variable-
storage area. Syntactically FIND is equivalent to all forms of OBTAIN.

GET statement transfers the contents of record occurrence to the variable-


storage area. Get operates only on record that is current of run-unit.

OBTAIN is equivalent to executing an equivalent FIND immediately followed


by GET.

Errors
Code Meaning
0000 Successful
0508 The object record is not in the subschema. The program has
probably invoked the wrong subschema
0510 The subschema specifies an access restriction that prohibits retrieval
of the named record
0513 A current record of run-unit has not been established, or has been
nullified by a previous ERASE statement
0518 The record has not been bound
0520 The current record is not the same type as the named record

Example
Populate calc-key and do a FIND CALC
This sets currency on the record but does not
populate record buffer
MOVE 0001 TO DEPARTMENT-CODE
FIND CALC DEPARTMENT

Now do a GET and populate record buffer
GET DEPARTMENT

Bhooshan Nagaokar 46
Essential IDMS

Bhooshan Nagaokar 47
Essential IDMS

10.10 MODIFY

Syntax
MODIFY record-name

Execution
This statement changes contents of a record in the database. It replaces values
of record in database with those in variable-storage of the application.
MODIFY requires all affected areas to be readied in update usage mode.

After successful execution the modified record becomes current of its record-
type, area, and all sets in which it participates as owner or member.

Ensure that the record that is being modified is accessed either by OBTAIN or
GET statement. The record-structure should to be populated with changes
before MODIFY operation. Ensure that the record-occurrence is made current
of run-unit before the MODIFY operation - this can achieved by executing
FIND CURRENT for that record-type.

IDMS permits the application to modify value of calc-key but such changes are
expensive as they imply updates to CALC set. Value of calc-key is not usually
modified. Any attempt to modify sort-key value may also be expensive in
terms of database I/Os.

Errors
Code Meaning
0000 Successful
0805 Modification of the record would violate a duplicates-not-allowed
option for a CALC record, a sorted set, or an index set
0806 Currency has not been established for the object record
0809 The object records area has not been readied in update usage mode
0810 The subschema specifies an access restriction that prohibits
modification of the named record
0813 A current record of run-unit has not been established or has been
nullified by a previous ERASE statement
0818 The record has not been bound
0820 The current record of run-unit is not the same type as the specified
record
0821 An area other than the area of the object record has been readied
with an incorrect usage mode
0825 No current record of set type has been established
0833 All sorted sets in which the object record participates have not been
included in the subschema
0855 An invalid length has been defined for a variable-length record
0883 The length of a record in a native VSAM ESDS has been changed,

Bhooshan Nagaokar 48
Essential IDMS
or a prime key in a native VSAM KSDS has been modified

Example
Populate calc-key and access the record to be modified
MOVE 0001 TO DEPARTMENT-CODE
OBTAIN CALC DEPARTMENT

Access other records, if thats what is needed
This would alter run-unit currency
OBTAIN FIRST EMPLOYEE WITHIN DEPARTMENT-EMPLOYEE

MOVE WS-COUNT TO DEPT-EMPLOYEE-COUNT

Now re-establish run-unit currency on DEPARTMENT
This is the same record that needs to be modified
FIND CURRENT DEPARTMENT

And finally MODIFY it


MODIFY DEPARTMENT

Bhooshan Nagaokar 49
Essential IDMS

10.11 STORE

Syntax
STORE record-name

Execution
This statement creates a record in the database. It creates space in the database
for the new record and establishes db-key for the new occurrence. It transfers
record content from applications variable-storage to the database and connects
record to its owners on all sets on which it is defined as an automatic member.

After successful execution, the stored record becomes current of run-unit, its
record-type and all sets in which it participates as owner or automatic member.

It is necessary to include in the subschema all sets in which the record is an


automatic member, and the owner record of each such sets. Before executing
STORE statement, ensure that all areas affected implicitly or explicitly are
readied in update usage mode.

If the records location mode is CALC then calc-key should be populated. If


the record-type participates as member in a sorted set then sort-key fields
should be populated. If the records location mode is VIA, then currency
should be established for the set in which the record participates as a member,
regardless whether the record is an automatic or manual member on the set.
This ensures that the new record is clustered with its owner in the VIA set.

If the record participates as an automatic member on a set, then currency


should be established for those sets before the STORE statement. If the record
is an automatic member on a set which has NEXT or PRIOR set-order, then
set-currency should be on a record that determines the position of the new
record.

Errors
Code Meaning
0000 Successful
1201 The area in which the named record is stored has not been readied
1202 The suggested DIRECT DB-KEY value is not within the page-range
for the object record
1205 Storage of record would violate a duplicates-not-allowed option for
a CALC record, a sorted set or an index set
1208 The object record is not in the subschema. The program has
probably invoked a wrong subschema
1209 The object records area has not been readied in update usage mode
1210 The subschema specifies an access restriction that prohibits storage
of the named record

Bhooshan Nagaokar 50
Essential IDMS
1211 The record cannot be stored in the area because of insufficient space
1212 The record cannot be stored because no db-key is available
1218 The record has not been bound
1221 An area other than the area of the object record occurrence has been
readied with an incorrect usage mode
1225 A set occurrence has not been established for each set in which the
object record is stored
1233 All sets in which the record participates as an automatic member
have not been included in the subschema
1255 An invalid length has been defined for a variable-length record
1261 The record cannot be stored because of broken chains in the
database

Example
Populate calc-key and access DEPARTMENT record,
This access to this owner is essential if Storage is Automatic
MOVE 030 TO DEPARTMENT-CODE
OBTAIN CALC DEPARTMENT

Access one of the members, this is essential if the order is NEXT
or PRIOR as the new record would then get placed NEXT or PRIOR to
this member
OBTAIN 10 EMPLOYEE WITHIN DEPARTMENT-EMPLOYEE

Populate the record, do not miss out on calc-keys and all sort-keys
MOVE 0001 TO EMPLOYEE-CODE
MOVE NEW EMPLOYEE TO EMPLOYEE-NAME
MOVE 120 TO DEPARTMENT-COUNT

And STORE it
STORE DEPARTMENT

Bhooshan Nagaokar 51
Essential IDMS

10.12 ERASE

Syntax
ERASE record-name
ERASE record-name PERMANENT MEMBERS
ERASE record-name SELECTIVE MEMBERS
ERASE record-name ALL MEMBERS

Execution
This statement deletes a record from the database. Ensure that the record-
occurrence is made current of run-unit before the statement is executed.

All forms of ERASE require the relevant areas to be readied in Update mode.
ERASE requires all sets in which the record participates as an owner directly
or indirectly, and all member record-types in those sets to be included in the
subschema.

ERASE nullifies currency for all record-types explicitly and implicitly


involved in the erase. It nullifies currencies for all sets in which the erased
records participate. The run-unit and area currencies remain unaffected.

Erased records cannot be retrieved. However the next, prior and owner pointers
for the erased record are preserved. This can enable the application to continue
to retrieve next/prior records within the area, or next/prior/owner records
within the set in which the erased record participated.

For unqualified ERASE: If the record is an owner of a non-empty set-


occurrence on any set under it then it is not erased. This is the least severe form
of erase.

For ERASE qualified as PERMANENT: The record is erased. All mandatory


members owned by the record are erased. All optional members owned by the
record are disconnected. If any erased members are owners then the ERASE is
cascaded as if they were object of an ERASE PERMANENT.

For ERASE qualified as SELECTIVE: The record is erased. All mandatory


members owned by the record are erased. Optional members owned by the
record are erased if they do not currently participate as members in other set
occurrences, else they are disconnected. If any erased members are owners then
the ERASE is cascaded as if they were object of an ERASE SELECTIVE.

For ERASE qualified as ALL: The record is erased. All mandatory and
optional members owned by the record are erased. All erased records that are
themselves owners are treated as if they were object of ERASE ALL.

Bhooshan Nagaokar 52
Essential IDMS
Errors
Code Meaning
0000 Successful
0209 The object records area has not been readied in update usage mode
0210 The subschema specifies an access restriction that prohibits use of
the ERASE statement. For SPF users, this code can also indicate use
of an invalid form of the ERASE statement
0213 A current record of run-unit has not been established, or has been
nullified by a previous ERASE statement
0220 The current record of run-unit is not the same type as the specified
record
0221 An area other than the area of the object record has been readied
with an incorrect usage mode
0225 Currency has not been established. For SPF users, this usually
indicates that a FIND statement has been issued for an indexed
record followed by an ERASE statement for the same record. Only
an OBTAIN statement updates index set currencies.
0230 An attempt has been made to erase the owner record of a non-empty
set
0233 Erasure of the record occurrence is not allowed in this subschema, or
all sets in which the record participates have not been included in the
subschema

Example
Populate calc-key and access the record to be erased
MOVE 0001 TO DEPARTMENT-CODE
OBTAIN CALC DEPARTMENT

Access other records, this would alter run-unit currency
OBTAIN FIRST EMPLOYEE WITHIN DEPARTMENT-EMPLOYEE

Re-establish run-unit currency on DEPARTMENT to be erased
FIND CURRENT DEPARTMENT

And finally ERASE it


ERASE DEPARTMENT

10.16 IF EMPTY

Syntax
IF set-name IS EMPTY
IF set-name IS NOT EMPTY

Bhooshan Nagaokar 53
Essential IDMS
Execution
This statement checks whether the set occurrence is empty or not. A set
occurrence is empty there are no member records for the owner. The record
that is current of the set establishes the set occurrence that is tested by the
statement. It is advisable to have set currency on the owner record before using
this statement.

The statement IF EMPTY is true if the owner of the set occurrence does not
have any member records. Alternatively the statement IF NOT EMPTY is true
if the owner has one or more member records.

The IF EMPTY statement is a DML statement and different from the COBOL
IF statement. It is possible to have an ELSE and END-IF with this statement.
The DML IF should not be mixed with the usual COBOL IF statements. The
statement IF EMPTY is logically equivalent to OBTAIN FIRST/LAST
returning DB-END-OF-SET error.

Errors
Code Meaning
0000 Successful
1601 The set is not empty. This error transfers control to ELSE part of the
statement
1606 Currency has not been established for the object set
1608 An invalid set name has been specified

Example
Populate calc-key and access owner record
MOVE 0001 TO DEPARTMENT-CODE
OBTAIN CALC DEPARTMENT
...
Check if there are no EMPLOYEE records under it
IF DEPARTMENT-EMPLOYEE IS EMPTY
...
END-IF

Bhooshan Nagaokar 54
Essential IDMS

10.17 IF MEMBER

Syntax
IF set-name MEMBER
IF NOT set-name MEMBER

Execution
This statement checks whether a record that is current of run-unit participates
as a member in a set-occurrence on the named set. Use the statement only if the
current record is a member on the named set with MM, OA or OM
memberships.

The statement IF MEMBER is true if the current record participates in a set


occurrence on the named set. Alternatively the statement IF NOT MEMBER is
true if the current record does not participate in a set occurrence, i.e. it exists in
the database but doesnt have an owner on the named set.

The IF EMPTY statement is a DML statement and different from the COBOL
IF statement. It is possible to have an ELSE and END-IF with this statement.
The DML IF should not be mixed with the usual COBOL IF statements.

Errors

Code Meaning
0000 Successful
1601 The record that is current of run-unit is not a member of the set. This
error transfers control to ELSE part of the statement
1608 The current record of run-unit is not a member of the named set
1613 A current record of run-unit has not been established or has been
nullified by a preceding ERASE statement

Example
Populate calc-key and access a member record
MOVE 0001 TO EMPLOYEE-CODE
OBTAIN CALC EMPLOYEE
...
Check if it is connected to DEPARTMENT owner
IF DEPARTMENT-EMPLOYEE MEMBER
...
END-IF

Bhooshan Nagaokar 55
Essential IDMS

10.18 CONNECT

Syntax
CONNECT record-name TO set-name

Execution
This statement connects a member record to a set-occurrence. The record could
only be connected to a set on which it is a member and the set has MM, OA or
OM membership options. The record that is connected should be current of the
record-type.

Ensure that the record that is being connected does not participate in any set-
occurrence on the named set; this can be detected by using IF MEMBER
statement. Ensure that all areas affected by CONNECT are readied in update
usage mode.

Also ensure that the set occurrence in which the record would be connected is
established. This can be done by making the owner or one of the member
records current of the set. If set order is NEXT or PRIOR then set currency
should be on one of the member records that establishes the position for
connection.

Errors
Code Meaning
0000 Successful
0705 The CONNECT would violate a duplicates-not-allowed option
0706 Currency has not been established for the object record or set
0708 The specified record is not in the subschema. The program has
probably invoked the wrong subschema
0709 The object records area has not been readied in update usage mode
0710 The subschema specifies an access restriction that prohibits
connecting the object record to the named set
0714 The CONNECT statement cannot be executed because the object
record has been defined as a mandatory automatic member of the set
0716 The record cannot be connected to a set in which it is already a
member
0721 An area other than the area of the object record has been readied in
an incorrect usage mode
0725 Currency has not been established for the named set type

Example
When set-order is FIRST,LAST or SORTED

Populate calc-key and access the owner record


MOVE TRAINING TO DEPARTMENT-CODE

Bhooshan Nagaokar 56
Essential IDMS
OBTAIN CALC DEPARTMENT
..
Now access the member EMPLOYEE record
Remember, currently this record is not connected to any
owner DEPARTMENT on the set DEPARTMENT-EMPLOYEE
MOVE 0001 TO EMPLOYEE-CODE
OBTAIN CALC EMPLOYEE
...
Use IF MEMBER effectively to detect if member is unconnected
to any owner on DEPARTMENT-EMPLOYEE set
Only unconnected members can be successfully connected
IF NOT DEPARTMENT-EMPLOYEE MEMBER
CONNECT EMPLOYEE TO DEPARTMENT-EMPLOYEE
END-IF

When set-order is NEXT or PRIOR

Populate calc-key and access the owner DEPARTMENT record


MOVE TRAINING TO DEPARTMENT-CODE
OBTAIN CALC DEPARTMENT
..
Now access one of the member EMPLOYEE record, this establishes
the position prior to connection, as well as the set-currency
OBTAIN 10 EMPLOYEE WITHIN DEPARTMENT-EMPLOYEE
...
Now access the record to be connected
Remember, because this record is unconnected to any DEPARTMENT
owner the set currency remains unchanged
MOVE 0001 TO EMPLOYEE-CODE
OBTAIN CALC EMPLOYEE
...
Use IF MEMBER effectively to detect if member is unconnected
to any owner on DEPARTMENT-EMPLOYEE set
Only unconnected members can be successfully connected
IF NOT DEPARTMENT-EMPLOYEE MEMBER
CONNECT EMPLOYEE TO DEPARTMENT-EMPLOYEE
END-IF

Bhooshan Nagaokar 57
Essential IDMS

10.19 DISCONNECT

Syntax
DISCONNECT record-name FROM set-name

Execution
This statement disconnects a member record from a set-occurrence. The record
can only be disconnected on a set if it participates in one of the set occurrences
and is an optional member on the set.

Ensure that the record that is being disconnected is current of the record-type.
Ensure that all areas affected by DISCONNECT are readied in update usage
mode.

After this operation the member record would remain in the database but
would not participate in any set-occurrence on the specified set.

The statement also nullifies set currency. However the next and prior
currencies of set are maintained, this means the application can continue
forward or backward accesses within that set. The disconnected record
becomes current of run-unit, record-type and its area.

Errors
Code Meaning
0000 Successful
1106 Currency has not been established for the named record
1108 The named record is not in the subschema. The program has
probably invoked the wrong subschema
1109 The object records area has not been readied in update usage mode
1110 The subschema specifies an access restriction that prohibits use of
the DISCONNECT statement
1115 The DISCONNECT statement cannot be executed because the
object record has been defined as a mandatory member on the set
1121 An area other than the area of the object record has been readied
with an incorrect usage mode
1122 The object record is not currently a member of the specified set

Example
Populate calc-key and access member to be disconnected
MOVE 0001 TO EMPLOYEE-CODE
OBTAIN CALC EMPLOYEE
...
Ensure that it is currently connected before disconnecting
IF DEPARTMENT-EMPLOYEE MEMBER
DISCONNECT EMPLOYEE

Bhooshan Nagaokar 58
Essential IDMS
FROM DEPARTMENT-EMPLOYEE
END-IF

Bhooshan Nagaokar 59
Essential IDMS

10.20 ACCEPT

Syntax
ACCEPT database-key FROM record-name CURRENCY
ACCEPT database-key FROM set-name CURRENCY
ACCEPT database-key FROM area-name CURRENCY

ACCEPT database-key FROM set-name NEXT CURRENCY


ACCEPT database-key FROM set-name PRIOR CURRENCY
ACCEPT database-key FROM set-name OWNER CURRENCY

Execution
These statements access db-keys of record-occurrences from currencies and
save them in variable-storage area. The db-keys are saved in variables of
format S9(8) COMP. The saved db-keys can later be used to access records
directly using OBTAIN DB-KEY statement.

The NEXT, PRIOR and OWNER formats access db-keys of records with
reference to set currencies; these records are not physically accessed. It may be
noted that ACCEPT gives no indication of end-of-set conditions for NEXT or
PRIOR formats. It would be advisable to determine whether a record is
connected to an owner on a set before attempting to retrieve its owners db-
key.

The db-key of the most recently accessed (i.e. current of run unit) is available
in a variable DBKEY in SUBSCHEMA-CTRL.

Errors
Code Meaning
0000 Successful
1506 Currency has not been established for record, area or set
1508 The object record is not in the subschema. The program has
probably invoked the wrong subschema

Example
MOVE 0001 TO DEPARTMENT-CODE
OBTAIN CALC DEPARTMENT
...
MOVE JOHN TO EMPLOYEE-NAME
OBTAIN EMPLOYEE WITHIN DEPARTMENT-EMPLOYEE
USING EMPLOYEE-NAME
...
Get record currency of DEPARTMENT
ACCEPT WS-DEPT-DBKEY FROM DEPARTMENT CURRENCY

Bhooshan Nagaokar 60
Essential IDMS
Get set currency of DEPARTMENT-EMPLOYEE
Caution: This may be a db-key of the owner or the member
Hence be careful when using this db-key to retrieve the right record
ACCEPT WS-EMP-DBKEY FROM DEPARTMENT-EMPLOYEE
CURRENCY
...
Get set currency of DEPARTMENT-EMPLOYEE, but the NEXT
occurrence
Caution: the statement has no means to detect end-of-set for NEXT or
PRIOR
ACCEPT WS-EMP-N-DBKEY FROM DEPARTMENT-EMPLOYEE
NEXT CURRENCY

Populate calc-key to access an EMPLOYEE record


MOVE 0001 TO EMPLOYEE-CODE
OBTAIN CALC EMPLOYEE
IF DB-REC-NOT-FOUND
GO TO EXIT
END-IF

Get currency of owner of EMPLOYEE


Caution: the employee may not be connected to DEPARTMENT owner
In such a case the statement has no means to detect this fact
ACCEPT WS-EMP-O-DBKEY FROM DEPARTMENT-EMPLOYEE
OWNER CURRENCY

Bhooshan Nagaokar 61
Essential IDMS

10.21 RETURN

Syntax
RETURN database-key FROM set-name CURRENCY
RETURN database-key FROM set-name FIRST
RETURN database-key FROM set-name LAST
RETURN database-key FROM set-name NEXT
RETURN database-key FROM set-name PRIOR
RETURN database-key FROM set-name USING sort-key

Execution
These statements access db-keys of records that are members on system-
owned-indexed set. The db-key of a specific record is retrieved based on the
format of the statement; it is then placed in the variable database-key. Ensure
that FIRST, LAST or USING formats are used to establish set-currency before
using NEXT, PRIOR or CURRENCY formats.

Errors
Code Meaning
0000 Successful
1706 Currency is not established for record, area or set

Example
Populate sort-key and access set-currency on IX-DEPT-NAME
MOVE 0001 TO DEPARTMENT-NAME
RETURN WS-DEPT-KEY FROM IX-DEPT-NAME
USING DEPARTMENT-NAME

Now, access db-key of occurrence prior to the set-currency
Caution: the statement has no means to detect end-of-set
RETURN WS-DEPT-PRIOR FROM IX-DEPT-NAME PRIOR

Now, access db-key of occurrence next to the set-currency
Caution: the statement has no means to detect end-of-set
RETURN WS-DEPT-NEXT FROM IX-DEPT-NAME NEXT

Bhooshan Nagaokar 62
Essential IDMS

10.22 BIND RUN-UNIT

Syntax
BIND RUN-UNIT
BIND RUN-UNIT FOR subschema-name TO subschema-control-location
BIND RUN-UNIT NODENAME dds-node-name
BIND RUN-UNIT DBNAME database-name

Execution
This statement signs on the run-unit to the DBMS. It identifies to IDMS the
location of IDMS communication block, and names the subschema to be
loaded for run-unit. It also names the DDS node under which the run-unit will
execute and identifies the database to be accessed. It enables the program to
sign-on to the database and starts a transaction. It must be the first functional
DML statement of the program.

Errors
Code Meaning
0000 Successful
1400 BIND RUN-UNIT statement cannot be recognized. Usually occurs
when IDMS communication block (SUBSCHEMA-CTRL) is not
aligned on a full-word boundary
1467 The subschema invoked does not match the subschema object
tables
1469 The run-unit is not bound to the DBMS. This means that the CV is
not active or is not accepting new run-units. Or the run-units
connection with CV is broken due to time-out or other factors
1472 The memory available is insufficient to dynamically load a
subschema or database procedure
1473 The CV is not accepting new run-units
1474 The subschema was not found in the dictionary load area or in the
load library
1477 The run-unit has been bound previously
1480 The DDS node specified in the NODENAME clause is not active or
has been disabled from the DDS configuration
1481 The database specified in the DBNAME clause is not known to
IDMS
1482 The named subschema is not allowed under the database specified
in the DBNAME clause
1483 The memory available is insufficient to allocate native VSAM work
areas

Example
BIND RUN-UNIT DBNAME WS-DBNAME

Bhooshan Nagaokar 63
Essential IDMS

Bhooshan Nagaokar 64
Essential IDMS

10.23 BIND RECORD

Syntax
BIND record-name
BIND record-name TO record-location
BIND record-location WITH record-name

Execution
This statement establishes addressability for a record in variable storage. It
communicates to IDMS the address of record-structure in the programs
variable storage area. Ensure that the application executes a BIND record-name
statement for every record-type that it accesses in the run-unit.

Errors
Code Meaning
0000 Successful
1408 The named record is not in the subschema. The program has
probably invoked a wrong subschema
1418 The record has been bound, improperly, to location 0

Example
BIND DEPARTMENT

BIND EMPLOYEE

Bhooshan Nagaokar 65
Essential IDMS

10.24 READY

Syntax
READY area-name USAGE MODE sub-mode mode

sub-mode: SHARED, PROTECTED, EXCLUSIVE


mode: RETRIEVAL, UPDATE

Execution
This statement prepares a database area for access in the specified usage
modes. It requests access to database areas, and in turn to records, in various
usage modes. The usage modes indicate the operations the readying run-unit
can or cannot perform against the database area. The usage modes can be
specified as follows.

Modes Meaning
RETRIEVAL For read-only operations. Prohibited from issuing STORE,
ERASE, MODIFY, CONNECT and DISCONNECT
functions
UPDATE For read as well as update operations. Permitted to issue all
DML functions

Sub-modes Meaning
SHARED Permit other run-units to concurrently access the area
PROTECTED Prohibit other run-units from readying in UPDATE mode
EXCLUSIVE Prohibit other run-units from readying in ANY mode

IDMS applies permissibility rules whenever a run unit attempts to ready an


area that other run units have already readied. The rules are as follows:

Allow current RU to Ready in Only if other RUs have readied in


Shared Retrieval Shared or Protected
Shared Update Shared
Protected Retrieval Shared or Protected Retrieval
Protected Update Shared Retrieval

The permissibility rules are represented in matrix form as follows:


SR SU PR PU ER EU
Shared Retrieval Y Y Y Y N N
Shared Update Y Y N N N N
Protected Retrieval Y N Y N N N
Protected Update Y N N N N N
Exclusive Retrieval N N N N N N

Bhooshan Nagaokar 66
Essential IDMS
Exclusive Update N N N N N N

Errors
Code Meaning
0000 Successful
0910 The subschema specifies an access restriction that prohibits
readying the area in the specified usage mode
0928 The run-unit has attempted to ready the are that has been readied
previously
0966 An update usage mode has been specified, but the named area is not
available for update, or the area has been varied off-line from the
CV
0970 The database or journal file will not ready properly; a JCL error is
the probable cause

Example
READY EMPLOYEE-AREA
USAGE MODE SHARED RETRIEVAL

Bhooshan Nagaokar 67
Essential IDMS

10.25 COMMIT

Syntax
COMMIT
COMMIT ALL

Execution
This statement writes a Commit checkpoint to journal and updates IDMS
communication block. It makes changes to database permanent for the unit of
work and signifies a start or end of a recovery unit. It simulates a FINISH-
BIND-READY sequence without relinquishing control of database resources.

COMMIT does not release implicit shared locks and retains currencies. When
the optional ALL is used with COMMIT, it releases all locks and nullifies
currencies.

Errors
Code Meaning
0000 Successful

Bhooshan Nagaokar 68
Essential IDMS

10.26 ROLLBACK

Syntax
ROLLBACK
ROLLBACK CONTINUE

Execution
This statement requests recovery of a unit of work. It undoes changes to
database and indicates database to be restored to the most recent checkpoint. It
clears all information in system buffers, writes an Abort checkpoint, nullifies
currencies and terminates run-unit. The database cannot be accessed without
re-issuing a BIND-READY sequence.

When an optional CONTINUE is used with ROLLBACK, the recovery unit is


rolled back but the run-unit is not terminated. Database access can be resumed
without issuing BIND-READY sequence. The CONTINUE option applies only
to programs running under CV.

Errors
Code Meaning
0000 Successful

Bhooshan Nagaokar 69
Essential IDMS

10.27 FINISH

Syntax
FINISH

Execution
This statement terminates a transaction or run-unit. It releases all resources
associated with run-unit and relinquishes control over all areas used by the
application. It writes statistical information for database operations performed
during run-unit execution to IDMS journal file. It defines and logs the end
checkpoint to journal.

FINISH should be the last functional DML statement in the application. No


further DML operations are permissible after issuing a FINISH. In some
situations the application may use FINISH to change area usage modes defined
by previous READY statements. In such cases the application is required to
execute BIND RUN-UNIT, BIND record-name and READY area-name
statements, and then continue to access areas in the new usage modes.

Errors
Code Meaning
0000 Successful

Bhooshan Nagaokar 70
Essential IDMS

12.0 Error Codes


After executing a DML statement, IDMS returns a 4-character error-code. Error code is stored
in a variable ERROR-STATUS in SUBSCHEMA-CTRL. The variable usually has various
values defined as condition names. Some of the common ones being

Error code Condition name


0000 NO-ERROR
0307 DB-END-OF-SET
0307 DB-END-OF-AREA
0326 DB-REC-NOT-FOUND
0001 9999 ANY-ERROR

The error-code structure is as follows:


Chars 1-2: Major code - signifies the type of DML operation
Chars 3-4: Minor code - signifies the nature of error

If any DML operation is successful, IDMS returns 0000.

Error codes are described in detail in the following sub-sections.

12.1 Major Error codes

Major Code Database Function


00 Any DML statement
01 FINISH
02 ERASE
03 FIND/OBTAIN
05 GET
06 KEEP
07 CONNECT
08 MODIFY
09 READY
11 DISCONNECT
12 STORE
14 BIND
15 ACCEPT
16 IF
17 RETURN
18 COMMIT

Bhooshan Nagaokar 71
Essential IDMS
19 ROLLBACK
20 LRF Requests

Bhooshan Nagaokar 72
Essential IDMS

12.2 Minor Error codes

Minor Database Function Status


Code
00 This status combined with a major code of 00 indicates successful
completion of DML operation in question. Combined with a non-zero
major code, this status code indicates that the DML operation was not
completed due to Central Version causes, such as time-outs and program
checks.
01 An area has not been readied. When this code is combined with a major
code of 16, an IF operation has resulted in a valid false condition.
02 The db-key used with a FIND/OBTAIN DB-KEY statement or the direct
db-key suggested for a STORE is not within the page range for the
specified record name.
04 The occurrence count of a subordinate element has been specified as less
than zero or greater than the maximum number of occurrences of the
variably-occurring control element.
05 The specified DML function would have violated a duplicates-not-
allowed option for a calc, sorted or index set.
06 No currency has been established for the named record, set or area.
07 The end of a set, area or index has been reached or set is empty.
08 An invalid record or set name has been specified or the record is not a
member of the set.
09 The area has been readied with an incorrect usage mode.
10 An existing access restriction or subschema usage prohibits execution of a
specified DML function. For SPF users, this code may also indicate
improper use of the ERASE statement. For LRF users, the subschema in
use allows access to database records only; combined with major code of
00, this code means the program has attempted to access a database
record, but the subschema in use allows access to logical records only.
11 The record cannot be stored in the specified area due to insufficient space.
12 There is no db-key for the record to be stored. This is a system internal
error.
13 A current record of run unit has not been established or has been nullified
by a previous ERASE statement.
14 The CONNECT statement cannot be executed because the object record
has been defined as a mandatory automatic member of the set.
15 The DISCONNECT statement cannot be executed because the object
record has been defined as a mandatory member of the set.
16 The record cannot be connected to a set in which it is already a member.
18 The record has not been bound.
20 The current record is not the same type as the specified record name.
21 Not all areas being used have been readied in the correct usage mode.
22 The record name specified is not currently a member of the set name
specified,

Bhooshan Nagaokar 73
Essential IDMS
23 Either the area name specified has not been included in the subschema
invoked, or the record name specified has not been defined within the area
name.
25 No currency has been established for the named set.
26 The record name or SPF index entry cannot be found, or no duplicates
exist for the named record.
28 The run unit has attempted to ready an area that has been readied
previously.
29 The run unit has attempted to place a lock on a record that is locked
already by another run unit. A deadlock results. Unless the run unit issued
either a FIND/OBTAIN KEEP EXCLUSIVE or a KEEP EXCLUSIVE,
the run unit is aborted.
30 An attempt has been made to erase the owner record of a non-empty set.
31 The retrieval statement format conflicts with the records location mode.
32 An attempt to retrieve a CALC/DUPLICATE record was unsuccessful;
the value of the CALC field in variable storage is not equal to the value of
the CALC control element in the current record of run unit.
33 All the sets in which the record participates have not been included in the
subschema.
40 The WHERE clause in an OBTAIN NEXT logical-record request is
inconsistent with a previous OBTAIN FIRST or OBTAIN NEXT
command for the same record. Previously specified criteria, such as
reference to a key field, have been changed. A path status of LR-ERROR
is returned to the LRC block.
41 The subschema contains no path that matches the WHERE clause in a
logical-record request. A path status of LR-ERROR is returned to the
LRC block.
43 A program check has been recognized during evaluation of a WHERE
clause indicating that data in variable storage or in a database record does
not conform to its description, or that a WHERE clause has specified
comparison of a packed decimal field to an unpacked non-numeric data
field. A path status of LR-ERROR is returned to the LRC block unless the
DBA has included an ON clause to override this action in the path.
44 The WHERE clause in a logical-record request does not supply a key
element (sort-key, calc-key, or db-key) expected by the path. A path status
of LR-ERROR is returned to the LRC block.
45 A program check has revealed a subscript-out-of-range during evaluation
of the WHERE clause in a logical-record request. A path status of LR-
ERROR is returned to the LRC block unless the DBA has included an ON
clause to override this action in the path.
46 A program check has revealed an arithmetic expression (for example:
overflow, under-flow, significance, divide) during evaluation of a
WHERE clause. A path status of LR-ERROR is returned to the LRC
block unless the DBA has included an ON clause to override this action in
the path.

Bhooshan Nagaokar 74
Essential IDMS
53 The subschema definition of an indexed set does not match the indexed
sets physical structure in the database.
54 Either the prefix length of an SR51 record is less than zero or the data
length is less than or equal to zero.
55 An invalid length has been defined for a variable-length record.
56 An insufficient amount of memory is available to accommodate the CA-
IDMS/DB compression / decompression routines.
60 A record type specified is inconsistent with the named set. This usually
indicates a broken chain.
61 No record can be found for the specified db-key. This usually indicates a
broken chain.
62 A system generated db-key points to a record-occurrence, but no record
with that db-key can be found. This usually indicates a broken chain.
63 The DBMS cannot interpret the DML function to be performed. When
combined with a major code of 00, this code means invalid function
parameters have been passed on the call to the DBMS. For LRF users, a
WHERE clause includes a keyword that is longer than 32 characters
allowed.
64 The record cannot be found; the calc control element has not been
described properly in the subschema.
65 The database page read was not the page requested.
66 The area specified is not available for update, or requested usage mode.
67 The subschema invoked does not match the subschema object tables.
68 The CICS interface was not started.
69 The BIND RUN-UNIT may not have been issued; the CV may be inactive
or not accepting new run-units; or the connection with the CV may have
been broken due to time out or other factors. When combined with a
major code of 00, this code means the program has been disconnected
from the DBMS.
70 The database or journal file will not ready properly; a JCL error is
probably the cause.
71 The page range or page group for the area being readied or the page
requested cannot be found in the DMCL.
72 There is insufficient memory to load dynamically a subschema or database
procedure.
73 A central version run unit will exceed the MAXERUS value as specified
at CV generation.
74 The dynamic load of a module has failed. If operating under CV, a
subschema or database procedure module was not found in the data
dictionary or the load (core image) library, or, if loaded, will exceed the
number of subschema and database procedures provided for at CV
generation.
75 A read error has occurred.
76 A write error has occurred.
77 The run unit has not been bound or has been bound twice. When

Bhooshan Nagaokar 75
Essential IDMS
combined with a major code of 00, this code means either the program is
no longer signed on to the subschema or the variable subschema tables
have been overwritten.
78 An area wait deadlock has occurred.
79 The run unit has requested more db-key locks than are available to the
system.
80 The target node is not active or has been disabled from the DDS
configuration.
81 The database name specified is not known to the CV. OR the converted
subschema requires specified database name to be in the DBNAME table.
82 The subschema is not allowed under the specified database. Or the
subschema must be named in the DBNAME table.
83 An error has occurred in accessing native VSAM datasets.
91 The subschema requires a DBNAME to do the bind run unit.
92 No subschema areas map to DMCL.
93 A subschema area symbolic was not found in DMCL.
94 The specified dbname is neither a dbname defined in the DBNAME table,
nor the SEGMENT defined in the DMCL.
95 The specified subschema failed DBTABLE mapping using the specified
dbname.

Bhooshan Nagaokar 76
Essential IDMS

12.3 Common Errors (Minor codes and interpretation)

00 No Error
0000 No error on any DML function, Major code is also 00
1400 For BIND BIND RUN-UNIT or BIND record-name was not issued

01 Area not readied, set not empty, record not member of set
0301 For FIND/OBTAIN object record area was not readied
1601 For IF operation resulted in false condition
2001 For LRF requested logical record was not in subschema

02 Db-key not within page range of area


0302 For FIND/OBTAIN db-key was not consistent with record area
1202 For STORE db-key was not within page range of area

04 Occurs-depending-on value not within range, object record with zero


sequence number sought
0304 For FIND/OBTAIN an attempt to read a record with zero sequence
number
0804 For MODIFY occurs-depending-on item is out of range
1204 For STORE occurs-depending-on item is out of range

05 Duplicates Not Allowed condition


0705 For CONNECT connection of record will cause Duplicates Not
Allowed condition
0805 For MODIFY modification of calc-key, sort-key or index-key will
cause Duplicates Not Allowed condition
1205 For STORE storing the record will cause Duplicate Not Allowed
condition

06 Currency not established


0306 For FIND/OBTAIN record, set or area was accessed before it was
made current record
0506 For GET an unqualified GET was issued before currency was
established
0606 For KEEP KEEP was issued before currency was established for
record, set or area
0706 For CONNECT a CONNECT was issued before currency was
established for record or set
1106 For DISCONNECT a DISCONNECT was issued for a record that has
been erased
1606 For IF an IF follows an ERASE which removed the run-unit currency

Bhooshan Nagaokar 77
Essential IDMS
07 End of set, area or index
0307 For FIND/OBTAIN the end of set, area or index was reached. Or the
set was empty
1707 For RETURN a RETURN cannot be processed because it has reached
the end of set. Or the set is empty

08 Invalid record, set, procedure or LR verb


0208 For ERASE the record is not in the subschema
0308 For FIND/OBTAIN the record or set name is incorrect
0508 For GET the record is not in the subschema
0608 For KEEP the record is not in the subschema
0708 For CONNECT the record or set is not in the subschema. Or the
record is not a member of the set
1108 For DISCONNECT the record or set is not in the subschema or the
record is not a member of the set
1208 For STORE the record is not in the subschema
1408 For BIND the record or procedure is not in the subschema
1508 For ACCEPT the record, set or procedure is not in the subschema
1608 For IF the record or set is not in the subschema. Or the record-type of
the record is not defined in the subschema
2008 For LRF the logical record is not defined in the subschema. Or the
DML verb is not permitted

09 Area readied for retrieval, but update required


0209 For ERASE the record area has not been readied in update usage mode
0709 For CONNECT the record area has not been readied in update usage
mode
0809 For MODIFY the record area has not been readied in update usage
mode
1109 For DISCONNECT the record area has not been readied in update
usage mode
1209 For STORE the record area has not been readied in update usage mode

10 Unauthorized function, Security violation


0010 For a database record functions, USAGE IS LR is used which restricts
access to logical records only
0210 For ERASE the option ERASE IS NOT ALLOWED was detected
0310 For FIND/OBTAIN the option FIND IS NOT ALLOWED was
detected
0510 For GET the option GET IS NOT ALLOWED was detected
0610 For KEEP the option KEEP IS NOT ALLOWED was detected
0710 For CONNECT the option CONNECT IS NOT ALLOWED was
detected
0810 For MODIFY the option MODIFY IS NOT ALLOWED was detected

Bhooshan Nagaokar 78
Essential IDMS
0910 For READY an access restriction that prevents the READY function
was detected
1110 For DISCONNECT the option DISCONNECT IS NOT ALLOWED
was detected
1210 For STORE the option STORE IS NOT ALLOWED was detected
2010 For LRF USAGE IS DML is used which restricts access to database
records only

11 Insufficient space in area for record


0811 For MODIFY database page in area and page-range is not large
enough to hold the modified record
1211 For STORE database page in area and page-range is not large enough
to hold the stored record

13 No run-unit currency has been established. Or an ERASE has invalidated


run-unit currency
0813 For MODIFY the run-unit currency has been invalidated by an ERASE
1613 For IF run-unit currency has not been established

14 CONNECT invalid for Mandatory-Automatic set


0714 For CONNECT cannot connect a record on Mandatory-Automatic set

15 DISCONNECT invalid for Mandatory set


1115 For DISCONNECT cannot disconnect a record on Mandatory set

16 Record already a member of set


0716 For CONNECT the record is already a member of the set

18 Record has not been bound


0318 For FIND CALC the record is not bound
0518 For GET the record is not bound
1218 For STORE the record is not bound
1418 For BIND an attempt to bind record location or procedure location to
location 0 is invalid
1518 For ACCEPT a bind procedure has not been issued. Or database
statistics location or procedure control location is 0
2018 For LRF a FIND CALC was issued on a database record that was not a
part of logical record

20 Record type of current record of run-unit does not agree with record in
DML statement
0220 For ERASE current record of run-unit is not the same type as named
record

Bhooshan Nagaokar 79
Essential IDMS
0520 For GET current record of run-unit is not the same type as named
record
0820 For MODIFY current record of run-unit is not the same type as named
record

21 Not all areas being updated have been readied in Update mode
0221 For ERASE not all areas being updated have been readied in Update
mode. Or not all records, sets, and areas have been included in
subschema
0721 For CONNECT not all areas being updated have been readied in
Update mode. Or not all records, sets, and areas have been included in
subschema
0821 For MODIFY not all areas being updated have been readied in Update
mode. Or not all records, sets, and areas have been included in
subschema
1121 For DISCONNECT not all areas being updated have been readied in
Update mode. Or not all records, sets, and areas have been included in
subschema
1221 For STORE not all areas being updated have been readied in Update
mode. Or not all records, sets, and areas have been included in
subschema

22 Record not a member of set


1122 For DISCONNECT the record is not a member of the set

23 The area-name is not in the subschema


0323 For FIND/OBTAIN the area-name is not in the subschema
0623 For KEEP the area-name is not in the subschema
0923 For READY the area-name is not in the subschema
1523 For ACCEPT DBKEY FROM AREA the area-name is not in the
subschema

25 Currency not established for set


1225 For STORE the set occurrence has not been established for each set
where the record is an Automatic member

26 Record or Index not found. Or no more duplicates for the record


0226 For ERASE a broken chain was detected
0326 For FIND/OBTAIN the requested record cannot be found
0526 For GET the object record has been erased
0626 For KEEP the record being kept is erased
1726 For RETURN the requested index entry cannot be found

Bhooshan Nagaokar 80
Essential IDMS
28 Area already readied
0928 For READY a READY has already been executed

30 Record owns non-empty set


0230 For ERASE the record being erased is the owner of a non-empty set
occurrence

31 Statement format conflicts with location mode


0331 For FIND/OBTAIN CALC a record being retrieved has no CALC
location mode
0331 For FIND/OBTAIN WITHIN set-name USING sort-key a record is
being retrieved on a set that is not sorted

32 CALC values in working-storage and current record do not agree


0332 For FIND/OBTAIN DUPLICATE the CALC key values in the program
and the current record are not equal

33 All required sets not included in subschema


0233 For ERASE all request sets have not been defined
0833 For MODIFY all request sets have not been defined
1233 For STORE all request sets have not been defined

37 Cyclical relationship terminated ERASE


0237 For ERASE PERMANENT/SELECTIVE/ALL MEMBERS a cyclical
relationship was detected between two or more records marked for
deletion

52 An incomplete variable length record was read


0352 For FIND/OBTAIN an incomplete record was read on a system
generated with RETRIEVAL NOLOCK because the STORE was still in
progress

54 Invalid record description (SR51) in subschema table


1254 For STORE the prefix length of an SR51 record is less than zero. Or the
data length is less than or equal to zero

55 An invalid length has been defined for variable-length record


0555 For GET the variable-length record being read has an invalid length
0855 For MODIFY the variable-length record has an invalid length
1255 For STORE the variable-length record has an invalid length

56 Insufficient memory for compression/decompression routines


0356 For FIND/OBTAIN not enough memory is available to hold the

Bhooshan Nagaokar 81
Essential IDMS
decompressed record

60 A record has been encountered whose type is inconsistent with the named set
0260 For ERASE a record occurrence was detected whose type is inconsistent
with the set named in the error set field
0360 For FIND/OBTAIN a record occurrence was detected whose type is not
a member or owner of set as defined in the subschema
0860 For MODIFY a record occurrence was detected whose type is
inconsistent with the set named in the error set field
1260 For STORE a record occurrence detected while connecting Automatic
sets was inconsistent with the set named in the error set field

64 The CALC control element has not been described properly


0364 For FIND/OBTAIN the record is included in the subschema with a
CALC location mode, but the CALC control element has not been
included in the subschema view of the record
2064 For LRF a path command attempted to access database record with
CALC location mode, but the CALC control element has not been
described in the subschema

66 The area specified is not available in the requested usage mode


0966 For READY the area is not available in the requested usage mode

67 The subschema invoked does not match the subschema object table
1467 For BIND RUN-UNIT the subschema is invalid subschema load
module. Or the internal name in subschema load module does not match
the subschema name

69 The run-unit has not been bound to the DBMS


1469 For BIND RUN-UNIT this indicates several problems
The central version is not active or is not accepting new run-units
The program is not registered
The run-units connection to central version has been broken due to
time-out

70 The file will not open properly


0370 For FIND/OBTAIN the database file cannot be opened
0970 For READY the database file cannot be opened
1470 For BIND RUN-UNIT the journal file cannot be opened

71 The page-range or page-group cannot be found in the DMCL


0971 For READY the page-range or page-group for area being readied cannot
be found in the DMCL

Bhooshan Nagaokar 82
Essential IDMS

72 Insufficient memory is available for the load or storage allocation


xx72 For any DML there is not enough memory available to load the
database procedure
1472 For BIND there is not enough memory available to load the subschema
load module
2072 For LRF there is not enough memory available for the work areas
required to evaluate the WHERE clause

73 A new run-unit would exceed the MAXERUS value in the CV generation


1473 For BIND RUN-UNIT a run-unit was prevented from signing on
because it would have caused MAXERUS to be exceeded

74 The dynamic load of a module has failed


xx74 For any DML the database procedure was not loaded from the load
library. The likely cause is an I/O error or bad module
1474 For BIND an attempt to load a module from the load library failed.
The likely cause is an I/O error or bad module

77 The run-unit has not been bound or has been bound twice
1477 For BIND RUN-UNIT the run-unit was previously bound

78 The area wait deadlock has occurred


0978 For READY AREA if a wait was issued, a deadlock would occur

80 The target mode is not active or has been disconnected


1480 For BIND RUN-UNIT the following conditions may cause this
The node is not active or has been disconnected
The node name is incorrect or misspelt

81 The database-name specified is not known


1481 For BIND RUN-UNIT the subschema was not found in the database-
name table but the database was defined with mapping mandatory

82 The subschema is not allowed under the specified database


1482 For BIND RUN-UNIT the subschema cannot be loaded in the
database-name table and database was defined with ALWAYS option

84 Threshold for number of tries to lock an area has been exceeded


0984 For READY AREA the threshold for number of tries to lock an area
has been exceeded

91 Database name not established

Bhooshan Nagaokar 83
Essential IDMS
1491 For BIND RUN-UNIT the DBNAME was not established

92 No logical area maps to physical area


1492 For BIND RUN-UNIT the subschema does not specify a logical area
that maps to a physical area when using the DBNAME

93 Symbolic value for area doesnt match DMCL


1493 For BIND RUN-UNIT the area-name is specified in a symbolic value
does not match value in DMCL

94 DBNAME does not match any database-name defined


1494 For BIND RUN-UNIT the DBNAME specified does not match any
database-name in the database-name table or any segment defined in the
DMCL

95 Subschema not defined in default section of database-name table


1495 For BIND RUN-UNIT the subschema was not defined in default
section of database-name table

12.3 Common Errors (Major Minor)

Code Description
xx72 For any DML there is not enough memory available to load the database
procedure
xx74 For any DML the database procedure was not loaded from the load
library. The likely cause is an I/O error or bad module

00 NO ERROR
0000 No error on any DML function, Major code is also 00
0010 For a database record functions, USAGE IS LR is used which restricts
access to logical records only

02 ERASE
0208 For ERASE the record is not in the subschema
0209 For ERASE the record area has not been readied in update usage mode
0210 For ERASE the option ERASE IS NOT ALLOWED was detected
0220 For ERASE current record of run-unit is not the same type as named
record
0221 For ERASE not all areas being updated have been readied in Update
mode. Or not all records, sets, and areas have been included in subschema
0226 For ERASE a broken chain was detected

Bhooshan Nagaokar 84
Essential IDMS
0230 For ERASE the record being erased is the owner of a non-empty set
occurrence
0233 For ERASE all request sets have not been defined
0237 For ERASE PERMANENT/SELECTIVE/ALL MEMBERS a cyclical
relationship was detected between two or more records marked for deletion
0260 For ERASE a record occurrence was detected whose type is inconsistent
with the set named in the error set field

03 FIND/OBTAIN
0301 For FIND/OBTAIN object record area was not readied
0302 For FIND/OBTAIN db-key was not consistent with record area
0304 For FIND/OBTAIN an attempt to read a record with zero sequence
number
0306 For FIND/OBTAIN record, set or area was accessed before it was made
current record
0307 For FIND/OBTAIN the end of set, area or index was reached. Or the set
was empty
0308 For FIND/OBTAIN the record or set name is incorrect
0310 For FIND/OBTAIN the option FIND IS NOT ALLOWED was detected
0318 For FIND CALC the record is not bound
0323 For FIND/OBTAIN the area-name is not in the subschema
0326 For FIND/OBTAIN the requested record cannot be found
0331 For FIND/OBTAIN CALC a record being retrieved has no CALC location
mode
0331 For FIND/OBTAIN WITHIN set-name USING sort-key a record is being
retrieved on a set that is not sorted
0332 For FIND/OBTAIN DUPLICATE the CALC key values in the program
and the current record are not equal
0352 For FIND/OBTAIN an incomplete record was read on a system generated
with RETRIEVAL NOLOCK because the STORE was still in progress
0356 For FIND/OBTAIN not enough memory is available to hold the
decompressed record
0360 For FIND/OBTAIN a record occurrence was detected whose type is not a
member or owner of set as defined in the subschema
0364 For FIND/OBTAIN the record is included in the subschema with a CALC
location mode, but the CALC control element has not been included in the
subschema view of the record
0370 For FIND/OBTAIN the database file cannot be opened

05 GET
0506 For GET an unqualified GET was issued before currency was established
0508 For GET the record is not in the subschema
0510 For GET the option GET IS NOT ALLOWED was detected
0518 For GET the record is not bound
0520 For GET current record of run-unit is not the same type as named record

Bhooshan Nagaokar 85
Essential IDMS
0526 For GET the object record has been erased
0555 For GET the variable-length record being read has an invalid length

06 KEEP
0606 For KEEP KEEP was issued before currency was established for record,
set or area
0608 For KEEP the record is not in the subschema
0610 For KEEP the option KEEP IS NOT ALLOWED was detected
0623 For KEEP the area-name is not in the subschema
0626 For KEEP the record being kept is erased

07 CONNECT
0705 For CONNECT connection of record will cause Duplicates Not Allowed
condition
0706 For CONNECT a CONNECT was issued before currency was established
for record or set
0708 For CONNECT the record or set is not in the subschema. Or the record is
not a member of the set
0709 For CONNECT the record area has not been readied in update usage mode
0710 For CONNECT the option CONNECT IS NOT ALLOWED was detected
0714 For CONNECT cannot connect a record on Mandatory-Automatic set
0716 For CONNECT the record is already a member of the set
0721 For CONNECT not all areas being updated have been readied in Update
mode. Or not all records, sets, and areas have been included in subschema

08 MODIFY
0804 For MODIFY occurs-depending-on item is out of range
0805 For MODIFY modification of calc-key, sort-key or index-key will cause
Duplicates Not Allowed condition
0809 For MODIFY the record area has not been readied in update usage mode
0810 For MODIFY the option MODIFY IS NOT ALLOWED was detected
0811 For MODIFY database page in area and page-range is not large enough to
hold the modified record
0813 For MODIFY the run-unit currency has been invalidated by an ERASE
0820 For MODIFY current record of run-unit is not the same type as named
record
0821 For MODIFY not all areas being updated have been readied in Update
mode. Or not all records, sets, and areas have been included in subschema
0833 For MODIFY all request sets have not been defined
0855 For MODIFY the variable-length record has an invalid length
0860 For MODIFY a record occurrence was detected whose type is inconsistent
with the set named in the error set field

09 READY
0910 For READY an access restriction that prevents the READY function was

Bhooshan Nagaokar 86
Essential IDMS
detected
0923 For READY the area-name is not in the subschema
0928 For READY a READY has already been executed
0966 For READY the area is not available in the requested usage mode
0970 For READY the database file cannot be opened
0971 For READY the page-range or page-group for area being readied cannot
be found in the DMCL
0978 For READY AREA if a wait was issued, a deadlock would occur
0984 For READY AREA the threshold for number of tries to lock an area has
been exceeded

11 DISCONNECT
1106 For DISCONNECT a DISCONNECT was issued for a record that has
been erased
1108 For DISCONNECT the record or set is not in the subschema or the record
is not a member of the set
1109 For DISCONNECT the record area has not been readied in update usage
mode
1110 For DISCONNECT the option DISCONNECT IS NOT ALLOWED was
detected
1115 For DISCONNECT cannot disconnect a record on Mandatory set
1121 For DISCONNECT not all areas being updated have been readied in
Update mode. Or not all records, sets, and areas have been included in
subschema
1122 For DISCONNECT the record is not a member of the set

12 STORE
1202 For STORE db-key was not within page range of area
1204 For STORE occurs-depending-on item is out of range
1205 For STORE storing the record will cause Duplicate Not Allowed
condition
1208 For STORE the record is not in the subschema
1209 For STORE the record area has not been readied in update usage mode
1210 For STORE the option STORE IS NOT ALLOWED was detected
1211 For STORE database page in area and page-range is not large enough to
hold the stored record
1218 For STORE the record is not bound
1221 For STORE not all areas being updated have been readied in Update
mode. Or not all records, sets, and areas have been included in subschema
1225 For STORE the set occurrence has not been established for each set where
the record is an Automatic member
1233 For STORE all request sets have not been defined
1254 For STORE the prefix length of an SR51 record is less than zero. Or the
data length is less than or equal to zero
1255 For STORE the variable-length record has an invalid length

Bhooshan Nagaokar 87
Essential IDMS
1260 For STORE a record occurrence detected while connecting Automatic sets
was inconsistent with the set named in the error set field

14 BIND
1400 For BIND BIND RUN-UNIT or BIND record-name was not issued
1408 For BIND the record or procedure is not in the subschema
1418 For BIND an attempt to bind record location or procedure location to
location 0 is invalid
1467 For BIND RUN-UNIT the subschema is invalid subschema load module.
Or the internal name in subschema load module does not match the
subschema name
1469 For BIND RUN-UNIT this indicates several problems
The central version is not active or is not accepting new run-units
The program is not registered
The run-units connection to central version has been broken due to
time-out
1470 For BIND RUN-UNIT the journal file cannot be opened
1472 For BIND there is not enough memory available to load the subschema
load module
1473 For BIND RUN-UNIT a run-unit was prevented from signing on because
it would have caused MAXERUS to be exceeded
1474 For BIND an attempt to load a module from the load library failed. The
likely cause is an I/O error or bad module
1477 For BIND RUN-UNIT the run-unit was previously bound
1480 For BIND RUN-UNIT the following conditions may cause this
The node is not active or has been disconnected
The node name is incorrect or misspelt
1481 For BIND RUN-UNIT the subschema was not found in the database-name
table but the database was defined with mapping mandatory
1482 For BIND RUN-UNIT the subschema cannot be loaded in the database-
name table and database was defined with ALWAYS option
1491 For BIND RUN-UNIT the DBNAME was not established
1492 For BIND RUN-UNIT the subschema does not specify a logical area that
maps to a physical area when using the DBNAME
1493 For BIND RUN-UNIT the area-name is specified in a symbolic value does
not match value in DMCL
1494 For BIND RUN-UNIT the DBNAME specified does not match any
database-name in the database-name table or any segment defined in the
DMCL
1495 For BIND RUN-UNIT the subschema was not defined in default section
of database-name table

15 ACCEPT
1508 For ACCEPT the record, set or procedure is not in the subschema
1518 For ACCEPT a bind procedure has not been issued. Or database statistics

Bhooshan Nagaokar 88
Essential IDMS
location or procedure control location is 0
1523 For ACCEPT DBKEY FROM AREA the area-name is not in the
subschema

16 IF
1601 For IF operation resulted in false condition
1606 For IF an IF follows an ERASE which removed the run-unit currency
1608 For IF the record or set is not in the subschema. Or the record-type of the
record is not defined in the subschema
1613 For IF run-unit currency has not been established

17 RETURN
1707 For RETURN a RETURN cannot be processed because it has reached the
end of set. Or the set is empty
1726 For RETURN the requested index entry cannot be found

20 LRF Requests
2001 For LRF requested logical record was not in subschema
2008 For LRF the logical record is not defined in the subschema. Or the DML
verb is not permitted
2010 For LRF USAGE IS DML is used which restricts access to database
records only
2018 For LRF a FIND CALC was issued on a database record that was not a
part of logical record
2064 For LRF a path command attempted to access database record with CALC
location mode, but the CALC control element has not been described in the
subschema
2072 For LRF there is not enough memory available for the work areas required
to evaluate the WHERE clause

Bhooshan Nagaokar 89
Essential IDMS
Calc-key A record element or a group of
13.0 Glossary elements designated as the symbolic key by
which a record-occurrence is stored in a specific
ACCEPT A DML function that is used to location in the database area, and by which the
retrieve db-keys of records most recently record can be retrieved during processing
accessed by the application.
CALC location mode A location mode whereby
Access restriction Security options that protect IDMS uses the value of the designated calc-key
the database from unauthorized access by to determine, by means of a randomizing
applications, access restrictions for areas, sets technique called hashing, the database page on or
and record-types are defined in the subschema near which the record is to be placed

Application Analogous to a program, function or Checkpoint An entry in the journal file that
a task that is executed to accomplish a specific determines a position after which run-unit
business task updates to the database can be reversed during
recovery
Area A logical subdivision of database that
consists of a group of contiguous database pages. Clustering A storage mode by which a record is
stored as close as possible to the ones which it is
Area-file mapping The process by which logical logically related to, the purpose of which is to
structure of database is related to the physical minimize I/Os
structure of the files on which it resides.
COMMIT A database access function that
Area lock A lock placed on a database area to writes checkpoint to journal, releases locks and
prevent concurrent access and update of records relinquishes currencies, it marks end of one
in it by independent run units. recovery unit and beginning of another

Area-sweep A process that retrieves CONNECT A DML function that establishes a


consecutively every record in an area, a selective record-occurrence as a member of a set-
areas sweep retrieves every record of a given occurrence
record-type in an area
Currency A technique that maintains database
Automatic membership A storage membership keys of most recently accessed records to
option that connects member records to a set indicate run-unit positions in the database during
when they are created in the database processing

Bill-of-material structure A many-to-many Current of area The most recently accessed


relationship among record-occurrences of the record-occurrence in each area accessed by the
same type. application

BIND A DML function that establishes Current of record-type The most recently
addressability in variable storage to IDMS accessed record-occurrence of each record-type
communication block, to the record-types, and accessed by the application
optionally to procedure control information.
Current of run unit The record-occurrence
Block A physical unit of storage in a file. most recently accessed by the application

Bhooshan Nagaokar 90
Essential IDMS
Current of set The most recently accessed FIND A DML function that locates a record-
record-occurrence in each set accessed by the occurrence in the database, but does not transfer
application its contents to variable storage

Data manipulation language Statements by FINISH A DML function that releases all
which applications access and manipulate resources, completes a run-unit and writes a final
contents of an IDMS database checkpoint to journal

Database A secondary storage facility in which GET A DML function that retrieves a located
all data is centralized and arranged independently record by transferring its contents from the
of applications database to variable storage

Database key (db-key) A unique identifier Hierarchy A one-to-many relationship that


assigned to each record-occurrence when it is exists between owner record-occurrence and the
stored in the database, it consists of records member record-occurrences of a set
page number and line index
IDMS Integrated Data(base) Management
Database management system IDMS supplied System, a CA software product that acts as an
object modules that perform database services intermediary between the application and
information stored in the database.
Dictionary A central storage facility or
repository provided by IDMS for maintaining IDMS central version A mode of operation that
data definitions, relationships, modules, allows many application programs to execute
documentation and run-time information concurrently and to share a single DBMS by
channeling requests from programs through a
DIRECT location mode The location mode that supervisor call to a service module present in the
permits the application to suggest actual page on central version of each program
which a record will be placed
IDMS communication block An area through
DISCONNECT A DML function that removes a which IDMS communicates with application
member record-occurrence from a set, but does regarding database service requests and where
not delete the record from the database IDMS places status information after performing
services
DML processor An IDMS-supplied program
that uses information from dictionary to verify IDMS DC A data communication system that is
and convert DML statements into host language fully integrated with IDMS for efficiency of
statements and to copy data descriptions code installation and execution
into source program
IDMS local mode An operating mode in which
ERASE A DML function that deletes a record- each batch program uses a dedicated copy of
occurrence from the database, and where IDMS
appropriate deletes records subordinate to it
IDMS-STATUS routine An error checking
File A physical unit of storage in which blocks routine contained in dictionary and copied into
are placed the application by DML processor to abend the
application if a non-zero value is present in error-
status

Bhooshan Nagaokar 91
Essential IDMS
Index record A record that is controlled by
Sequential Processing Facility (SPF) and Manual Membership A storage membership
contains a collection of pair of index keys and option that decides that a record is not connected
db-keys of IDMS record-occurrences to a set when it is created, it can be explicitly
connected by CONNECT DML function
Index set A set that associates an index record
with owner record, this index is a list of pointers Membership options A property of a set that
to member records and facilitates direct and decides how a record is connected or
ordered access to them disconnected from a set, it consists of removal
options that can be Mandatory or Optional and
Integrated data dictionary A CA product that storage options that can be Automatic or Manual
can be used to manage information in dictionary
and generate a variety of reports Member record A record that participates as a
subordinate in a set relationship
Journal file A file that is defined for the
database, it stores checkpoints as well as before Minor code The 3rd and 4th bytes of ERROR-
and after database record images for record- STATUS field that describe the status of the
occurrences updated during processing function identified by major code

Junction record The member record in multiple MODIFY A DML function that replaces the
set membership arrangement that permits many- contents of the database record that is current of
to-many relationships between its owners, and run unit with values in its corresponding
allows storing data specific to intersection of structure in variable storage
owner records
Navigation The process of searching sets and of
Line index An item that identifies the location of following member record pointers to locate
a record on a page, the line index is associated specific record-occurrences in the database
with a record and does not change throughout its
existence in the database Network A database construct in which many-
to-many relationships exist among record-types
Linkage options Options that allow the user to
specify types of pointers such as next, prior, Next linkage The type of set linkage in which
owner & index to be used in relating member and the owner and members of set-occurrence are
owner occurrences in a set linked by next pointers, thereby causing the
owner to point to the first member, the first
Location mode The manner in which a record- member to the second, and so on, with the last
occurrence is physically located in an area or member pointing to the owner
assigned to a particular database page in it,
location mode can be CALC, VIA or DIRECT OBTAIN A DML function that combines FIND
& GET functions to retrieve a record-occurrence
Major code The first two characters of value
returned in ERROR-STATUS field, this Owner linkage The type of set linkage in which
identifies the DML function that was performed the owner and members of a set are linked by
owner pointers thereby causing each member to
Mandatory membership A removal point to its owner
membership option that decides that records can
only be disconnected from a set when they are
deleted

Bhooshan Nagaokar 92
Essential IDMS
Owner record The record to which all other Record-type A defined generic group of similar
records in a set are subordinate, the super- record-occurrences
ordinate record
Recovery The process of restoring the database
Page A logical division of database that to an earlier state, recovery is required when
corresponds to a physical block in a file, all system fails or there is file I/O error
pages in an area are of the same size but page
size can vary from one area to another Recovery unit The part of run unit that falls
between two check points
Pointer Database key stored in record prefix that
indicates physical location of another related Rollback A database access function that
record-occurrence, in a set-occurrence records requests recovery of a run unit which restores the
contain pointer to represent their relationship, database to an earlier state, rollback process
pointers provide linkage between an owner and restores using record images in journal file
members or between members of a set-
occurrence Run unit The portion of IDMS processing that
begins with the BIND RUN UNIT function and
Prefix Portion of record-occurrence that contain ends with the FINISH function
pointers or database keys to related records,
prefix describes set relationship in form of Schema The part of database definition that
pointers such as next, prior, owner and index describes complete structure of the database
including names and description of files,
Prior linkage The type of set linkage in which elements, records, sets and areas
the owner and members of set-occurrence are
linked by prior pointers, thereby causing the Sequential processing facility An IDMS feature
owner to point to the last member, the last that enables one or more indexes of database
member to the one before last, and so on, with keys to be maintained for a record-type and
the first member pointing to the owner associated with that record-type through an index
set
READY A DML function that informs IDMS
which areas of the database the application Set-occurrence A relationship between record-
would access and in which usage mode occurrences that consist of any number of
member records for each occurrence of owner
Record element A logical subdivision of a record
record, also called a field
Set-type A defined generic group of similar set-
Record lock A lock placed on record-occurrence occurrences that express relationship between
to prevent access or update that record, locks are two or more record-types, where one record-type
used to protect integrity of database records is owner and other are members

Record-occurrence The basic addressable unit Storage mode Characteristics of record-type that
of data in IDMS, which consists of a fixed or indicates whether length of stored record if fixed
variable number of bytes called data and a set of (F), variable (V), fixed compressed (FC) or
pointers called record prefix variable compressed (VC)

Record prefix See Prefix STORE A DML function that places a new
record-occurrence into the database using data in
variable storage area

Bhooshan Nagaokar 93
Essential IDMS
Usage mode The manner in which a run unit will
Subschema A part of database definition, to be access a given database area, the usage mode
viewed by particular applications, that describes dictates whether a run unit will perform retrieval
a subset of data elements, record-types, set-types or update functions against records in the area
and areas defined in the schema and specifies the allowed extent of concurrent
usage of these records by other run units
Symbolic key One or more data elements in
record whose values are used to determine their User-owned-index An indexed set where the
location in the area, also called the calc-key owner is a record-occurrence of a specific type.

System-owned-index An indexed set where the VIA location mode The location mode that
owner is the system record which is invisible and clusters records, likely to be accessed together,
always accessed on the same page or on as few pages as possible

Bhooshan Nagaokar 94
Essential IDMS

14.0 Sample program


000100***************************************************************** 00010000
000200* INFORMATION AREA * 00020000
000300* 00030000
000400* PROGRAM ID : OHJD3BC 00040005
000500* 00050000
000600* PROGRAM TITLE : SWEEPS INST AREA AND PRODUCES AN OUTPUT 00060005
000700* FILE CONTAINING INSTANCES OF OBSOLETE 00070005
000800* PRODUCTS FOR ALL CURRENT INSTALLATIONS 00080005
000900* 00090005
001000* DATE WRITTEN : DEC 1999 00100005
001100* 00110000
001200* VERSION : 7.00 00120000
001300* 00130000
001400* AUTHOR : BHOOSHAN N. 00140005
001500* 00150000
001600* 00160000
001700* DOCUMENTS : NONE 00170000
001800* 00180000
001900* MAPS USED : NONE 00190000
002000* 00200000
002100* SCHEMA : SCCS00 00210000
002200* SUBSCHEMA : SSOHAA00 00220000
002300* 00230000
002400* DB RECORDS : INST 00240000
002500* CUST-PROD 00250005
002600* 00260000
002700* TEMP STORAGE : NONE 00270000
002800* PROGRAM CALLS : NONE 00280000
002900* PROGRAM LINKS : NONE 00290000
003000* COPYBOOKS : NONE 00300000
003100* 00310000
003200******************************************************************00320000
003300* A M E N D M E N T S 00330000
003400******************************************************************00340000
003500* 00350000
003600******************************************************************00360000
003700 00370000
003800 IDENTIFICATION DIVISION. 00380000
003900 00390017
004000 PROGRAM-ID. OHJD3BC. 00400005
004100 AUTHOR. BHOOSHAN N 0171 843 7521. 00410005
004200 DATE-WRITTEN. DEC 1999. 00420005
004400* 00440017
004500 ENVIRONMENT DIVISION. 00450000
004800* 00480017
004900 CONFIGURATION SECTION. 00490000
005000 00500017
005100 SOURCE-COMPUTER. IBM-3090. 00510000
005200* 00520017
005500 IDMS-CONTROL SECTION. 00550000
005700* 00570017
005800 PROTOCOL. 00580000
005900 MODE IS DB-BATCH DEBUG 00590000
006000 IDMS-RECORDS MANUAL LEVELS INCREMENTED BY 2. 00600000
006100* 00610017
006300 INPUT-OUTPUT SECTION. 00630000
006500* 00650017
006600 FILE-CONTROL. 00660000
006610 00661009
006620 SELECT OO-FILE ASSIGN TO OOFILE 00662009
006621 ORGANIZATION IS SEQUENTIAL 00662111
006622 ACCESS MODE IS SEQUENTIAL 00662211
006630 FILE STATUS IS OO-FILE-STATUS. 00663011
006700* 00670017
006800 DATA DIVISION. 00680000
006900* 00690017
007000 SCHEMA SECTION. 00700000
007100 DB SSOHAA00 WITHIN SCCS00. 00710000
007200 00720000

Bhooshan Nagaokar 95
Essential IDMS
007300* 00730017
007400 FILE SECTION. 00740000
007600 00760000
007610 FD OO-FILE 00761009
007620 BLOCK CONTAINS 0 RECORDS 00762009
007630 RECORDING MODE IS F 00763009
007640 LABEL RECORDS ARE STANDARD. 00764009
007641 00764110
007650 01 OO-RECORD. 00765009
007660 05 OO-INST-ID PIC X(12). 00766010
007670 05 OO-MAIN-LINE-ID PIC X(27). 00767010
007680 05 OO-PRODUCT-ID PIC X(06). 00768010
007690 05 OO-CONTRACT-TYPE PIC 9(02). 00769010
007691 05 OO-MAINT-SV-CODE PIC X(01). 00769110
007692 05 OO-CP-TOTAL-QTY PIC 9(04). 00769210
007693* Reclen 52 00769318
007800 00780000
007900* 00790017
008000 WORKING-STORAGE SECTION. 00800000
008300 00830000
008400 COPY IDMS DB-STATISTICS. 00840000
008500 COPY IDMS DB-STATUS-AREA. 00850000
008600 COPY IDMS SUBSCHEMA-CTRL. 00860000
008700 00870000
008800 COPY IDMS RECORD INST. 00880000
008900 COPY IDMS RECORD CUST-PROD. 00890005
009000 00900000
009010 01 OO-FILE-STATUS PIC XX. 00901009
009011 00901111
009012 01 WS-PRODUCT-ID PIC X(06). 00901213
009013 00901309
009014 01 WS-GO-NOGO-FLAG PIC X VALUE 'Y'. 00901409
009015 88 PROCESS-GO VALUE 'Y'. 00901509
009016 88 PROCESS-NOGO VALUE 'N'. 00901609
009020 00902009
009100 01 WS-COUNTERS. 00910009
009200 05 WS-TOT-CUSTPROD PIC 9(8) VALUE 0. 00920013
009300 05 WS-TOT-OO PIC 9(8) VALUE 0. 00930009
009600 00960000
009700 COPY LINKBC. 00970009
009800 00980000
009900*PROCEDURE DIVISION. 00990002
010400 01040015
010500 A000-MAIN-CONTROL SECTION. 01050000
010600*-----------------------------------------------------------------01060000
010700* NAME : MAIN CONTROL SECTION FOR THE PROGRAM 01070000
010800* DESCRIPTION : HIGH LEVEL CONTROL FOR ALL PROCESSING 01080000
010900* 01090000
011000* RETURN CODE : 01100000
011100* CALLS : B000,C000,D000 01110010
011200* CALLED BY : N/A 01120010
011300*-----------------------------------------------------------------01130000
011400 01140000
011500 01150000
011600 DISPLAY '*** OHJD3BC PROGRAM BEGINS ***' 01160019
011610 01161009
011611 PERFORM B000-BEGIN 01161109
011612 IF PROCESS-GO 01161209
011613 PERFORM C000-PROCESS 01161315
011614 PERFORM D000-END 01161409
011615 END-IF 01161509
011616 STOP RUN 01161609
014200 . 01420000
014400 A000-EXIT. 01440000
014500 EXIT. 01450000
014600 01460000
014601 B000-BEGIN SECTION. 01460109
014602*-----------------------------------------------------------------01460209
014603* NAME : BEGIN SECTION 01460309
014604* DESCRIPTION : Bind records, Ready areas, Open files 01460411
014605* RETURN CODE : 01460509
014606* CALLS : 01460609
014607* CALLED BY : A000. 01460709
014608*-----------------------------------------------------------------01460809

Bhooshan Nagaokar 96
Essential IDMS
014609 01460909
014610 MOVE 0000 TO RETURN-CODE 01461009
014620 MOVE 'OHJD3BC' TO PROGRAM-NAME 01462009
014630 01463009
014640 BIND RUN-UNIT DBNAME BTCH-DBNAME 01464009
014650 PERFORM Z998-IDMS-STATUS 01465009
014651 01465109
014660 BIND INST 01466009
014670 PERFORM Z998-IDMS-STATUS 01467009
014671 01467109
014672 BIND CUST-PROD 01467209
014673 PERFORM Z998-IDMS-STATUS 01467309
014674 01467409
014680 READY INST-AREA USAGE-MODE RETRIEVAL 01468009
014690 PERFORM Z998-IDMS-STATUS 01469009
014691 01469109
014692 OPEN OUTPUT OO-FILE 01469209
014693 IF OO-FILE-STATUS NOT = '00' 01469309
014694 DISPLAY '*** OHJD3BC ERROR IN OPENING OO FILE ***' 01469409
014695 MOVE 'N' TO WS-GO-NOGO-FLAG 01469509
014696 END-IF 01469609
014697 01469713
014698 MOVE EXTRA-PARMS TO WS-PRODUCT-ID 01469813
014699 . 01469909
014700 B000-EXIT. 01470009
014701 EXIT. 01470109
014702 01470209
014703 C000-PROCESS SECTION. 01470310
014704*-----------------------------------------------------------------01470410
014705* NAME : PROCESS SECTION 01470510
014706* DESCRIPTION : 01470610
014707* RETURN CODE : 01470710
014708* CALLS : 01470810
014709* CALLED BY : A000. 01470910
014710*-----------------------------------------------------------------01471010
014711 01471110
014712 OBTAIN FIRST CUST-PROD WITHIN INST-AREA 01471212
014713 PERFORM UNTIL DB-END-OF-SET 01471311
014714 PERFORM Z998-IDMS-STATUS 01471411
014715 01471513
014716 ADD 1 TO WS-TOT-CUSTPROD 01471613
014717 IF I1506-PRODUCT-ID = WS-PRODUCT-ID 01471713
014718 PERFORM C100-PROCESS-CUSTPROD 01471812
014719 END-IF 01471912
014720 01472013
014721 FIND CURRENT CUST-PROD 01472112
014722 OBTAIN NEXT CUST-PROD WITHIN INST-AREA 01472212
014723 END-PERFORM 01472311
014724 . 01472411
014725 C000-EXIT. 01472510
014726 EXIT. 01472610
014727 01472712
014728 C100-PROCESS-CUSTPROD SECTION. 01472812
014729*-----------------------------------------------------------------01472913
014730* NAME : PROCESS CUSTPROD SECTION 01473013
014731* DESCRIPTION : 01473113
014732* RETURN CODE : 01473213
014733* CALLS : 01473313
014734* CALLED BY : C000. 01473413
014735*-----------------------------------------------------------------01473513
014736 01473612
014737 OBTAIN OWNER WITHIN S-INST-CP 01473712
014738 PERFORM Z998-IDMS-STATUS 01473812
014739 01473912
014740 IF I1503-INST-STATUS = 'C' 01474013
014741 PERFORM C200-WRITE-OO-RECORD 01474112
014742 END-IF 01474212
014743 . 01474312
014744 C100-EXIT. 01474412
014745 EXIT. 01474512
014746 01474612
014747 C200-WRITE-OO-RECORD SECTION. 01474712
014748*-----------------------------------------------------------------01474813
014749* NAME : WRITE OO RECORD SECTION 01474913

Bhooshan Nagaokar 97
Essential IDMS
014750* DESCRIPTION : 01475013
014751* RETURN CODE : 01475113
014752* CALLS : 01475213
014753* CALLED BY : C100. 01475313
014754*-----------------------------------------------------------------01475413
014755 01475512
014756 INITIALIZE OO-RECORD 01475612
014757 01475712
014758 MOVE I1503-INST-ID TO OO-INST-ID 01475813
014759 MOVE I1503-MAIN-LINE-ID TO OO-MAIN-LINE-ID 01475913
014760 MOVE I1506-PRODUCT-ID TO OO-PRODUCT-ID 01476014
014761 MOVE I1506-CONTRACT-TYPE TO OO-CONTRACT-TYPE 01476114
014762 MOVE I1506-MAINT-SV-CODE TO OO-MAINT-SV-CODE 01476214
014763 MOVE I1506-CP-TOTAL-QTY TO OO-CP-TOTAL-QTY 01476314
014764 01476412
014765 WRITE OO-RECORD 01476512
014766 ADD 1 TO WS-TOT-OO 01476612
014767 . 01476712
014768 C200-EXIT. 01476812
014769 EXIT. 01476912
014770 01477010
014771 D000-END SECTION. 01477109
014772*-----------------------------------------------------------------01477209
014773* NAME : END SECTION 01477309
014774* DESCRIPTION : Close file, Display statistics, Finish 01477411
014775* RETURN CODE : 01477509
014776* CALLS : 01477609
014777* CALLED BY : A000. 01477709
014778*-----------------------------------------------------------------01477809
014779 01477909
014785 CLOSE OO-FILE 01478509
014786 IF OO-FILE-STATUS NOT = '00' 01478609
014787 DISPLAY '*** OHJD3BC ERROR IN CLOSING OO FILE ***' 01478709
014788 END-IF 01478809
014789 01478909
014790 FINISH 01479009
014791 01479117
014792 DISPLAY '*** OHJD3BC STATISICS ***' 01479219
014793 DISPLAY '*** CUST-PROD RECORDS ' WS-TOT-CUSTPROD 01479317
014794 DISPLAY '*** OUTPUT OO RECORDS ' WS-TOT-OO 01479417
014795 DISPLAY '*** OHJD3BC SUCESSFULLY ENDS ***' 01479519
014797 . 01479709
014798 D000-EXIT. 01479809
014800 EXIT. 01480009
017992 01799211
018000 COPY IDMS DB-IDMS-STATUS. 01800000
018100 01810017
018200 Z999-CLOSE-FILES SECTION. 01820002
018210*-----------------------------------------------------------------01821017
018300* NAME : CLOSE FILES SECTION 01830002
018400* DESCRIPTION : THIS SECTION CLOSES ANY OPEN FILES. 01840002
018500* : SETS RETURN CODE AND STOPS RUN. 01850002
018600* RETURN CODE : 01860002
018700* CALLS : N/A 01870002
018800* CALLED BY : Z998. 01880010
018900* : 01890002
019000*-----------------------------------------------------------------01900002
019100 01910002
019600 DISPLAY '*** OHJD3BC PROGRAM ABANDONED ***' 01960010
019700 01970002
019710 CLOSE OO-FILE 01971010
019720 IF OO-FILE-STATUS NOT = '00' 01972016
019721 DISPLAY '*** OHJD3BC ERROR IN CLOSING OO FILE ***' 01972110
019740 END-IF 01974010
019750 01975010
019800 FINISH 01980002
019900 STOP RUN 01990002
020100 . 02010002
020200 Z999-EXIT. 02020002
020300 EXIT. 02030002
020400 02040002
020500 02050002
_

Bhooshan Nagaokar 98
Essential IDMS

END

Bhooshan Nagaokar 99

S-ar putea să vă placă și