ca-datamacs®/ii datamacs r1 2-enu... · overview in an idms environment, ca-datamacs/ii can...
TRANSCRIPT
This Documentation, which includes embedded help systems and electronically distributed materials, (hereinafter referred to as the “Documentation”) is for your informational purposes only and is subject to change or withdrawal by CA at any time.
This Documentation may not be copied, transferred, reproduced, disclosed, modified or duplicated, in whole or in part, without the prior written consent of CA. This Documentation is confidential and proprietary information of CA and may not be disclosed by you or used for any purpose other than as may be permitted in (i) a separate agreement between you and CA governing your use of the CA software to which the Documentation relates; or (ii) a separate confidentiality agreement between you and CA.
Notwithstanding the foregoing, if you are a licensed user of the software product(s) addressed in the Documentation, you may print or otherwise make available a reasonable number of copies of the Documentation for internal use by you and your employees in connection with that software, provided that all CA copyright notices and legends are affixed to each reproduced copy.
The right to print or otherwise make available copies of the Documentation is limited to the period during which the applicable license for such software remains in full force and effect. Should the license terminate for any reason, it is your responsibility to certify in writing to CA that all copies and partial copies of the Documentation have been returned to CA or destroyed.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, CA PROVIDES THIS DOCUMENTATION “AS IS” WITHOUT WARRANTY OF ANY KIND, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT WILL CA BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY LOSS OR DAMAGE, DIRECT OR INDIRECT, FROM THE USE OF THIS DOCUMENTATION, INCLUDING WITHOUT LIMITATION, LOST PROFITS, LOST INVESTMENT, BUSINESS INTERRUPTION, GOODWILL, OR LOST DATA, EVEN IF CA IS EXPRESSLY ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
The use of any software product referenced in the Documentation is governed by the applicable license agreement and such license agreement is not modified in any way by the terms of this notice.
The manufacturer of this Documentation is CA.
Provided with “Restricted Rights.” Use, duplication or disclosure by the United States Government is subject to the restrictions set forth in FAR Sections 12.212, 52.227-14, and 52.227-19(c)(1) - (2) and DFARS Section 252.227-7014(b)(3), as applicable, or their successors.
Copyright © 2009 CA. All rights reserved. All trademarks, trade names, service marks, and logos referenced herein belong to their respective companies.
CA Technologies Product References
This document references the following CA Technologies products:
This document references the following CA product:
■ CA [set to your product name]® for z/OS ([assign the value for vres in your book])
■ CA VISION: Excel ™ for z/OS (VISION: Excel)
■ CA VISION: Sixty® for z/OS (VISION: Sixty)
■ CA VISION: Eighty™ (VISION: Eighty)
■ CA VISION: Interface™ to DB2 (VISION: Interface)
■ CA VISION: Inquiry® for CICS® (VISION: Inquiry)
■ CA VISION: Inquiry® for IMS® (VISION: Inquiry)
■ CA VISION: Journey® (VISION: Journey)
Documentation Changes
The following documentation updates have been made since the last release of this documentation:
■ [Topic Name]—[Description of new chapter, topic, or description of changes to an existing topic].
■ [Topic Name]—[Description of new chapter, topic, or description of changes to an existing topic].
Contact CA Technologies
Contact CA Support
For your convenience, CA Technologies provides one site where you can access the information that you need for your Home Office, Small Business, and Enterprise CA Technologies products. At http://ca.com/support, you can access the following resources:
■ Online and telephone contact information for technical assistance and customer services
■ Information about user communities and forums
■ Product and documentation downloads
■ CA Support policies and guidelines
■ Other helpful resources appropriate for your product
Providing Feedback About Product Documentation
If you have comments or questions about CA Technologies product documentation, you can send a message to [email protected].
To provide feedback about CA Technologies product documentation, complete our short customer survey which is available on the CA Support website at http://ca.com/docs.
Contents 5
Contents
Chapter 1: The IDMS Interface 9
Overview ...................................................................................................................................................................... 9
The CA-Datamacs/II IDMS Interface Program ..................................................................................................... 10
Supported Environments .................................................................................................................................... 10
CA-Datamacs/II Field Modifiers .......................................................................................................................... 11
Using CA-Datamacs/II IDMS ....................................................................................................................................... 11
Chapter 2: Using CA-Datamacs/II IDMS Statement 13
Statement Conventions .............................................................................................................................................. 15
CONNECT and DISCONNECT ....................................................................................................................................... 15
Format ................................................................................................................................................................. 15
Parameters .......................................................................................................................................................... 15
Programming notes ............................................................................................................................................. 16
Examples ............................................................................................................................................................. 16
COPY ........................................................................................................................................................................... 16
Format I ............................................................................................................................................................... 16
Format II .............................................................................................................................................................. 17
Parameters .......................................................................................................................................................... 17
Programming notes ............................................................................................................................................. 17
Examples ............................................................................................................................................................. 18
DB ............................................................................................................................................................................... 18
Format ................................................................................................................................................................. 18
Parameters .......................................................................................................................................................... 19
Programming notes ............................................................................................................................................. 19
Example ............................................................................................................................................................... 19
ENABLE ....................................................................................................................................................................... 19
Format ................................................................................................................................................................. 19
Programming notes ............................................................................................................................................. 20
Example ............................................................................................................................................................... 20
END-COPY ................................................................................................................................................................... 20
Format ................................................................................................................................................................. 20
Programming notes ............................................................................................................................................. 20
ERASE ......................................................................................................................................................................... 21
Format ................................................................................................................................................................. 21
Parameters .......................................................................................................................................................... 21
Programming notes ............................................................................................................................................. 22
6 CA-IDMS Interface
Example ............................................................................................................................................................... 22
GO TO ......................................................................................................................................................................... 22
Format ................................................................................................................................................................. 22
Parameters .......................................................................................................................................................... 22
Programming notes ............................................................................................................................................. 23
IDMS ........................................................................................................................................................................... 23
Format ................................................................................................................................................................. 23
Parameters .......................................................................................................................................................... 23
Programming notes ............................................................................................................................................. 24
Examples ............................................................................................................................................................. 25
MODIFY ...................................................................................................................................................................... 25
Format ................................................................................................................................................................. 25
Parameters .......................................................................................................................................................... 26
Programming notes ............................................................................................................................................. 26
Example ............................................................................................................................................................... 26
OBTAIN - CALCulated.................................................................................................................................................. 26
Format I ............................................................................................................................................................... 26
Format II .............................................................................................................................................................. 26
Format III ............................................................................................................................................................. 27
Parameters .......................................................................................................................................................... 27
Programming notes ............................................................................................................................................. 28
Examples ............................................................................................................................................................. 29
OBTAIN - Current ........................................................................................................................................................ 30
Format ................................................................................................................................................................. 30
Parameters .......................................................................................................................................................... 30
OBTAIN - DBKEY ......................................................................................................................................................... 30
Format ................................................................................................................................................................. 30
Parameters .......................................................................................................................................................... 30
OBTAIN - Owner ......................................................................................................................................................... 30
Format ................................................................................................................................................................. 31
Parameters .......................................................................................................................................................... 31
Programming notes ............................................................................................................................................. 31
Examples ............................................................................................................................................................. 31
OBTAIN - Member ...................................................................................................................................................... 32
Format ................................................................................................................................................................. 32
Parameters .......................................................................................................................................................... 32
Programming notes ............................................................................................................................................. 32
Example ............................................................................................................................................................... 33
OBTAIN - SORTKEY...................................................................................................................................................... 33
Format ................................................................................................................................................................. 33
Parameters .......................................................................................................................................................... 33
OBTAIN - Within Set ................................................................................................................................................... 33
Contents 7
Format ................................................................................................................................................................. 34
Parameters .......................................................................................................................................................... 34
Programming notes ............................................................................................................................................. 34
Examples ............................................................................................................................................................. 35
PERFORM ................................................................................................................................................................... 35
Format ................................................................................................................................................................. 35
Parameters .......................................................................................................................................................... 36
Programming notes ............................................................................................................................................. 36
Example ............................................................................................................................................................... 36
PERMIT ....................................................................................................................................................................... 36
Format ................................................................................................................................................................. 37
Parameters .......................................................................................................................................................... 37
Programming notes ............................................................................................................................................. 37
Example ............................................................................................................................................................... 37
POP ............................................................................................................................................................................. 37
Format ................................................................................................................................................................. 37
Parameters .......................................................................................................................................................... 38
Programming notes ............................................................................................................................................. 38
PUSH ........................................................................................................................................................................... 38
Format ................................................................................................................................................................. 38
Parameters .......................................................................................................................................................... 38
Programming notes ............................................................................................................................................. 38
READY ......................................................................................................................................................................... 39
Format ................................................................................................................................................................. 39
Parameters .......................................................................................................................................................... 39
Programming notes ............................................................................................................................................. 40
Examples ............................................................................................................................................................. 40
SCAN .................................................................................................................................................................... 40
Format ................................................................................................................................................................. 41
Parameters .......................................................................................................................................................... 41
Programming notes ............................................................................................................................................. 41
Example ............................................................................................................................................................... 41
STORE ......................................................................................................................................................................... 42
Format ................................................................................................................................................................. 42
Parameters .......................................................................................................................................................... 42
Programming notes ............................................................................................................................................. 42
Example ............................................................................................................................................................... 42
TRACE ......................................................................................................................................................................... 42
Format ................................................................................................................................................................. 42
Parameters .......................................................................................................................................................... 43
Programming notes ............................................................................................................................................. 43
Examples ............................................................................................................................................................. 43
8 CA-IDMS Interface
USER-ERROR ............................................................................................................................................................... 44
Format ................................................................................................................................................................. 44
Parameters .......................................................................................................................................................... 44
Programming notes ............................................................................................................................................. 45
Example ............................................................................................................................................................... 45
WRITE ......................................................................................................................................................................... 45
Format ................................................................................................................................................................. 45
Parameters .......................................................................................................................................................... 46
Programming notes ............................................................................................................................................. 46
Examples ............................................................................................................................................................. 47
Chapter 3: Retrieving Record Descriptions (COPY) 49
Overview .................................................................................................................................................................... 49
Merging In-Stream Data ...................................................................................................................................... 49
Selective Field Modification ................................................................................................................................ 54
The CA-Datamacs/II Tasks .......................................................................................................................................... 55
CA-Datamacs/II Task Requirements .................................................................................................................... 56
CREATE ................................................................................................................................................................ 59
UNLOAD .............................................................................................................................................................. 63
LOAD ................................................................................................................................................................... 66
MODIFY ............................................................................................................................................................... 73
COPY And NON-DATABASE COPY ........................................................................................................................ 77
Chapter 4: CA-Datamacs/II Reports 81
Overview .................................................................................................................................................................... 81
Glossary 83
Index 85
Chapter 1: The IDMS Interface 9
Chapter 1: The IDMS Interface
This section contains the following topics:
Overview (see page 9) Using CA-Datamacs/II IDMS (see page 11)
Overview
In an IDMS environment, CA-Datamacs/II can populate a database with records for use in database structure evaluation, program design or regression testing.
The source of test records are COBOL record descriptions maintained in an Integrated Data Dictionary (IDD). These test records may be database occupants, with or without set participation, occurrences within a test database or records that are generated as a job step and exist only during the execution of a test.
CA-Datamacs/II is capable of generating and storing test records without reference to a database management system. The inclusion of test record descriptions in the Integrated Data Dictionary is assumed. However, this does not mean that test record descriptions need be maintained in the primary dictionary or that the test records must be kept with live sets, in a test database, or for that matter, retained at all.
Overview
10 CA-IDMS Interface
The CA-Datamacs/II IDMS Interface Program
To IDMS, CA-Datamacs/II looks like a conventional user that reads from the Integrated Data Dictionary and requests database access. To the database, often without program involvement, CA-Datamacs/II is the entity that permits reconstruction, establishes currency and implements record construction or alteration by CA-Datamacs/II statements.
The diagram on the following page illustrates this interrelation.
The CA-Datamacs/II IDMS procedural language is syntactically similar to, and parallels the scope of, the IDMS data manipulation language, DML. It offers directives to:
■ PERFORM record references, such as OBTAIN and WRITE, (CALC, VIA, and DIRECT modes are supported)
■ COPY descriptions from the Integrated Data Dictionary
■ MODIFY, ERASE, CONNECT or DISCONNECT records
Without programmer involvement, this procedural interface CALLs IDMS and FINDs records to establish currency. In certain cases, it will automatically return records to the database, execute the field modification commands and prevent record duplication.
Supported Environments
The CA-Datamacs/II IDMS interface is compatible with releases 5.7 and up of IDMS.
CA-Datamacs/II IDMS runs as a concurrent, central or local version IDMS user.
A VSAM data set is used when load runs require work areas for database key replacement.
CA-Datamacs/II runs do not transmit traffic to, or anticipate commands from the system console.
SPF - the Sequential Processing Facility of IDMS - is supported.
Integrated Indexes - are supported.
LRF - The Logical Record Facility is not supported.
Using CA-Datamacs/II IDMS
Chapter 1: The IDMS Interface 11
CA-Datamacs/II Field Modifiers
This chapter often refers to "CA-Datamacs/II field modifiers". This is a generic term which is used to include CA-Datamacs/II file control and data control statements.
Using CA-Datamacs/II IDMS
There are six CA-Datamacs/II tasks which service and populate a database. The tasks and their functions are:
■ CREATE builds records in accordance with a subschema's record descriptions and as directed by CA-Datamacs/II field modifiers. The result is stored in a database.
■ UNLOAD writes selected database records to a sequential data set with, when necessary, the currency and set participation information to facilitate reload.
■ LOAD writes selected records, with any specified alterations, to a database.
■ MODIFY retrieves, alters, erases, connects and/or disconnects and then returns records to the database.
■ COPY and NDBR-COPY build records as described by subschema record descriptions and altered by CA-Datamacs/II field modifiers. The records are then written to a flat-file.
The IDMS statement specifies which task to perform (CREATE, UNLOAD, LOAD, MODIFY, COPY or NDBR-COPY). All require a read-only interface to the Integrated Data Dictionary for record description retrieval. All, except COPY and NDBR-COPY, utilize IDMS to fetch records from the database, send records to the database, or both.
CA-Datamacs/II tasks can extract copies of records, alter the data content of records and generate database structures which do not include all of the records taken from the live database. However, CA-Datamacs/II does not delete records (the ERASE function is the IDMS erase, i.e., making a record unaccessible), it does not revise record field definition or record length, and it can only modify set attributes of the live or test database which has been designated as optional or manual.
Chapter 2: Using CA-Datamacs/II IDMS Statement 13
Chapter 2: Using CA-Datamacs/II IDMS Statement
The CA-Datamacs/II statements, described in this section, consist of:
■ Control statements which set the parameters of the CA-Datamacs/II function. These statements must be coded following the COBOL File Control line and before any CA-Datamacs/II procedural statements
■ Procedural statements which sequence program execution. All procedural statements follow a START paragraph and must occur before the COBOL Data Division is encountered.
■ Record description retrieval statements which govern access to the IDD. The retrieval statements are coded between Data Division and Procedure Division statements.
■ In addition to the above groups of statements, there is a debugging statement - TRACE.
The following table summarizes which CA-Datamacs/II IDMS statements belong in each group.
Control Retrieval Procedural
ENABLE CONNECT COPY
IDMS DISCONNECT DB
PERMIT ERASE END-COPY
READY GO TO
MODIFY
OBTAIN
PERFORM
POP
PUSH
SCAN
STORE
Using CA-Datamacs/II IDMS
14 CA-IDMS Interface
Control Retrieval Procedural
USER-ERROR
WRITE
This section contains the following topics:
Statement Conventions (see page 15) CONNECT and DISCONNECT (see page 15) COPY (see page 16) DB (see page 18) ENABLE (see page 19) END-COPY (see page 20) ERASE (see page 21) GO TO (see page 22) IDMS (see page 23) MODIFY (see page 25) OBTAIN - CALCulated (see page 26) OBTAIN - Current (see page 30) OBTAIN - DBKEY (see page 30) OBTAIN - Owner (see page 30) OBTAIN - Member (see page 32) OBTAIN - SORTKEY (see page 33) OBTAIN - Within Set (see page 33) PERFORM (see page 35) PERMIT (see page 36) POP (see page 37) PUSH (see page 38) READY (see page 39) STORE (see page 42) TRACE (see page 42) USER-ERROR (see page 44) WRITE (see page 45)
Statement Conventions
Chapter 2: Using CA-Datamacs/II IDMS Statement 15
Statement Conventions
If field attributes such as maximum length or permissible characters are omitted, it may be assumed that a field specification which meets the IDMS requirements would be acceptable to CA-Datamacs/II.
In all CA-Datamacs/II IDMS statements, the character string *DM must appear in columns 7 through 9. Columns 10 and 11 must be left blank.
The subschema specification statement, DB, may start in column 7 as *DB or @DB. If column 7 is left blank, the DB string may begin in column 8. For consistency, the *DB form is recommended and is used in this chapter.
The COPY command is not unique to CA-Datamacs/II. It is used in all CA-Datamacs/II runs, except NDBR-COPY. COPY must be coded in columns 8 through 11.
CONNECT and DISCONNECT
CONNECT establishes a record as a member of a set occurrence; DISCONNECT cancels membership of an optional member record in a named set.
Format
*DM {CONNECT | DISCONNECT} record-name {FROM | TO} set-name.
Parameters
CONNECT TO
Establishes a record as a member of a set occurrence.
DISCONNECT FROM
Cancels membership of an optional member in a named set.
record-name
Subschema-defined name of the member record to be joined with or separated from its owner.
set-name
Subschema-defined name of the common set.
COPY
16 CA-IDMS Interface
Programming notes
■ A CONNECT issued to a member of an automatic set causes IDMS to return an exception message, but CA-Datamacs/II will continue.
■ A CONNECT or DISCONNECT would be performed on the then-current occurrence of the member.
■ Before a set can be CONNECTed, the owner record must be current and must have been STOREd.
■ DISCONNECT only applies to optional sets.
■ During a LOAD or CREATE, CONNECT should always be specified for mandatory-manual sets; optional-manual sets may or may not require CONNECTion.
Examples
(1) *DM CONNECT MEMBER TO OWNER-MEMBER-SET.
Connects the occurrence of MEMBER to the then-current owner of OWNER-MEMBER-SET.
(2) *DM DISCONNECT MEMBER FROM OWNER-MEMBER-SET.
Disconnects this occurrence of the MEMBER record from the current owner of the set, OWNER-MEMBER-SET.
COPY
COPY is used to retrieve COBOL record descriptions and associated CA-Datamacs/II field modification statements from the Integrated Data Dictionary.
The Format I COPY extracts all subschema-defined record descriptions; Format II fetches single records, by version number and/or by CA-Datamacs/II statements script number.
For more detailed information refer to "Retrieving Record Descriptions" in this chapter.
Format I
COPY IDMS RECORDS [SUPPRESS]
COPY
Chapter 2: Using CA-Datamacs/II IDMS Statement 17
Format II
COPY record-name [VERSION version-number]
[SCRIPT script-number] [SUPPRESS]
Parameters
SUPPRESS
Deletes record descriptions and in-stream data from the run's printed output.
record-name
The subschema-defined name of the record to be read from the data dictionary.
version-number
The version of the record to be read. Valid entries range from 1 to 9999.
script-number
A commonality of CA-Datamacs/II statements expressed as a numerical value from 01 to 99. If SCRIPT and script-number are omitted, the default of SCRIPT SPACE-SPACE would be used. See programming notes.
Programming notes
■ Format I and Format II COPY statements are mutually exclusive. Between the *DB subschema identifier and the COBOL Procedure Division statement there may be:
– One Format I COPY and no more than one CA-Datamacs/II field modifier for each data item in each record retrieved.
-OR-
– No more than one Format II COPY with an associated END-COPY for each record description in the subschema. Between the COPY and END-COPY there may be one field modifier for each data item in the record.
■ A CA-Datamacs/II run cannot COPY record descriptions into a job stream which also includes manually prepared descriptions. If both are found, CA-Datamacs/II will issue an error message and terminate.
■ Both Format I and Format II will extract SPF descriptions, but they are only printed when retrieved by a Format II COPY.
■ If a record description "version-number" is specified and that number cannot be found, CA-Datamacs/II will extract the most current (highest numbered) version and proceed without noting an error.
DB
18 CA-IDMS Interface
■ The CA-Datamacs/II field modifiers, stored and retrieved with their associated record descriptions, may be identified by a SCRIPT number. This identification, coded into the two columns following *DM, must be two BLANKs or a numeric value greater than zero and less than 100.
■ ICCF users may place sequence numbers in CA-Datamacs/II statements in positions 65 through 72, instead of 73 through 80.
Examples
(1) COPY IDMS RECORDS.
All record descriptions included in the *DB-designated subschema, will be incorporated in this CA-Datamacs/II run and will be included on the run listing CA-Datamacs/II provides.
(2) COPY CUSTOMER VERSION 0988 SCRIPT 02.
*
M A P 01 CUSTOMER. 06110010
VERS #. VERSION=0988 06110020
0001 03 CUST-NUMBER PIC X(10). 06110060
*DM CONSTANT '0411039504'. 06110065
0011 03 CUST-NAME PIC X(20). 06110070
*DM CONSTANT 'CUSTOMER-NAME'. 06110075
0031 03 CUST-ADDRESS. 06110080
The DEMOSS03 record description of CUSTOMER (version number 0988) is extracted from the IDD. The CA-Datamacs/II field generator statements with a SCRIPT number of 02 are COPYed with the record description.
DB
The DB statement directs IDMS as to which subschema view this CA-Datamacs/II run unit will be using.
Format
DB
{*DB} subschema-name WITHIN schema-name [VERSION number].
@DB
ENABLE
Chapter 2: Using CA-Datamacs/II IDMS Statement 19
Parameters
subschema-name
The subschema that CA-Datamacs/II will reference.
schema-name
The schema to which the subschema belongs.
number
The schema version number to reference. If omitted, the latest (highest numbered) version is used. Values may range from 1 to 9999.
Programming notes
■ CA-Datamacs/II references schemas and subschemas with a read-only reference to the Integrated Data Dictionary.
■ The highest version number is used if the specification is not numeric, is zero or is greater than 9999.
■ Only one subschema may be referenced in each CA-Datamacs/II job step. However, a CA-Datamacs/II job consisting of UNLOAD and LOAD job steps could reference one subschema for UNLOAD and a different one for the LOAD.
Example
*DB DEMOSS03 WITHIN DEMOSCHM.
CA-Datamacs/II will use the DEMOSS03 subschema.
ENABLE
The ENABLE statement advises CA-Datamacs/II that the LOAD run to be executed will swap old and new database keys using the VSAM data set, defined as //IDMSWRK, as a work area.
Format
*DM ENABLE IDMSWRK
END-COPY
20 CA-IDMS Interface
Programming notes
■ CA-Datamacs/II looks for a //IDMSWRK DD statement to identify the data set where a VIA table for old and new database keys can be built. If //IDMSWRK has been omitted, CA-Datamacs/II will process a maximum of 2000 key replacements in memory. If more require processing, CA-Datamacs/II will then issue an error message and terminate.
Example
*DM ENABLE IDMSWRK.
CA-Datamacs/II will open the //IDMSWRK data set for use as a work area. The work file is a VSAM KSDS with the following characteristics: record size is 8 bytes, key length is 4 bytes starting in position 1.
END-COPY
END-COPY is a scope terminator for a Format II COPY statement and if included, the COBOL record descriptions and CA-Datamacs/II statements that are to be merged with the record descriptions being copied from the IDD.
Format
*DM END-COPY.
Programming notes
■ END-COPY must begin in column 12 and may not be used as a paragraph name.
■ While the practice is not recommended, the last Format II COPY need not be terminated by an END-COPY. CA-Datamacs/II will assume that all record descriptions and CA-Datamacs/II statements have been read when it encounters a COBOL Procedure Division line.
■ If the END-COPY is required and is omitted, subsequent COPY statement(s) will be merged with descriptors previously fetched from the Integrated Data Dictionary.
■ END-COPY may, but need not, have a sequence number in columns 73 through 80.
■ END-COPY is never printed in a CA-Datamacs/II run stream output listing.
ERASE
Chapter 2: Using CA-Datamacs/II IDMS Statement 21
ERASE
ERASE permits you to:
■ make the object record occurrence unavailable for further processing
■ disconnect the object record from all set occurrences in which it participates as a member
■ optionally erase all record occurrences which are mandatory members of set occurrences owned by the object record
■ optionally disconnect or erase all record occurrences which are optional members of set occurrences owned by the object record
Format
*DM ERASE record-name {RECord| PERManent| SELective| ALL}.
Parameters
record-name
Subschema-defined name of the record to be erased.
RECord
Causes the erasure of the designated record only if it has no member records at the time the command is processed. If member records exist, CA-Datamacs/II will issue a CA-Datamacs/II or IDMS error message and terminate.
PERManent
Causes the erasure of the designated record and all of its mandatory members. Optional members are DISCONNECTed but not erased.
SELective
Causes the erasure of all mandatory members and all optional members that are not connected as members to another set or sets. Optional members with other set occurrences are not erased from the set.
ALL
Causes the erasure of the designated record and all its mandatory or optional members.
GO TO
22 CA-IDMS Interface
Programming notes
■ There is no default for the type of erase. If you do not stipulate REC, PERM, SEL or ALL, the statement will be flagged and CA- Datamacs/IICA-Datamacs/II will terminate after the syntax phase.
■ If the command specifies a record that has been erased or does not exist in the database, CA-Datamacs/II will issue an error message and terminate. If the erase specifies an owner that is linked to members that have not been erased, CA-Datamacs/II will issue an error message and terminate.
■ Only REC may be specified if the SPF facility is being used. Other forms would pass the syntax phase but, when encountered during execution, CA-Datamacs/II would issue an error message and terminate.
■ A PERMIT statement is required if there is a system password.
■ ERASE can only be used on a MODIFY function
Example
*DM ERASE CUSTOMER RECORD.
Deletes all occurrences of CUSTOMER which do not then have any member(s).
GO TO
The GO TO statement transfers control to the specified paragraph or, if FINISH is specified, terminates the CA-Datamacs/II run.
Format
*DM GO TO {paragraph-name | FINISH}.
Parameters
paragraph-name
The label of a paragraph, expressed in accordance with CA-Datamacs/II rules for paragraph names.
FINISH
The CA-Datamacs/II run is to be terminated.
IDMS
Chapter 2: Using CA-Datamacs/II IDMS Statement 23
Programming notes
■ A GO TO may be included in a procedural paragraph addressed by other GO TOs.
■ Care should be taken to avoid creating an unconditional (GO TO) exit from a closed subroutine entered with a PERFORM.
■ GO TO FINISH, where FINISH is an implicit program termination rather than an actual paragraph name, is an acceptable form and the only form permitted in a manual LOAD. FINISH must not be coded as a *DM paragraph name.
■ The paragraph name, specified in a GO TO, is verified during the CA-Datamacs/II syntax phase. If the target name cannot be located, CA-Datamacs/II will issue an error message and terminate.
IDMS
The IDMS statement defines the CA-Datamacs/II IDMS task.
Format
*DM IDMS { CREATE | UNLOAD | LOAD | MODIFY | COPY | NDBR-COPY}
*DM [ROLLBACK]
*DM [COMMIT [EVERY] number-of-records [RECORDS]]
*DM [USING {VSAM | DASD | TAPE }]
*DM [ [AND] [ALTernate] *DM DICTionary [NAME IS] dictionary-name] *DM [DBNAME
db-name].
Parameters
CREATE
Specifies that a new database is to be built or that test records are to be added to an existing database.
UNLOAD
Writes selected record images to the file specified as //IDMSOUT.
LOAD
Reads from the file specified as IDMSIN and stores selected records, with or without modification, in the database defined by the schema and subschema.
IDMS
24 CA-IDMS Interface
MODIFY
Specifies that this run may alter, erase, connect, or disconnect record occurrences. If a system password has been defined, a PERMIT is required.
COPY
Specifies that records, described in the specified subschema, will be built and written to a flat-file.
NDBR-COPY
Same as COPY, except that NDBR-COPY designates non-database records which are described in the Integrated Data Dictionary. A *DB subschema specifier is not used.
ROLLBACK
Causes the IDMS FINISH to be bypassed; the records CREATEd or LOADed are erased. See programming notes.
COMMIT
Generates a currency checkpoint by simulating a FINISH, a BIND, and a READY following the creation or LOADing of a series of records. The "number-of-records" parameter establishes the scope of the checkpoint.
number-of-records
The number of records in each series to be checkpointed. The number ranges from one up to the maximum to be CREATEd or LOADed.
VSAM|DASD|TAPE
This option is for VSE only. It specifies either the access method (VSAM) or physical medium (TAPE, DASD) to be used both as the destination for an UNLOAD and the source for a CA-Datamacs/II LOAD. VSE users must specify VSAM, DASD or TAPE, if applicable to an UNLOAD or LOAD. The statement is ignored and will not cause an error if specified under other operating systems.
ALTernate DICTionary
Specifies that a secondary dictionary contains record descriptions for COPY processing. The word ALTernate may be omitted.
Programming notes
■ Secondary databases can be accessed by use of a PARM on the CA-Datamacs/II EXEC statement:
// EXEC PGM=CADKE000,PARM='DBNAME=SECDB'
■ ROLLBACK and COMMIT are not valid in either the COPY or NDBR-COPY forms of the CA-Datamacs/II IDMS statement. If included, CA-Datamacs/II will issue an error message and terminate.
MODIFY
Chapter 2: Using CA-Datamacs/II IDMS Statement 25
■ If the number of records to be checkpointed by the COMMIT statement exceeds the number to be CREATEd or LOADed, all records are encompassed by a single checkpoint. The number disparity would be ignored.
■ A ROLLBACK clause, under normal circumstances, will be processed for the IDMS CV (central version) users only. It is automatically invoked for any IDMS user, if the CREATE or LOAD runs terminate abnormally.
Examples
(1) *DM IDMS CREATE.
Builds test records and stores them in the designated database.
(2) *DM IDMS CREATE
*DM ROLLBACK.
Same as example (1) except that IDMS will restore the assigned database area at run completion for CV users.
(3) *DM IDMS UNLOAD
*DM DICT NAME IS TESTFD.
This run would write subschema-defined records to the data set identified by the //IDMSOUT statement. CA-Datamacs/II would copy subschema records from the TESTFD secondary dictionary. Alternately the secondary dictionary name may be placed in the JCL PARM area:
// EXEC PGM=CADKE000,PARM='DICTNAME=dictname'
(4) *DM IDMS LOAD
*DM COMMIT EVERY 100
*DM USING VSAM.
Every 100 records CA-Datamacs/II will tell IDMS to commit the database.
MODIFY
The MODIFY statement applies the field modifiers associated with a particular record description and returns the record occurrence to the database. The MODIFY statement is used only in a CA-Datamacs/II MODIFY run.
Format
*DM MODIFY record-name.
OBTAIN - CALCulated
26 CA-IDMS Interface
Parameters
record-name
The subschema-defined name of the record to be modified.
Programming notes
■ The *DM IDMS statement must specify MODIFY and the PERMIT statement must have been issued if the system has a password.
■ The designated record occurrence must be current of the run unit. If not, CA-Datamacs/II will issue an error message and terminate.
■ The run's listing will include a before and after picture of each record modified.
Example
*DM MODIFY ITEM.
The field modifiers filed with the ITEM record are applied and ITEM is returned to the database.
OBTAIN - CALCulated
OBTAIN CALC retrieves a record occurrence based upon a calculated key. The record must have been initially consigned to the database with a location mode of CALC. Retrieval may be:
■ direct, using a specified key (Format I)
■ indirect, using a key retrieved from a data set (Format II)
■ through a key extracted from a set member record occurrence (Format III).
Format I
*DM OBTAIN CALC record-name [USING] KEY [IS] key
*DM [NOT-FOUND GO TO {paragraph-name | FINISH}].
Format II
*DM OBTAIN CALC record-name [USING] {ddname | dtfname} [AS INPUT]
*DM [NOT-FOUND GO TO {paragraph-name | FINISH}].
OBTAIN - CALCulated
Chapter 2: Using CA-Datamacs/II IDMS Statement 27
Format III
*DM OBTAIN CALC owner-record-name
*DM [USING] KEYLOC key-loc KEYLEN key-length
*DM [NOT-FOUND GO TO {paragraph-name | FINISH}].
Parameters
record-name
The subschema-defined name of the desired member occurrence.
owner-record-name
The subschema-defined name of the desired owner occurrence.
key
The actual key of the record to be OBTAINED. Only one key can be specified.
ddname
MVS DDNAME of a sequential data set that contains CALC keys (for a specific record type). DMIKEY01 through DMIKEY16 are the MVS DDNAME of 16 additional sequential data sets containing CALC keys (for a specific record type). IDMSKEYS is also accepted.
dtfname
VSE DTFNAME of a sequential data set that contains CALC keys (for a specific record type). DMIKY01 through DMIKY16 are VSE DTFNAMEs of 16 additional sequential data sets containing CALC keys (for a specific record type). IDMSKYS is also accepted.
key-loc
The location (relative to 1) within a member record of a field that contains an owner record CALC key.
key-length
The length (in bytes) of the CALC key pointed to by "key-loc".
NOT-FOUND GO TO
Causes transfer of control to the specified paragraph if the owner record is not found. If NOT-FOUND is omitted and the retrieval fails, the paragraph in which this OBTAIN appears is repeated.
OBTAIN - CALCulated
28 CA-IDMS Interface
Programming notes
■ A CA-Datamacs/II run may include only one Format II OBTAIN statement. If more than one is included, CA-Datamacs/II will issue an error message and terminate. This one copy of the Format II OBTAIN may be executed repeatedly.
■ Use of the Format III OBTAIN for indirect retrieval presumes that the member record containing the key field is available to CA- Datamacs/IICA-Datamacs/II at the time the command is issued.
■ OBTAIN CALC may be used in CREATE, UNLOAD, LOAD and MODIFY runs. If OBTAIN is included in a COPY run, CA- Datamacs/IICA-Datamacs/II will issue an error message and terminate.
■ At the NOT-FOUND GO TO paragraph, you may attempt recovery or issue an error message. If USER-ERROR is coded, CA- Datamacs/IICA-Datamacs/II will forward the message to the SYSPRINT-defined data set, write an error message of its own and terminate.
■ OBTAIN CALC is a more efficient means of achieving UNLOAD currency than the SCAN command.
■ An OBTAINed record becomes current of the run unit, area, record and any set in which it participates.
■ There is an implicit AT-END associated with Format II. When a read of the //IDMSKEYS data set fails to return a key record, CA- Datamacs/IICA-Datamacs/II terminates.
■ Rules governing the three types of literals that can be used to specify a CALC keys for FORMAT I and II OBTAIN:
– Non-numeric literals must be bounded by quotation (apostrophe) marks and may contain any characters in the EBCDIC set, including spaces but excluding quotation marks.
– Numeric literals: Only characters 0 through 9 are permitted. Sign characters (+ -) and decimal points are not allowed since data conversion will not occur.
– Hexadecimal literals must be bounded by quotation marks and immediately preceded by the identifier X or HEX. Only valid hexadecimal characters 0 through F are permitted. Characters within the string must be specified in even pairs.
OBTAIN - CALCulated
Chapter 2: Using CA-Datamacs/II IDMS Statement 29
Examples
(1) *DM OBTAIN CALC ITEM USING KEY X'C9E3C5D4'.
CA-Datamacs/II tells IDMS to return the record called ITEM whose location may be calculated using the hex value shown.
(2) *DM OBTAIN CALC PRODUCT USING IDMSKEYS AS INPUT.
CA-Datamacs/II reads a record from the //IDMSKEYS data set, extracts PRODUCT's key and issues a Format I OBTAIN to IDMS. If there are no more keys in //IDMSKEYS, CA-Datamacs/II terminates.
(3) *DM ITEM.
*DM OBTAIN CALC PRODUCT USING KEYLOC 10 KEYLEN 8
*DM NOT-FOUND GO TO ALLREAD.
*DM STORE ITEM.
*DM PERFORM MODREC.
*DM GO TO FINISH.
*DM ALLREAD.
*DM USER-ERROR 'UEOF'.
In the ITEM paragraph, CA-Datamacs/II is told to use the member record ITEM to locate the owner record, PRODUCT. The CALC key in the ITEM record being processed is offset by ten (starts in the tenth character position) and contains eight characters. If IDMS cannot locate this PRODUCT, CA-Datamacs/II will exit to the paragraph named ALLREAD. If the record is returned, CA-Datamacs/II will execute the procedural statements in the MODREC paragraph, then return and terminate the run normally. At ALLREAD, CA -Datamacs/IICA-Datamacs/II is told to deliver the UEOF message to the SYSPRINT file, issue the IDMS error code message and terminate.
(4) //IDMSKEYS DD *
'REG001 DEPT 006'
The above illustrates a single non-numeric literal. The literal could have also been expressed as follows:
'REG' 001 ' DEPT ' 006
or
'REG001' ' DEPT ' 006
(5) //IDMSKEYS DD *
'REG001 DEPT ' X'0000006F'
In the above example, the department number is a packed field, 9(7) COMP-3. HEX'0000006F' could also have been specified.
OBTAIN - Current
30 CA-IDMS Interface
OBTAIN - Current
OBTAIN CURRENT accesses the current record for the record type. This statement is an efficient means of establishing which record is the current record of the run unit before executing another statement (such as ERASE) that uses the current record of the run unit.
Format
*DM OBTAIN CURRENT record-name.
Parameters
record-name
Name of the record to be accessed.
OBTAIN - DBKEY
OBTAIN DBKEY uses the database key from the record table to access the specified record and makes it the current record for the run unit.
Format
*DM OBTAIN CURRENT record-name USING DBKEY.
Parameters
record-name
Name of the record to be processed.
OBTAIN - Owner
OBTAIN OWNER retrieves a set owner occurrence. If UNIQUE is included, CA-Datamacs/II will avoid duplication by executing a write only when the record is first encountered. The paragraph referenced by NOT-FOUND is given control when the specified owner cannot be found - whether or not UNIQUE is included.
OBTAIN - Owner
Chapter 2: Using CA-Datamacs/II IDMS Statement 31
Format
*DM OBTAIN [UNIQUE] OWNER record-name WITHIN set-name
*DM [NOT-FOUND GO TO {paragraph-name | FINISH}].
Parameters
UNIQUE
When used with OWNER, UNIQUE ensures that this owner record will not be duplicated in an UNLOAD data set.
record-name
Name of the owner record to be retrieved.
NOT-FOUND GO TO
Causes transfer of control to the specified paragraph if the owner record is not found. If NOT-FOUND is omitted and the retrieval fails, the paragraph in which this OBTAIN appears is repeated.
Programming notes
■ The UNIQUE form permits repeated use of the same OBTAIN - OWNER command. Using this form provides currency for the epilog of a member record, without duplicating the owner record in the UNLOAD data set.
Examples
(1) *DM GET-PRODUCT.
*DM PERFORM GET-ITEM.
*DM OBTAIN OWNER PRODUCT WITHIN PRODUCT-ITEM.
The GET-PRODUCT paragraph exits to another paragraph, GET-ITEM, processes the commands in that paragraph and returns to the OBTAIN shown above. If PRODUCT is located, CA-Datamacs/II will go on to the next executable line. If not, control will be passed back to the first line in this paragraph (PERFORM GET-ITEM) and, in all probability, the program will go into a loop. Therefore, be careful not to omit the NOT-FOUND GO TO clause.
OBTAIN - Member
32 CA-IDMS Interface
(2) *DM OBTAIN UNIQUE OWNER PRODUCT WITHIN PRODUCT-ITEM
*DM NOT-FOUND GO TO FINISH.
*DM WRITE PRODUCT.
*DM WRITE ITEM APPEND PRODUCT.
In this UNLOAD run, you must get this one-to-many owner, PRODUCT, to establish currency for each ITEM. After the first pass through this code, you must continue to UNLOAD ITEMs without duplicating PRODUCT. UNIQUE solves the problem. This same path can be used for the first and all subsequent ITEMs. CA-Datamacs/II makes a note of the fact that this particular PRODUCT (it wouldn't work if there were more than one PRODUCT) has been retrieved and written. For the balance of the run, the OBTAIN and WRITE will be ignored. The NOT-FOUND clause is only honored if retrieval fails on the first attempt to acquire PRODUCT.
OBTAIN - Member
OBTAIN MEMBER retrieves a set member and ensures that the specified member will not be duplicated in an UNLOAD data set.
Format
*DM OBTAIN UNIQUE MEMBER record-name WITHIN set-name
*DM AT-END GO TO {paragraph-name | FINISH}.
Parameters
record-name
Name of the member record to be retrieved.
AT-END GO TO
Causes transfer of control to the specified paragraph when no more member records of a specified set can be located.
Programming notes
The conditional exit (AT-END GO TO) of this OBTAIN allows the program to move on to the next set to be included in the testbed or to terminate the UNLOAD function.
OBTAIN - SORTKEY
Chapter 2: Using CA-Datamacs/II IDMS Statement 33
Example
*DM OBTAIN UNIQUE MEMBER ITEM WITHIN ORDER-ITEM
*DM AT-END GO TO CLOSIT.
ITEM is retrieved each time this instruction is encountered. If no more ITEMs can be found, CA-Datamacs/II will exit to CLOSIT. The ITEM will be written to the UNLOAD data set only once.
OBTAIN - SORTKEY
This statement allows you to select a member record in a sorted set.
Format
OBTAIN record-name WITHIN setname
{USING} SORTKEY key-value {CURRENT}
GO TO {paragraph-name|FINISH}.
Parameters
Record name
Name of the member record to be retrieved.
NOT-FOUND GO TO
Causes transfer of control to the specified paragraph if the requested record is not found. If NOT-FOUND is omitted and the retrieval fails, control is transferred to the internal end of job processing by default.
Key-value
"Literal" key value. If the key value is alphanumeric, quotes are used. If numeric, no quotes are used.
Current
Requests search to begin with current record of specified set. When you specify Current, the search begins with the current of set. If Current is not specified, the search begins with owner of the current set.
OBTAIN - Within Set
OBTAIN WITHIN retrieves a set-relative record in the logical order of the set.
OBTAIN - Within Set
34 CA-IDMS Interface
Format
*DM OBTAIN {FIRST |LAST |PRIOR |NEXT} record-name WITHIN set-name
*DM AT-END GO TO {paragraph-name| FINISH}
*DM [WHEN conditional-clause USE record-name]
Parameters
FIRST
Retrieves the first member occurrence of the designated set.
LAST
Retrieves the last member occurrence of the designated set.
NEXT
Retrieves the record following the current record of the designated set.
PRIOR
Retrieves the record before the current record of the designated set.
AT-END GO TO
Causes control to be transferred to a specified paragraph of procedural statements when:
■ FIRST or LAST is specified and there are no member records.
■ NEXT is specified when the last member of the set is current.
■ PRIOR is specified after the first member of the set has been retrieved.
WHEN
The "conditional-clause" is evaluated. If true, the next executable line receives control. If false, control reverts back to the first line of the paragraph in which this OBTAIN occurs. The WHEN clause record name must be the same as the record name specified with OBTAIN.
conditional-clause
See "Using Conditional Expressions" in Chapter 2
Programming notes
■ If the current record is a set owner, issuing OBTAIN FIRST would have the same effect as an OBTAIN NEXT and OBTAIN LAST would be the equivalent of OBTAIN PRIOR.
■ CA-Datamacs/II manages currency by set and will, if necessary, establish record and set name currency before issuing the OBTAIN to IDMS.
PERFORM
Chapter 2: Using CA-Datamacs/II IDMS Statement 35
■ If WHEN is specified in a CA-Datamacs/II LOAD run, CA-Datamacs/II will issue an error message and terminate.
Examples
(1) *DM OBTAIN FIRST ITEM WITHIN ORDER-ITEM
*DM AT-END GO TO PROCESS-END.
Retrieves the first occurrence of the ITEM following its owner, CUSTOMER, and exits to the paragraph, specified with AT-END when there are no more member record occurrences.
(2) *DM OBTAIN LAST ITEM WITHIN ORDER-ITEM
*DM AT-END GO TO ALL-ITEMS.
If more than one ITEM exists, this command will extract the last occurrence. Control is transferred to ALL-ITEMS when there are no more member record occurrences.
(3) *DM OBTAIN NEXT ITEM WITHIN ORDER-ITEM
*DM AT-END GO TO NO-NEXT
*DM WHEN ITEM-VALUE IS LESS THAN 25 USE ITEM.
Live records are modified and used for this test record creation run. At this stage, you are not interested in data that is out of a defined range. ITEMs are retrieved and the value field is tested against 25. If the WHEN clause proves to be true, control passes to the next instruction. If ITEM-VALUE is equal-to or greater than 25, control reverts to the first line in the paragraph containing this OBTAIN NEXT. The WHEN clause record name must be the same as the name of the record to be OBTAINed.
PERFORM
The PERFORM statement transfers control to the specified paragraph name, executes the procedural statements within that paragraph in accordance with the iteration factor (TIMES) and exits to the first executable line following this PERFORM.
Format
*DM PERFORM paragraph-name [{iterations | 1} [TIMES]].
PERMIT
36 CA-IDMS Interface
Parameters
paragraph-name
The label of a closed subroutine, expressed in accordance with CA-Datamacs/II rules for paragraph names.
iterations
The number of excursions through the designated paragraph. Maximum iterations is 65,535.
Programming notes
■ PERFORM statement may be included in a procedural paragraph addressed by other PERFORMs or GO TOs.
■ PERFORM FINISH would cause CA-Datamacs/II to issue an error message and terminate.
■ The paragraph name specified in a PERFORM statement is verified during the CA-Datamacs/II syntax phase. If the target paragraph cannot be located, CA-Datamacs/II will issue an error message and terminate.
Example
*DM START.
*DM PERFORM PRODUCT 4 TIMES.
*DM PERFORM CUSTOMER 1 TIME.
*DM GO TO FINISH.
*
*DM PRODUCT.
*DM STORE PRODUCT.
*
*DM CUSTOMER.
*DM STORE CUSTOMER.
Following the START (mandatory) entry line, the PERFORM statement causes control to be transferred to the PRODUCT paragraph where four occurrences of this record are stored. The second PERFORM is then accessed, the CUSTOMER paragraph is executed and CA-Datamacs/II terminates in response to GO TO FINISH.
PERMIT
The PERMIT statement causes CA-Datamacs/II to verify the system password before allowing execution of a MODIFY, ERASE or DISCONNECT command.
POP
Chapter 2: Using CA-Datamacs/II IDMS Statement 37
Format
*DM PERMIT password.
Parameters
password
The password defined at system installation, expressed without quotation marks.
Programming notes
■ Password must contain one and may contain up to eight alphanumeric characters or symbols. It may not contain a space.
■ The PERMIT statement is never printed by CA-Datamacs/II.
■ If a password had not been declared, the PERMIT statement, if included, is ignored.
■ If the specified password does not equal the installation-time specified password, CA-Datamacs/II will issue an error message and terminate.
■ If a password has been defined, and the PERMIT statement is omitted, CA-Datamacs/II will issue an error message and terminate any run involving MODIFY, ERASE or DISCONNECT.
■ A PERMIT statement must not be followed by a period unless the password contains eight characters.
Example
*DM PERMIT KEY$7$
The key, specified with the PERMIT statement, is validated. If KEY$7$ proves to be the installation password, CA-Datamacs/II allows execution of any ERASE, DISCONNECT or MODIFY statements subsequently encountered.
POP
The POP statement moves the most recent database key from the specified record's stack and places it into the record table. Subsequent operations, such as OBTAIN...USING DBKEY, use the database key from the record table.
Format
*DM POP STACK record-name.
PUSH
38 CA-IDMS Interface
Parameters
record-name
Name of the record to process.
Programming notes
■ When a POP is executed, the most recent database key is moved from the stack into the record table. The stack is then reconfigured so that the next most recent entry becomes the most recent entry. At the end of the reconfiguration cycle, the oldest entry contains zeros.
■ The stack is not freed even if all entries are empty.
PUSH
The PUSH statement moves the database key of the specified record from the record table into a stack area.
Format
*DM PUSH STACK record-name.
Parameters
record-name
Name of the record to process.
Programming notes
■ When the first PUSH is executed for a given record type, a stack area is allocated for that record type.
■ A stack can contain up to 16 database keys. Each new PUSH causes a reconfiguration of the stack so that the database key entering into the stack will be the first out. When the stack is full, the oldest entry is lost to make room for the new entry.
READY
Chapter 2: Using CA-Datamacs/II IDMS Statement 39
READY
Ready causes IDMS to prepare the designated area for access in the usage mode specified. If omitted, all areas associated with the subschema are READYed as shown in the programming notes.
Format
*DM READY area-name
*DM [USAGE-MODE [IS] {EXClusive RETrieval|PROTected RETrieval | RETrieval|EXClusive
UPDate|PROTected UPDate|UPDate}].
Parameters
area-name
The name of the area to be accessed, as defined in the subschema. If more than one area is to be accessed, each may be assigned a different usage mode with a separate READY command.
USAGE-MODE
Defines the conditions under which the area is to be accessed.
EXClusive
No other program may access this file through IDMS until CA-Datamacs/II terminates.
PROTected
While CA-Datamacs/II is processing a record from the READYed area, concurrently executing programs are locked-out.
RETrieval
CA-Datamacs/II may not request STORE, MODIFY, ERASE, or DISCONNECT functions in the designated area.
UPDate
Any supported function is allowed.
READY
40 CA-IDMS Interface
Programming notes
■ The default values for usage mode depend upon the nature of the CA-Datamacs/II run, as follows
CA-Datamacs/II Task Usage Mode Default
CREATE PROTECTED UPDATE
UNLOAD RETRIEVAL
LOAD PROTECTED UPDATE
MODIFY PROTECTED UPDATE
■ The CA-Datamacs/II READY is functionally identical to that of IDMS except that you are not permitted to change the usage mode during CA-Datamacs/II execution and READY statements may not be distributed throughout the program.
■ READY commands are optional if the usage mode has been stipulated in the subschema. However, if a READY is issued for one area, READYs must be issued for all areas to be referenced by CA-Datamacs/II.
■ If the usage mode specified by READY conflicts with the subschema definition, CA-Datamacs/II will be put in a WAIT state and the system operator will be notified. CA-Datamacs/II should then be terminated, the programmer notified and the usage conflict resolved before attempting to rerun CA-Datamacs/II.
■ A maximum of fourteen READY statements may be included.
Examples
(1) *DM READY TESTBED.
Default protection parameters are added as shown in the programming notes. The command is forwarded to IDMS and the TESTBED area is made available.
(2) *DM READY AREA1 USAGE-MODE IS UPDATE.
AREA1 is made available for unrestricted (and unprotected) access.
SCAN
The SCAN statement conducts an area sweep to retrieve an occurrence of the designated record.
READY
Chapter 2: Using CA-Datamacs/II IDMS Statement 41
Format
*DM AT-END GO TO { paragraph-name | FINISH}
*DM [WHEN conditional-clause USE record-name].
Parameters
record-name
The owner or member record whose occurrences are to be retrieved.
AT-END GO
TO Causes control to be transferred to a specified paragraph of procedural statements when the SCAN reaches the end of the area.
WHEN
Evaluates the conditional clause following each successful obtain. If the condition tests true, control goes to the next executable line in the program; if false, CA-Datamacs/II returns to the first executable line of the paragraph in which this SCAN appears.
conditional-clause
See "Using Conditional Expressions" in the CA-Datamacs/II Reference Guide.
USE
The USE clause record name must be the same as the name designated with SCAN.
Programming notes
SCAN retrieves record occurrences by issuing one OBTAIN FIRST followed by a series of OBTAIN NEXT commands. The retrieval is, however, based upon an area sweep rather than set location.
Example
*DM GET-OWNER.
*DM SCAN FOR PRODUCT
*DM AT-END GO TO LAST-FOUND
*DM WHEN PROD-NUMBER EQUALS 'CCC11188' USE PRODUCT.
The SCAN within this GET-OWNER paragraph does an area sweep for PRODUCT. When the area's end is reached, control passes to LAST-FOUND. Each time a PRODUCT record is obtained, the WHEN condition is tested. If PROD-NUMBER is found to be CCC11188, CA-Datamacs/II will continue processing at the next instruction. If PROD-NUMBER is less-than or greater-than CCC11188, control will be returned to the first line in the paragraph in which this SCAN appears.
STORE
42 CA-IDMS Interface
STORE
The STORE statement places a record in the database and connects that record to all sets in which it has been designated an automatic member.
Format
*DM STORE record-name
Parameters
record-name
The subschema-defined name of the record to be STOREd.
Programming notes
■ If a STORE command is found in an UNLOAD run, CA-Datamacs/II will issue an error message and terminate.
■ In a CREATE run, record name specification would be ignored. It is assumed that the STORE command applies to the record being generated. If a record name is specified, the syntax will be verified.
Example
*DM STORE ITEM.
ITEM is STOREd in the database.
TRACE
TRACE is a debugging statement used to display the CA-Datamacs/II language statements executed during a CA-Datamacs/II run
Format
*DM TRACE {ON | OFF}.
TRACE
Chapter 2: Using CA-Datamacs/II IDMS Statement 43
Parameters
ON
Enables the TRACE facility.
OFF
Disables the TRACE facility.
Programming notes
■ Output produced by TRACE is listed on the SYSPRINT data set.
■ TRACE ON will appear on the listing, but TRACE OFF will not.
■ There is no limit to the number of TRACE statements that can be specified.
■ TRACE statements should not be used before START paragraphs.
Examples
(1) *DM IDMS CREATE.
*DM START.
*DM PERFORM PRODUCT.
*DM GO TO FINISH.
*DM PRODUCT.
*DM TRACE ON.
*DM STORE PRODUCT.
*DM TRACE OFF.
In this example, the TRACE facility is enabled upon entry into the PRODUCT paragraph and disabled immediately prior to exiting.
(2) *DM IDMS UNLOAD.
*DM START.
*DM TRACE ON.
*DM SCAN FOR CUSTOMER
*DM AT-END GO TO FINISH.
*DM WRITE CUSTOMER.
In this example, TRACE is enabled immediately at the start of execution. All CA-Datamacs/II statements will be displayed.
USER-ERROR
44 CA-IDMS Interface
(3) *DM IDMS LOAD.
*DM START.
*DM TRACE ON.
The above example is an automatic LOAD run. To TRACE the entire LOAD process, a START paragraph and a TRACE ON statement are used. Since no
other paragraphs are specified, the LOAD process will be automatic, but all CA-Datamacs/II operations will be displayed.
(4) *DM IDMS LOAD.
*DM START.
*DM ITEM.
*DM TRACE ON.
*DM OBTAIN PRODUCT KEYLOC 10 KEYLEN 8
*DM NOT-FOUND GO TO FINISH.
*DM STORE ITEM.
*DM TRACE OFF.
*DM OREMARK.
*DM TRACE ON.
*DM STORE OREMARK
*DM TRACE OFF.
*DM PRODUCT.
*DM STORE PRODUCT.
The above is a manual LOAD process. In this case, only CA-Datamacs/II activity associated with the ITEM and OREMARK paragraphs will be displayed.
USER-ERROR
The USER-ERROR statement writes a four character, user-defined character string to the SYSPRINT file and causes CA-Datamacs/II to terminate the run with ROLLBACK.
Format
*DM USER-ERROR 'Unnn'.
Parameters
error-code
A string of 4 characters. Starting with a 'U' followed by a 3-digit user defined error code.
WRITE
Chapter 2: Using CA-Datamacs/II IDMS Statement 45
Programming notes
■ The error code must be bracketed by single quotes (unless QUOTES has redefined the symbol).
■ The character string may not contain any spaces.
■ CA-Datamacs/II initiates a ROLLBACK, whether or not it had been program-specified, issues an error message and terminates after processing a USER-ERROR.
■ You should avoid error messages which duplicate those of CA-Datamacs/II or IDMS. See Error Messages.
Example
*DM ERROR-EXIT.
*DM USER-ERROR 'U998'.
At the paragraph, ERROR-EXIT, accessed through a NOT-FOUND GO TO ERROR-EXIT. clause, you direct printing of the U998 message.
WRITE
The WRITE statement places a designated record in the data set defined by the //IDMSOUT DD statement.
Format
*DM WRITE record-name
*DM [APPEND
*DM [SAVE|USESAVE record-name1]
*DM [[CALC] owner-record-name ... ]
*DM [VIA owner-record-name WITHIN set-name...]
*DM [CONNECT [TO] set-name ... ]
*DM [DISCONNECT [FROM] set-name ... ]].
WRITE
46 CA-IDMS Interface
Parameters
record-name The subschema-defined name of the record to be UNLOADED.
APPEND Generates an epilog and attaches it to a record being UNLOADed. The epilog contains the information required by the CA -Datamacs/IICA-Datamacs/II LOAD run to reconstruct the currency and set participation conditions described in the CALC, VIA, CONNECT and/or DISCONNECT elements.
SAVE The DBkey of the current record is saved for later use.
USESAVE CA-Datamacs/II uses the DBkey saved (with SAVE) to issue a 'FIND DBKEY' to establish the currency of record-name1.
owner-record-name The set owner(s) of the member record being written, which must be made current before this record (owner-record-name) can be LOADed into the database. An owner UNLOADed just ahead of its member will be current when LOADed and should not be specified with a CALC or VIA.
set-name The set name(s) to which the member record is to be manually CONNECTed or from which it is to be manually DISCONNECTed when LOADed. Do not include automatic sets.
Programming notes
■ An epilog should not be APPENDed to an owner that is not also a member.
■ Only the subschema limits the number of CALC, VIA and CONNECT or DISCONNECT clauses a member record may have APPENDed.
■ Owner record names and set names may all follow their associated CALC, VIA, CONNECT or DISCONNECT qualifier; or the qualifier may be repeated in separate *DM statements for each owner or set name.
■ For every record obtained from the database, CA-Datamacs/II records the CALC key or VIA record's database key. APPEND accesses the key and adds it to the epilog.
WRITE
Chapter 2: Using CA-Datamacs/II IDMS Statement 47
■ Every UNLOADed record includes a 12-byte prolog and at least a 1-byte epilog. In run listings the prolog appears as:
1 03 IDMS-ID-iiii PIC 9(4). iiii0030
5 03 IDMS-RN-iiii PIC 9(7) COMP-3. iiii0040
9 03 IDMS-DBKEY-iiii PIC 9(4). iiii0050
where
IDMS-ID
Record ID
IDMS-RN
Offset to (starting column of) epilog
IDMS-DBKEY
Data base key
iiii
Record ID
The minimum epilog is a 1-byte, end-of-epilog sentinel, X'FF'.
Examples
(1) *DM WRITE ITEM.
The record, ITEM, is written with an epilog of only X'FF'.
(2) *DM WRITE ITEM
*DM APPEND CALC ORDOR PRODUCT
*DM CONNECT ORDER-ITEM PRODUCT-ITEM.
The member record, ITEM, gets an epilog in which ORDOR and PRODUCT are identified as owners that are accessed in the CALC mode and must be
current when ITEM is returned to the database. The epilog also notes a (non-DEMOSS03) membership requirement: CA-Datamacs/II must call for the
connection of ITEM to both ORDER-ITEM and PRODUCT-ITEM. In DEMOSS03, these are automatic connections which IDMS will handle. They would not have been APPENDed to ITEM.
WRITE
48 CA-IDMS Interface
® SAVE/USESAVE are designed to handle nested relationships. Automatic sets have to be coded prior to manual sets. Below, the CA-IDMS Employee Demo Data Base is used as an example.
WRITE EMPLOYEE APPEND SAVE CALC DEPARTMENT CALC OFFICE.
WRITE STRUCTURE APPEND USESAVE EMPLOYEE CALC EMPLOYEE CONNECT TO REPORTS-TO.
Since the set MANAGES is Mandatory Automatic, there is no need to code CONNECT after USESAVE.
However, automatic sets have to be coded prior to manual sets. For example, if the set MANAGES is Optional Manual (with EMPLOYEE as owner and STRUCTURE as member), and REPORTS-TO is Mandatory Automatic (with EMPLOYEE as owner and STRUCTURE as member), the following WRITE should be coded:
WRITE STRUCTURE APPEND CALC EMPLOYEE
USESAVE EMPLOYEE CONNECT TO MANAGES.
Chapter 3: Retrieving Record Descriptions (COPY) 49
Chapter 3: Retrieving Record Descriptions (COPY)
This section contains the following topics:
Overview (see page 49) The CA-Datamacs/II Tasks (see page 55)
Overview
Every record processed by CA-Datamacs/II must have a corresponding record description in the Integrated Data Dictionary. All CA -Datamacs/IICA-Datamacs/II runs, except NDBR-COPY, require that the record descriptions be defined in a subschema and all, except NDBR-COPY, must include a *DB subschema specification.
COPY statements extract record descriptions from the dictionary. CA-Datamacs/II offers two forms; one to acquire all record descriptions in a particular subschema and a second to extract specific descriptions by record name.
Format I, the inclusive COPY, is more efficient when a CA-Datamacs/II run will reference every record or when accommodating all of the record descriptions, referenced or not, is well within the capacity of CA-Datamacs/II tables. If, for example, a subschema defined five records, A through E, but only three (A, B, and C) were required, retrieval could take either of two forms.
The following illustrates IDD retrieval statements
NDBR-COPY, the exception run, builds records from descriptions that are non-schema owned. It does not include a *DB subschema specification and must use the Format II COPY.
Merging In-Stream Data
The reliance upon predefined record descriptions is not intended to suggest a mandatory, one-for-one relation between a subschema's record descriptions and the output of a CA-Datamacs/II run. All CA-Datamacs/II runs, except UNLOAD, may incorporate field modifiers to alter record format and none, including UNLOAD, need generate an output record for every subschema record description.
Overview
50 CA-IDMS Interface
The CA-Datamacs/II field modifiers are introduced as in-stream data and are merged with the record descriptions as they are read from the dictionary. The merge is based upon sequence numbers added to the record descriptions by CA-Datamacs/II and programmed into the in-stream data. CA-Datamacs/II record description sequencing is illustrated in the following excerpts from DEMOSS03.
M A P 01 ORDOR. 06200010
VERS #* VERSION=0001 06200020
1 03 IDMS-ID-0620 PIC 9(4). 06200030
5 03 IDMS-RN-0620 PIC 9(7) COMP-3. 06200040
9 03 IDMS-DBKEY-0620 PIC 9(4). 06200050
0013 03 ORD-NUMBER PIC X(7). 06200060
0020 03 ORD-CUST-PO-NUMB PIC X(10). 06200070
0030 03 ORD-DATES. 06200080
0038 05 ORD-REQ-DATE PIC X(6). 06200090
:
:
:
M A P 01 PRODUCT. 06310010
VERS #* VERSION=0001 06310020
1 03 IDMS-ID-0631 PIC 9(4). 06310030
5 03 IDMS-RN-0631 PIC 9(7) COMP-3. 06310040
9 03 IDMS-DBKEY-0631 PIC 9(4). 06310050
Overview
Chapter 3: Retrieving Record Descriptions (COPY) 51
00013 01 PROD-NUMBER PIC X(8). 06310060
00021 03 PROD-DESC PIC X(20). 06310070
00041 03 PROD-SPECS. 06310080
00041 05 PROD-UNIT-CODE PIC X. 06310090
00042 05 PROD-WEIGHT PIC 9(5)V99 COMP-3 06310100
00046 05 PROD-COLOR-CODE PIC X(4). 06310110
00050 03 PROD-COST PIC S9(5)V99 COMP-3. 06310120
00054 03 PROD-PRICE PIC S9(5)V99 COMP-3. 06310130
:
:
:
CA-Datamacs/II puts the record ID in columns 73 through 76 and sequences columns 77 through 80 by 10.CA-Datamacs/II puts the record ID in columns 73 through 76 and sequences columns 77 through 80 by 10.
The three data items, IDMS-ID, IDMS-RN and IDMS-DBKEY comprise the 12-byte record prolog described earlier. It appears in run output listings when record images are read from the database.
To merge the CA-Datamacs/II field modifiers, you must:
1. Code the record ID in 73 through 76.
2. Specify the point of insertion by a value in 77 through 80, which is greater than that of the record description to which it applies and less than the number of the following descriptor line.
The following is an example of how you would number in-stream changes:
DATA DIVISION.
*DB DEMOSS03 WITHIN DEMOSCHEM.
*
COPY ORDOR.
*DM CONSTANT '123185'. 06200095
*DM END-COPY.
*
COPY PRODUCT.
*DM IF PROD-COLOR-CODE = 'RED' 06310094
*DM CONSTANT 'R'. 06310096
*DM IF PROD-DESC = 'TIERACK' 06310124
Overview
52 CA-IDMS Interface
*DM AND PROD-COLOR-CODE = 'BLUE' 06310126
*DM CONSTANT 8.50. 06310128
*DM IF PROD-DESC = 'TIERACK' 06310133
*DM AND PROD-COLOR-CODE = 'BLUE' 06310135
*DM CONSTANT 12.99. 06310137
*DM END-COPY. 99999999
PROCEDURE DIVISION.
END-COPY may be numbered but the number is never checked and END-COPY itself never appears in an output listing.
If the CA-Datamacs/II run is prepared to tolerate inclusion of all the DEMOSS03 record descriptions, these same changes could have been coded as:
DATA DIVISION.
*DB DEMOSS03 WITHIN DEMOSCHEM.
*
COPY IDMS RECORDS.
*DM CONSTANT '123185'. 06200095
*DM IF PROD-COLOR-CODE = 'RED' 06310094
*DM CONSTANT 'R'. 06310096
*DM IF PROD-DESC = 'TIERACK' 06310124
*DM AND PROD-COLOR-CODE = 'BLUE' 06310126
*DM CONSTANT 8.50. 06310128
*DM IF PROD-DESC = 'TIERACK' 06310133
*DM AND PROD-COLOR-CODE = 'BLUE' 06310135
Overview
Chapter 3: Retrieving Record Descriptions (COPY) 53
*DM CONSTANT 12.99. 06310137
PROCEDURE DIVISION.
When merged, either form of in-stream data would yield the following CA-Datamacs/II output listing of records and modifiers.
COPY ORDOR.
*
M A P 01 ORDOR. 06200010
VERS #* VERSION=0001 06200020
1 03 IDMS-ID-0620 PIC 9(4). 06200030
5 03 IDMS-RN-0620 PIC 9(7) COMP-3. 06200040
9 03 IDMS-DBKEY-0620 PIC 9(4). 06200050
0013 03 ORD-NUMBER PIC X(7). 06200060
0020 03 ORD-CUST-PO-NUMB PIC X(10). 06200070
0030 03 ORD-DATES. 06200080
0038 05 ORD-REQ-DATE PIC X(6). 06200090
*DM CONSTANT '123185'. 06200095
:
:
COPY PRODUCT.
*
M A P 01 PRODUCT. 06310010
VERS #* VERSION=0001 06310020
1 03 IDMS-ID-0631 PIC 9(4). 06310030
5 03 IDMS-RN-0631 PIC 9(7) COMP-3. 06310040
9 03 IDMS-DBKEY-0631 PIC 9(4). 06310050
00013 01 PROD-NUMBER PIC X(8). 06310060
00021 03 PROD-DESC PIC X(20). 06310070
00041 03 PROD-SPECS. 06310080
00041 05 PROD-UNIT-CODE PIC X. 06310090
*DM IF PROD-COLOR-CODE = 'RED' 06310094
*DM CONSTANT 'R'. 06310096
00042 05 PROD-WEIGHT PIC 9(5)V99 COMP-3 06310100
00046 05 PROD-COLOR-CODE PIC X(4). 06310110
00050 03 PROD-COST PIC S9(5)V99 COMP-3. 06310120
*DM IF PROD-DESC = 'TIERACK' 06310124
*DM AND PROD-COLOR-CODE = 'BLUE' 06310126
*DM CONSTANT 8.50. 06310128
00054 03 PROD-PRICE PIC S9(5)V99 COMP-3. 06310130
*DM IF PROD-DESC = 'TIERACK' 06310133
*DM AND PROD-COLOR-CODE = 'BLUE' 06310135
*DM CONSTANT 12.99. 06310137
:
:
Overview
54 CA-IDMS Interface
Selective Field Modification
Field modifiers need not be inserted as in-stream data. The in-stream approach is handy when the scope or life of the resultant product is limited, but there are times when more permanent changes are warranted.
For these situations, CA-Datamacs/II makes provision for including field modifiers with the associated record description. The association is achieved by filing the field modifiers in the Integrated Data Dictionary.
SCRIPT Numbers
The term SCRIPT is used to categorize CA-Datamacs/II statements by application. The SCRIPT number occupies the two columns immediately following *DM, as *DM01 through *DM99. Script numbers may be allocated on an individual (programmer) or functional (type of test) basis. Regression tests often use script numbers, divided into levels such as 01 to 09, 10 to 19, and so-on, to identify checkpoints - development stages at which tests established error-free performance.
To associate CA-Datamacs/II scripts with dictionary records:
1. Retrieve the record(s) to which scripts are to be added.
2. Code the CA-Datamacs/II script statements as IDMS comments.
3. Run the IDMS schema and subschema update programs to file the record with its associated CA-Datamacs/II statements.
An IDMS comment is expressed as a character string bracketed by single quotes (apostrophes); a CA-Datamacs/II statement is coded as a COBOL comment. To use a CA-Datamacs/II statement as an IDMS comment for insertion into the dictionary, simply insert the CA -Datamacs/IICA-Datamacs/II statement between the IDMS apostrophes as:
CA-Datamacs/II *DM CONSTANT 'ABCD'.
|
|
|
IDMS: COMMENT 'A CA-Datamacs/II LINE COULD GO IN HERE'.
|
|
|
'*DM CONSTANT "ABCD" .'.
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 55
Note: The single quotes bracketing the non-numeric literal, ABCD, are doubled-up (converted to quotation marks) to avoid interpreting the first apostrophe as the comment's end. If the installation standard calls for quotation marks, instead of apostrophes, code the QUOTE directive described in Chapter 4 and reverse the expression as:
"*DM CONSTANT 'ABCD'.".
To associate CA-Datamacs/II scripts with a record descriptor field, add all of the CA-Datamacs/II statements following the field to be modified as:
05 DOSAGE-DRUG1 PIC 9(2).
COMMENT
'*DM01CLUSTER BETWEEN 01 AND 50.'
COMMENT
'*DM02CLUSTER BETWEEN 51 AND 99.'
COMMENT
'*DM99CONSTANT "ERROR".'.
05 DOSAGE-DRUG2 PIC 9(2).
COMMENT
'*DM01RANDOM .......................'.
COMMENT
'*DM02HEX "03AF".'.
COMMENT
'*DM99DEFAULT.'.
After these scripts have been filed, a specific class of scripts may be extracted by:
COPY DRUGXYZ VERSION 3 SCRIPT 2.
Yields:
01 DRUGXYZ.
05 DOSAGE-DRUG1 PIC 9(2).
*DMI CLUSTER BETWEEN 51 AND 99.
05 DOSAGE-DRUG2 PIC 9(2).
*DMI HEX "03AF".
The CA-Datamacs/II Tasks
This section describes each CA-Datamacs/II tasks. The example of each CA-Datamacs/II task is illustrated using excerpts from the CA-IDMS subschema DEMOSS03 to provide record names, record IDs, location modes and network relationships. The DEMOSS03 data structure diagram is shown below:
ORDER ENTRY DATA STRUCTURE
The CA-Datamacs/II Tasks
56 CA-IDMS Interface
CA-Datamacs/II Task Requirements
(A) = Automatic Load
(M) = Manual Load
NDB = Non-Data Base Copy
CREATE UNLOAD LOAD
(A) LOAD (M)
MODIFY COPY COPY (NDB)
Must have GENerate Control
Y N Y Y Y Y Y
Needs PRINT if listings are desired
Y Y Y Y Y Y Y
Uses IDMS Y Y Y Y Y N N
Requires CA -Datamacs/IICA-Datamacs/II IDMS Requires
Y Y Y Y Y Y Y
READY statement is mandatory
N N N N N N N
Must specify subschema (*DB
statement)
Y Y Y Y Y Y N
Must COPY record descriptions
Y Y Y Y Y Y Y
Puts new test records into database
Y N Y Y N N N
Modifies records in database
N N N N Y N N
Obtains records from database
N Y N N Y N N
Field Modifiers may be used
Y N Y Y Y Y Y
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 57
CREATE UNLOA
D LOAD (A)
LOAD (M)
MODIFY COPY COPY (NDB)
May use CONNECT Y (1) N Y Y N N
May use DISCONNECT
Y (1) N Y Y N N
May use ERASE N N N N Y N N
May use GO TO Y Y N (2) Y N N
May use IF Y Y N Y Y N N
May use MODIFY statement
N N N N Y N N
May use OBTAIN Y Y N Y Y N N
May use PERFORM Y Y N Y Y N N
May use PERMIT N N N N Y N N
May use POP STACK
Y Y N Y Y N N
May use PUSH STACK
Y Y N Y Y N N
May use ENABLE IDMSWRK
N N Y Y N N N
May use SCAN Y Y N Y Y N N
May use STORE Y N N Y N N N
May use TRACE Y Y Y Y Y N N
May use USER-ERROR
N Y N Y Y N N
May use WRITE N Y N N N N N
The CA-Datamacs/II Tasks
58 CA-IDMS Interface
Notes:
(1) Only as a clause in the WRITE statement.
(2) GO TO FINISH only.
This table illustrates sample elements that would be used in a run stream. Note: PROGRAM-ID is mandatory if the CA-Datamacs/II run has a preregistered name.
Element Expressed As
CA-Datamacs/II Directives [*DM SYNTAX] Do parsing phase only
[*DM QUOTE] Use " instead of '
COBOL Statements [IDENTIFICATION DIVISION.]
[PROGRAM ID. <program-name>.] See note
[INPUT-OUTPUT SECTION.]
FILE-CONTROL.
CA-Datamacs/II Controls [*DM GENerate] Build test records
[*DM PRint] List run output
[*DM DEFAULT] Default field content
*DM IDMS What this run will do
[*DM READY] Prepare area for access
[*DM PERMIT] Validate password
[*DM ENABLE] Open //IDMSWRK data set
CA-Datamacs/II Procedural Statements
{GO TO
[*DM PERFORM}] Transfer control
[*DM CONNECT] Establish set membership
[*DM DISCONNECT] Cancel set membership
[*DM ERASE] Disable record access
[*DM SCAN] Area sweep
[*DM STORE] Put in database
[*DM WRITE] Put in UNLOAD data set
COBOL Statements DATA DIVISION. [SCHEMA SECTION.]
Data Base Specification *DB Schema/subschema
IDD Retrieval Commands {IDMS RECORDS Get all descriptions
record-name} Get specific record
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 59
Element Expressed As
CA-Datamacs/II Field Modifiers [*DM BATCH] Add & reset when MOVEd
[*DM CLUSTER] In-range random values
[*DM IF/ELSE] Conditional modification
[*DM MOVE] Swap fields
[*DM RANDOM] Insert random value
[*DM SUM] Running total
[*DM USE] Apply format to field
COBOL Statement PROCEDURE DIVISION.
CREATE
CREATE and LOAD populate a database with records derived from subschema-defined record descriptions.
The procedural statements and record retrieval commands that could be used to CREATE a set of communication test records are illustrated below. Three types of test records are required:
■ one that is representative of the maximum record length allowed by the database
■ one that approximates the average length of records in the current database
■ one that is no longer than the shortest record tolerated
Assume that DEMOSS03's PRODUCT, ORDOR and ITEM record descriptions satisfy these length requirements.
The CREATE run following is used to generate test records that are representative of the database maximum, average and minimum lengths and contain the entire code set.
*DM GENERATE 400
*DM PRINT ALL FOR TERMINAL
*DM DEFAULT IS RANDOM.
*DM IDMS CREATE.
*DM START.
*DM PERFORM PRODUCT 100 TIMES.
*DM PERFORM ORDOR 200 TIMES.
*DM GO TO FINISH.
*
*DM PRODUCT.
*DM STORE PRODUCT.
*
*DM ORDOR.
*DM STORE ORDOR.
The CA-Datamacs/II Tasks
60 CA-IDMS Interface
*DM PERFORM ITEM.
*
*DM ITEM.
*DM OBTAIN CALC PRODUCT
*DM USING KEYLOC 1 KEYLEN 8
*DM NOT-FOUND GO TO FINISH.
*DM STORE ITEM.
*
DATA DIVISION.
*DB DEMOSS03 WITHIN DEMOSCHEM.
COPY ORDOR.
*DM SEQUENCE '0A0B0C0D0E0F' 06200065
*DM BY '010101010101' REPEAT. 06200067
*DM END-COPY.
*
COPY ITEM.
*DM SEQUENCE '00010050' THRU '00015050' 06210063
*DM BY '00000050' REPEAT. 06210065
*DM END-COPY.
*
COPY PRODUCT.
*DM SEQUENCE X'00010050' 06310063
*DM BY X'00000050'. 06310065
*DM CONSTANT 'THE QUICK BROWN FOX '. 06310072
*DM CONSTANT 'JUMPS OVER THE LAZY '. 06310092
*DM CONSTANT 'DOG''S BACK '. 06310112
*DM END-COPY.
PROCEDURE DIVISION
Populating A Data Base From Scratch
CA-Datamacs/II can populate IDMS test databases from scratch. Only one execution is necessary to CREATE and STORE the records in a CREATE run.
The following example demonstrates CA-Datamacs/II' ability to populate a test database from scratch.
■ One CUSTOMER record is generated and stored.
■ The CUSTOMER record owns two ORDOR records; each ORDOR owns two ITEMS; and each ITEM is owned by a PRODUCT record.
■ PRODUCT records are STOREd before ITEMS. Before storing EACH ITEM, its PRODUCT is made current with an OBTAIN CALC.
Procedural logic must begin with a START and other paragraph names must correspond to record names.
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 61
The COPY statement extracts record descriptions from the specified subschema in the IDD.
FILE-CONTROL.
*DM GENERATE ALL
*DM PRINT ALL FOR TERMINAL
*DM DEFAULT IS STANDARD.
*DM IDMS CREATE.
*
*DM START.
*DM PERFORM PRODUCT 4 TIMES.
*DM PERFORM CUSTOMER 1 TIME.
*DM GO TO FINISH.
*
*DM PRODUCT.
*DM STORE PRODUCT.
*
*DM CUSTOMER.
*DM STORE CUSTOMER.
*DM PERFORM ORDOR 2 TIMES.
*
*DM ORDOR.
*DM STORE ORDOR.
*DM PERFORM ITEM 2 TIMES.
*
*DM ITEM.
*DM OBTAIN CALC PRODUCT
*DM USING KEYLEN 1 KEYLOC 8
*DM NOT-FOUND GOTO FINISH.
*DM STORE ITEM.
*
DATA DIVISION.
*DB DEMOSS03 WITHIN DEMOSCHEM.
WORKING STORAGE SECTION.
*
COPY CUSTOMER.
*
M A P 01 CUSTOMER. 06110010
VERS #. VERSION=0001 06110020
0001 03 CUST-NUMBER PIC X(10). 06110060
*DM CONSTANT '0411039504'. 06110065
0011 03 CUST-NAME PIC X(20). 06110070
*DM CONSTANT 'CUSTOMER-NAME'. 06110075
0031 03 CUST-ADDRESS. 06110080
The CA-Datamacs/II Tasks
62 CA-IDMS Interface
0031 05 CUST-ADDR1 PIC X(20). 06110090
0051 05 CUST-ADDR2. 06110100
0051 06 CUST-CITY PIC X(15). 06110110
*DM CONSTANT 'ROCHESTER, NY'. 06110115
:
:
COPY ORDOR.
*
M A P 01 ORDOR. 06200010
VERS #* VERSION=0001 06200020
0001 03 ORD-NUMBER PIC X(7). 06200060
*DM SEQUENCE '0000011' BY '0000011'. 06200065
0008 03 ORD-CUST-PO-NUMB PIC X(10). 06200070
0018 03 ORD-DATES. 06200080
0018 05 ORD-REQ-DATE PIC X(6). 06200090
*DM DATE BETWEEN 01/01/80 AND 12/31/99. 06200095
:
:
COPY ITEM.
*
M A P 01 ITEM. 06210010
VERS #* VERSION=0001 06210020
0001 03 ITEM-PROD-NUMBER PIC X(8). 06200060
*DM SEQUENCE '00000100' BY '00000010'. 06200065
:
:
COPY PRODUCT.
*
M A P 01 PRODUCT. 06310010
VERS #* VERSION=0001 06310020
0001 01 PROD-NUMBER PIC X(8). 06310060
*DM SEQUENCE '00000100' BY '00000010'. 06310060
0009 03 PROD-DESC PIC X(20). 06310070
*DM CONSTANT 'GOLF CLUBS' 'SOCCER BALL' 06310072
*DM 'SKIS' 'TENNIS RACKET'. 06310074
:
:
PROCEDURE DIVISION.
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 63
UNLOAD
UNLOAD extracts selected copies of database records and writes them to a sequential data set. In the process, it can record the currency and set participation requirements of member records and it always includes record IDs in the output data set.
Although it could copy the entire database, UNLOAD should not be viewed as a data backup utility or a flat-file generator. IDMS provides the former and either COPY or NDBR-COPY can produce flat-files.
The UNLOAD function relies upon record descriptions read from the IDD, extracts record images with either an area sweep (SCAN) or directed retrieval (OBTAIN) and presumes the existence of the LOAD routine. CA-Datamacs/II field modifiers are not applied. If they are included as in-stream data, they will be flagged; if they are embedded in record descriptions, they will be ignored. SCANs and OBTAINS designate the record images to be taken from the live database; CA-Datamacs/II branching directives, PERFORM or GO TO, may be used to limit the occurrences.
Owner or member records may be selected, without regard to their subschema-defined set participation, if the length, content or format of these particular records satisfy a specific requirement.
In the following example note that the CA-Datamacs/II GENERATE statement is not used to quantify output and that the number of records written to the sequential data set is determined either explicitly by a PERFORM or implicitly by iteration of an OBTAIN until all occurrences have been accessed and the NOT-FOUND clause takes effect. The USER-ERROR exit is included just in case the number specified exceeds the number of occurrences in the live database when the run is executed.
*DM PRINT ALL FOR TERMINAL.
*DM IDMS UNLOAD.
*
*
*DM START.
*DM OBTAIN CALC CUSTOMER
*DM USING KEY IS 'A362900000'
*DM NOT-FOUND GO TO BAD-COUNT.
*DM WRITE CUSTOMER.
*DM PERFORM ORDOR 10 TIMES.
*
*DM OREMARK.
*DM SCAN FOR OREMARK
*DM AT-END GO TO FINISH.
The CA-Datamacs/II Tasks
64 CA-IDMS Interface
*DM WRITE OREMARK.
*DM GO TO OREMARK.
*
*DM ORDOR.
*DM OBTAIN NEXT ORDOR WITHIN CUSTOMER-ORDER
*DM AT-END GO TO BAD-COUNT.
*DM WRITE ORDOR.
*
*DM BAD-COUNT.
*DM USER-ERROR 'UBAD'.
In the START paragraph, we write one customer record, ten of its orders and as many OREMARKS as we can find. After writing the CUSTOMERS and ORDORS, the program will fall through and write OREMARKS until all have been obtained.
The UNLOAD should be programmed in terms of the currency and set participation that the subsequent LOAD will be required to observe. This reciprocal relationship between UNLOAD and LOAD cannot be avoided. UNLOAD output records contain a 12-byte prolog and variable-length epilog (described under the WRITE statement) that LOAD is designed to anticipate.
Owner records that are UNLOADed directly ahead of their members will be current when LOADed and need no special attention; mandatory and automatic set participation options will be attended to by IDMS when a record is stored. Neither require programmer attention; but owners that are not written in-line and the optional/manual set participants must be APPENDed to the member records involved.
If live records are being UNLOADed to build a model described by a new subschema, there is no point in APPENDing the currencies or set participations of the UNLOAD subschema and in anticipating the new subschema by defining its relationships in the UNLOADed data set. The UNLOADed data set can serve as input to different LOAD runs, each with a different subschema in mind.
In the next example of an UNLOAD, the APPEND clause of the WRITE statement creates an epilog containing the name(s) of records that must be made current and/or records that must be CONNECTed/DISCONNECTed when this file is loaded.
FILE-CONTROL.
*
*DM PRINT ALL FOR TERMINAL.
*DM IDMS UNLOAD.
*DM ALTERNATE DICTIONARY NAME IS DICTMAS.
*
*DM START.
*DM OBTAIN CALC MCUSTOMER
*DM KEY IS 'AC' 000120 X'7E7F'
*DM NOT-FOUND GO TO FINISH.
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 65
*DM WRITE MCUSTOMER.
*
*DM SALES.
*DM OBTAIN NEXT MSALES
*DM WITHIN MCUSTOMER-SALES
*DM AT-END GO TO FINISH.
*DM WRITE MSALES
*DM APPEND CONNECT MCUSTOMER-SALES.
*
*DM ORDOR.
*DM OBTAIN NEXT MORDOR
*DM WITHIN MCUSTOMER-ORDOR
*DM AT-END GO TO FINISH.
*DM WRITE MORDOR.
*
*DM ITEM.
*DM OBTAIN NEXT MITEM
*DM WITHIN MORDER-ITEM
*DM AT-END GO TO ORDOR.
*DM OBTAIN UNIQUE OWNER MPRODUCT
*DM WITHIN MPRODUCT-ITEM
*DM NOT-FOUND GO TO MY-OWN-ERROR.
*DM WRITE MPRODUCT.
*DM OBTAIN UNIQUE OWNER MDLCL-JCT
*DM WITHIN MDLCL-ITEM
*DM NOT-FOUND GO TO MY-OWN-ERROR.
*DM OBTAIN UNIQUE OWNER MCORPIND
*DM WITHIN MCORPIND-DLCL
*DM NOT-FOUND GO TO MY-OWN-ERROR.
*DM OBTAIN UNIQUE OWNER MCTRL
*DM WITHIN MCTRL-CORPIND
*DM NOT-FOUND GO TO MY-OWN-ERROR.
*DM WRITE MCTRL.
*DM WRITE MCORPIND.
*DM WRITE MDLCL-JCT
*DM APPEND VIA MCORPIND
*DM WITHIN MCORPIND-DLCL.
*DM WRITE MITEM
The CA-Datamacs/II Tasks
66 CA-IDMS Interface
*DM APPEND MPRODUCT-MCTRL VIA MCORPIND
*DM WITHIN MCTRL-CORPIND
*DM VIA MDLCL-JCT WITHIN MCORPIND-DLCL.
*DM GO TO ITEM.
*
*DM MY-OWN-ERROR.
*DM USER-ERROR 'UHNO'.
*
DATA DIVISION.
*DB RONSS04 WITHIN RONSCHEMA.
COPY IDMS RECORDS.
PROCEDURE DIVISION.
The COPY statement extracts all of RONSS04 subschema from the IDD. No *DM END-COPY is coded.
All procedural statements are permitted in a user's own error routine. If USER-ERROR is coded, CA-Datamacs/II will issue the message and terminate the run.
LOAD
There are two LOAD functions; the automatic and the manual. To CA-Datamacs/II the distinction is the mandatory inclusion of a START paragraph in the manual LOAD; to the user the distinction is one of convenience. The two are contrasted in the following table.
Automatic LOAD Manual LOAD
Required Input An UNLOADed sequential file or a data set that appears to have been UNLOADed
An UNLOADed sequential file or a data set that appears to have been UNLOADed
Output limited by input or -
GENerate GENerate or PERFORM
//IDMSWRK file required?
Yes if VIA records are to be loaded and
their number exceeds 2000.
Yes if VIA records are to be loaded and their number exceeds 2000.
Subschema record descriptions required?
Yes Yes
Must LOAD subschema = UNLOAD subschema?
No No
May input records be deleted?
No Yes
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 67
May field modifiers be used?
Yes Yes
Are epilogs processed?
Yes Yes
Do output records have epilog & prolog?
No No
May alter record length or set name?
No No
May include procedural statements?
No Yes
START line is mandatory.
Input to either the manual or automatic LOAD must be a sequential data set with each record moved 12 bytes to the right. The first 4 bytes must contain the appropriate record ID. Either an UNLOAD or DCL (CA-Datamacs/II Command Language) is capable of producing this 12-byte offset or prolog. The prolog content depends upon the source:
Source=UNLOAD Source=DCL
Columns 01 - 04 Record ID from Subschema Record ID from Subschema
Columns 05 - 08 Hex position of epilog start 0
Columns 09 - 12 HEX database key 0
A sample run, using DCL CONVERT to add this prolog to records in a sequential file, is included at the end of this section.
Because it may not include CA-Datamacs/II procedural statements, the automatic LOAD minimizes programmer involvement and expedites program execution. However there are instances when manual LOAD must be used. These include:
■ When all occurrences of a specific record are to be omitted
■ ® When output is to be limited by the inclusion of only a limited quantity of certain records, rather than being limited by total record input or total count of output
■ When alteration of set participation or membership type is permitted by the output subschema and the requisite changes are neither implied by the UNLOAD sequence nor available in the epilog.
The CA-Datamacs/II Tasks
68 CA-IDMS Interface
Both the automatic and manual LOAD permit the application of CA-Datamacs/II field modifiers, both process an epilog and both insure that an output record is returned to its subschema-specified length.
When an input record is read, addressability is established (the record occurrence is associated with its description) using the record ID in the prolog's first four bytes. CA-Datamacs/II then checks to see if this is a manual LOAD (a START label is included) and if true, it looks for a paragraph name corresponding to this record name and executes any procedural statements in that paragraph. Paragraphs are PERFORMed with an iteration factor of 1 TIME.
If the manual LOAD includes a paragraph whose name matches that of the input record, CA-Datamacs/II assumes that statements within the paragraph will provide all the necessary processing for that record. If you fail to code a STORE, the record never makes it to the test database. On the other hand, coding a paragraph name and omitting other commands can be used to intentionally delete all records with that name. If there is no paragraph for the input record, automatic processing is invoked. (A manual LOAD with just a START paragraph is really an automatic LOAD). CA-Datamacs/II looks first for an epilog. If the epilog start address field is zero, the record was prepared by a CA-Datamacs/II Control Language (DCL) run and there is no epilog. If the byte at the specified address is X'FF', UNLOAD wrote the record and is indicating that there is no currency or set participation information to convey. If, however, there is an epilog, the specified owner is made current before the record is stored and the CONNECT or DISCONNECT directives are forwarded after IDMS has completed the input function.
The storage process returns the record to its subschema-described size. CA-Datamacs/II begins the STORE at the column beyond the prolog (13) and IDMS eliminates the epilog by terminating the store when the described length is reached.
Again, using DEMOSS03, consider the following manual LOAD. It assumes that the testbed subschema specifies all sets as optional/manual and that the input data set contains more record occurrences than would ever be required for a single test.
In this example, CUSTOMER, ORDER, ITEM and OREMARK records reside on the input data set. Contrary to traditional DEMOSS03, the CUSTOMER-ORDER and ORDER-ITEM sets are assumed to be manual sets. The OBTAIN CALC in the ITEM paragraph ensures that the appropriate product is current before the automatic connection of the PRODUCT-ITEM set is done. We do not wish to actually store any OREMARKS.
FILE-CONTROL.
*DM GENERATE ALL.
*DM PRINT ALL FOR TERMINAL.
*DM IDMS LOAD.
*
*DM START.
*
*DM ORDOR.
*DM STORE ORDOR.
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 69
*DM CONNECT ORDOR TO CUSTOMER-ORDER.
*
*DM ITEM.
*DM OBTAIN CALC PRODUCT
*DM USING KEYLOC 1 KEYLEN 8
*DM NOT-FOUND GO TO FINISH.
*DM STORE ITEM.
*DM CONNECT ITEM TO ORDER-ITEM.
*
*DM OREMARK.
*
*DM DATA DIVISION.
Automatic LOAD
An automatic LOAD assumes that the input file has been written by a CA-Datamacs/II UNLOAD run or that the input data set appears to have been built by UNLOAD.
Remember that the START paragraph must not be coded. A START label tells CA-Datamacs/II that this is a manual run. Procedural statements may not be coded.
Field modifiers may be used to delete or mask sensitive data.
FILE-CONTROL.
*
*DM GENERATE ALL
*DM PRINT ALL FOR TERMINAL.
*DM IDMS LOAD.
*
DATA DIVISION.
*DB TESTSS01 WITHIN TESTSCHM.
WORKING-STORAGE SECTION.
*
COPY IDMS RECORDS SUPPRESS.
*
PROCEDURE DIVISION.
Note: The same IDMS statement is used for both manual and automatic LOADs.
In this example, record description printing is suppressed. This run contains no field modifiers.
The CA-Datamacs/II Tasks
70 CA-IDMS Interface
Manual LOAD
Here is another example of a manual LOAD. Recall that in a manual LOAD, you may include CA-Datamacs/II procedural statements and/or field modifiers.
As CA-Datamacs/II reads the input file (DMIFILE) data set, it checks to see if you have coded a paragraph name which corresponds to that of the record just read.
If the paragraph name has been omitted, field modifiers are applied and the record is stored. If the paragraph name is found, CA -Datamacs/IICA-Datamacs/II performs the statements in the paragraph. If a STORE statement is not included, the record is bypassed. If a STORE statement is included, field modifiers are applied.
A START paragraph is mandatory if any paragraphs or commands are coded.
In the following example, the DEMOSS03 records CUSTOMER, ORDOR and ITEM are being loaded into the database from a file built by a CA-Datamacs/II UNLOAD run. Before ITEM is written, the appropriate PRODUCT record must be made current.
FILE-CONTROL.
*
*DM GENERATE ALL
*DM PRINT ALL FOR TERMINAL.
*DM IDMS LOAD.
*
*DM START.
*
*DM ITEM.
*DM OBTAIN CALC PRODUCT
*DM USING KEYLOC 13 KEYLEN 8
*DM NOT-FOUND GO TO NOT-FND-ERROR.
*DM STORE ITEM.
*
*DM NOT-FND-ERROR.
*DM USER-ERROR 'UNFD'.
*
DATA DIVISION.
*DB DEMOSS03 WITHIN DEMOSCHM.
WORKING-STORAGE SECTION.
COPY CUSTOMER.
:
:
PROCEDURE DIVISION.
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 71
LOAD From Flat-File (DCL CONVERT)
To LOAD from a flat-file, we will complete the following steps:
1. Build a flat-file.
2. CONVERT for LOAD input.
3. LOAD.
CA-Datamacs/II can populate an IDMS database with records from a flat-file. Two steps are necessary:
1. CONVERT the flat-file to include the prolog that LOAD anticipates.
2. LOAD the file.
This example also includes a step to build the original flat-file.
The code to build the sequential flat-file is as follows:
*DM GENERATE 10 PRINT 10 FOR TERMINAL.
SELECT SEQ-FILE ASSIGN TO UT-S-CDPRIM.
DATA DIVISION.
*
FD SEQ-FILE
RECORD CONTAINS 48 CHARACTERS
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD.
*
01 PRODUCT.
03 PROD-NUM PIC 9(8).
*DM SEQUENCE 11 BY 1.
03 DESCRIPTION PIC X(20).
*DM CONSTANT 'CLOTHESPIN'
*DM 'WIDGET'
*DM 'CANE'
*DM 'SCARF'
*DM 'TIERACK' REPEAT.
03 FILLER PIC X(5).
03 COLOR PIC X(4).
*DM CONSTANT 'BLUE' 'YLLW' 'RED' 'GRN' REPEAT.
03 FILLER PIC X(11).
PROCEDURE DIVISION.
*
The CA-Datamacs/II Tasks
72 CA-IDMS Interface
The next step (step 2) prepares the flat-file for a CA-Datamacs/II LOAD by adding the prolog which LOAD anticipates. The prolog contains 12 bytes: Columns 1 - 4 must be the record ID; the remaining 8 columns must be blank.
*
*DM GENERATE ALL PRINT ALL FOR TERMINAL.
*DM DCL CONVERT.
*DM START.
*DM READ SEQ-FILE OFFSET 12
*DM AT-END GO TO FINISH
*DM WHEN COLOR NOT = 'GRN'
*DM USE PRODUCT.
*DM WRITE IDMS-FILE.
*DM GO TO START.
*
SELECT SEQ-FILE ASSIGN TO UT-S-CORPRIM.
*
*DM GENERATE ALL PRINT ALL FOR TERMINAL.
*
SELECT IDMS-FILE ASSIGN TO UT-S-CDSEC.
DATA DIVISION. FD SEQ-FILE LABEL RECORDS ARE STANDARD RECORDING MODE IS F BLOCK CONTAINS 0 RECORDS. * 01 PRODUCT. 03 RECORD-ID-NO PIC 9(4). *DM CONSTANT 0631. 03 OFFSET-OTHER-8 PIC X(8) 03 PROD-NUM PIC 9(8). 03 DESCRIPTION PIC X(20). 03 FILLER PIC X(5). 03 COLOR PIC X(4). 03 FILLER PIC X(11). * FD IDMS-FILE LABEL RECORDS ARE STANDARD RECORDING MODE V BLOCK CONTAINS 0 RECORDS. * 01 DUMMY-FLD OCCURS 60 TIMES PIC X. PROCEDURE DIVISION
Step 3 LOADs the flat-file to the database as described by the subschema DEMOSS03. This is an automatic load.
*
*DM GENERATE ALL PRINT ALL FOR TERMINAL.
*DM IDMS LOAD.
*DM READY PRODUCT-REGION USAGE MODE IS
*DM EXCLUSIVE UPDATE.
*
DATA DIVISION.
*DB DEMOSS03 WITHIN DEMOSCHM.
*
COPY PRODUCT.
*
M A P 01 PRODUCT. 06310010
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 73
VERS #* VERSION=0001 06310020
1 03 IDMS-ID-0631 PIC 9(4). 06310030
5 03 IDMS-RN-0631 PIC 9(7) COMP-3. 06310040
9 03 IDMS-DBKEY-0631 PIC 9(4). 06310050
00013 01 PROD-NUMBER PIC X(8). 06310060
00021 03 PROD-DESC PIC X(20). 06310070
00041 03 PROD-SPECS. 06310080
00041 05 PROD-UNIT-CODE PIC X. 06310090
00042 05 PROD-WEIGHT PIC 9(5)V99 COMP-3 06310100
00046 05 PROD-COLOR-CODE PIC X(4). 06310110
00050 03 PROD-COST PIC S9(5)V99 COMP-3. 06310120
00054 03 PROD-PRICE PIC S9(5)V99 COMP-3. 06310130
00058 03 FILLER PIC XXX. 06310140
PROCEDURE DIVISION.
MODIFY
The CA-Datamacs/II MODIFY function can be used to:
■ alter IDMS database records in place
■ erase records
■ CONNECT or DISCONNECT optional set members
Use the MODIFY task when an existing testbed needs tuning. MODIFY can alter records by applying CA-Datamacs/II field modifiers and can revise data structures with ERASE (this is the IDMS ERASE, not record deletion), CONNECT and DISCONNECT statements. Moreover, the MODIFY run's output listing provides both a before and after picture of each modified record.
In the procedural segment of a MODIFY run (the code which follows File Control and precedes Data Division) you identify by name the records that are to be ERASEd, CONNECTed or DISCONNECTed. A START paragraph is mandatory; other paragraphs are not. If used, paragraph names need not correspond with record names.
Addressability (associating a record description with the function to be executed) is accomplished by the requirement that each command specify a record name. If record content is to be altered, the MODIFY run must include a MODIFY statement. The MODIFY command may only be used in a MODIFY run. When executed, CA-Datamacs/II field modifiers are applied to the associated record and the occurrence is returned to the database.
A PERMIT statement is required if there is a system password and the MODIFY run will ERASE, alter or DISCONNECT a record.
The CA-Datamacs/II Tasks
74 CA-IDMS Interface
You may include field modifiers as in-stream data or you may use IDD-filed, field modifier scripts. Either approach is acceptable. Any record may be altered or ERASEd, but CONNECT and DISCONNECT commands cannot contravene a subschema's automatic and mandatory set qualifiers.
In the example below, all customers in Syracuse are assigned a new credit rating of 'BBB'.
*DM PRINT ALL FOR TERMINAL.
*DM IDMS MODIFY.
*
*DM START.
*DM SCAN FOR CUSTOMER
*DM AT-END GO TO FINISH
*DM WHEN CUST-CITY = 'SYRACUSE'
*DM USE CUSTOMER.
*DM MODIFY CUSTOMER.
*DM GO TO START.
*
DATA DIVISION.
*DB DEMOSS03 WITHIN DEMOSCHM.
WORKING-STORAGE SECTION.
*
COPY CUSTOMER.
*DM CONSTANT 'BBB'. 06110155
*DM END-COPY.
PROCEDURE DIVISION.
The statement was assigned a sequence number so that it falls behind the CUST-CREDIT field description.
In the second example, the file will be modified as follows:
■ The cost of a blue tie rack will be changed to $8.50.
■ The price of a blue tie will be changed to $12.99.
■ All red products will be assigned a unit code 'R'.
■ Customer Baker Inc. will receive delivery by 12/31/86. The customer order number is 2321800102.
■ Product number EEE33322 will no longer be sold.
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 75
The record to be altered or erased must be current for the run unit before MODIFY is issued.
The MODIFY statement causes field modifiers to be applied.
The COPY statement extracts record descriptions from the specified subschema in the IDD.
FILE-CONTROL.
*
*DM PRINT ALL FOR TERMINAL.
*DM IDMS MODIFY.
*
*DM START.
*DM SCAN FOR PRODUCT
*DM AT-END GO TO PARA2.
*DM MODIFY PRODUCT.
*DM GO TO START.
*
*DM PARA2.
*DM OBTAIN CALC CUSTOMER
*DM USING KEY IS '2321800102'
*DM NOT-FOUND GO TO FINISH.
*
*DM PARA3.
*DM OBTAIN NEXT ORDOR
*DM WITHIN CUSTOMER-ORDER
*DM AT-END GO TO PARA4.
*DM MODIFY ORDOR.
*DM GO TO PARA3.
*
*DM PARA4.
*DM OBTAIN CALC PRODUCT
*DM USING KEY IS 'EEE33322'
*DM NOT-FOUND GO TO FINISH.
*DM ERASE PRODUCT ALL.
*DM GO TO FINISH.
*
DATA DIVISION.
*DB DEMOSS03 WITHIN DEMOSCHM.
WORKING STORAGE SECTION.
The CA-Datamacs/II Tasks
76 CA-IDMS Interface
*
COPY CUSTOMER.
:
:
*
COPY ORDOR.
*
M A P 01 ORDOR. 06200010
VERS #* VERSION=0001 06200020
1 03 IDMS-ID-0620 PIC 9(4). 06200030
5 03 IDMS-RN-0620 PIC 9(7) COMP-3. 06200040
9 03 IDMS-DBKEY-0620 PIC 9(4). 06200050
0013 03 ORD-NUMBER PIC X(7). 06200060
0020 03 ORD-CUST-PO-NUMB PIC X(10). 06200070
0030 03 ORD-DATES. 06200080
0038 05 ORD-REQ-DATE PIC X(6). 06200090
*DM CONSTANT '123186'. 06200095
:
:
COPY PRODUCT.
*
M A P 01 PRODUCT. 06310010
VERS #* VERSION=0001 06310020
1 03 IDMS-ID-0631 PIC 9(4). 06310030
5 03 IDMS-RN-0631 PIC 9(7) COMP-3. 06310040
9 03 IDMS-DBKEY-0631 PIC 9(4). 06310050
00013 01 PROD-NUMBER PIC X(8). 06310060
00021 03 PROD-DESC PIC X(20). 06310070
00041 03 PROD-SPECS. 06310080
00041 05 PROD-UNIT-CODE PIC X. 06310090
*DM IF PROD-COLOR-CODE = 'RED' 06310094
*DM CONSTANT 'R'. 06310096
00042 05 PROD-WEIGHT PIC 9(5)V99 COMP-3. 06310100
00046 05 PROD-COLOR-CODE PIC X(4). 06310110
00050 03 PROD-COST PIC S9(5)V99 COMP-3. 06310120
*DM IF PROD-DESC = 'TIERACK' 06310124
*DM AND PROD-COLOR-CODE = 'BLUE' 06310126
*DM CONSTANT 8.50. 06310128
00054 03 PROD-PRICE PIC S9(5)V99 COMP-3. 06310130
*DM IF PROD-DESC = 'TIERACK' 06310133
*DM AND PROD-COLOR-CODE = 'BLUE' 06310135
*DM CONSTANT 12.99. 06310137
:
:
PROCEDURE DIVISION.
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 77
COPY And NON-DATABASE COPY
COPY and NDBR-COPY are CA-Datamacs/II utilities that are used to generate flat-files built from record descriptions found in the Integrated Data Dictionary. COPY is used when the record descriptions are schema-owned; NDBR-COPY when they are non-schema owned.
Both COPY utilities permit application of CA-Datamacs/II field modifiers to the records being built and written to the sequential data set, but neither task provides the prolog required for input to a LOAD. The output records retain the field organization and length specified in the record description, although the content is totally directed by the application of field modifiers.
COPY
This example copies the CUSTOMER and ORDOR records from the IDD and writes them as flat-files. CUSTOMERs are written to the customer file and ORDORS are written to the order file.
Two sets of GENERATE, PRINT and DEFAULT statements are coded; one for the customer file, the other for order file.
COPY does not require procedural statements, CA-Datamacs/II applies the field modifiers and writes the output data sets.
The COPY statement extracts record descriptions from the specified subschema in the IDD.
FILE-CONTROL.
*DM GENERATE 10
*DM PRINT ALL FOR TERMINAL
*DM DEFAULT IS RANDOM.
*DM IDMS COPY.
SELECT CUSTOMER-FILE ASSIGN TO UT-S-CUSTTEST.
*
*DM GENERATE 10
*DM PRINT ALL FOR TERMINAL
*DM DEFAULT IS STANDARD.
SELECT ORDER-FILE ASSIGN TO UT-S-ORDTEST.
The CA-Datamacs/II Tasks
78 CA-IDMS Interface
*
DATA DIVISION.
FILE SECTION.
*DB DEMOSS03 WITHIN DEMOSCHM.
FD CUSTOMER-FILE
RECORDING MODE IS F
LABEL RECORDS ARE STANDARD.
*
COPY CUSTOMER.
*
*
M A P 01 CUSTOMER. 06110010
VERS #. VERSION=0001 06110020
0001 03 CUST-NUMBER PIC X(10). 06110030
*DM SEQUENCE '0000010000' BY '0000000100'.06110035
0011 03 CUST-NAME PIC X(20). 06110040
*DM SEQUENCE 'AARON AABEL' 06110045
*DM BY '10000010000'. 06110047
0031 03 CUST-ADDRESS. 06110050
0031 05 CUST-ADDR1 PIC X(20). 06110060
0051 05 CUST-ADDR2. 06110070
0051 06 CUST-CITY PIC X(15). 06110080
*DM CONSTANT 'ROCHESTER, NY' 06110081
*DM 'NUTLEY, NJ' 06110083
*DM 'MALVERN, PA' 06110085
*DM REPEAT. 06110087
:
:
FD ORDER-FILE
RECORDING MODE IS F
LABEL RECORDS ARE STANDARD.
*
COPY ORDOR.
*
M A P 01 ORDOR. 06200010
VERS #* VERSION=0001 06200020
0001 03 ORD-NUMBER PIC X(7). 06200030
*DM SEQUENCE '0000011' BY '0000011'. 06200035
0008 03 ORD-CUST-PO-NUMB PIC X(10). 06200040
0018 03 ORD-DATES. 06200050
The CA-Datamacs/II Tasks
Chapter 3: Retrieving Record Descriptions (COPY) 79
0018 05 ORD-REQ-DATE PIC X(6). 06200060
*DM DATE BETWEEN 01/01/80 AND 12/31/99. 06200065
:
:
PROCEDURE DIVISION.
Note: Because this SEQUENCE is an alpha constant, increments will be in alpha order. In every CUSTOMER after the first, a 1 is added to the A in AARON and to the A in AABEL. The CUSTOMER record, following the one in which IARON IABEL occurs, will have JARON JABEL.
NDBR-COPY
The following is an example of a non-database COPY. NDBR-COPY reads IDD records which are not defined in any subschema and writes a flat-file.
Field modifiers may be applied to the records being copied.
The flat-file will be written to a file named EMPLOYEE-FILE.
The subschema identifier *DB is not used.
FILE-CONTROL.
*
*DM GENERATE 100
*DM PRINT ALL FOR TERMINAL
*DM DEFAULT IS STANDARD.
*DM IDMS NDBR-COPY.
*
SELECT EMPLOYEE-FILE ASSIGN TO UT-S-EMPTEST.
DATA DIVISION.
FILE SECTION.
FD EMPLOYEE-FILE
RECORDING MODE IS F
LABEL RECORDS ARE STANDARD.
The CA-Datamacs/II Tasks
80 CA-IDMS Interface
*
COPY EMPLOYEE.
*DM SEQUENCE '000001' BY '00002'. 01100055
*DM RANDOM CLUSTER BETWEEN 10000 01100073
*DM AND 30000. 01100075
*DM CONSTANT 'ENGINEER' 'ADMINISTRATIVE' 01100083
*DM 'MGMT SVCS' 01100085
*DM REPEAT. 01100087
*DM END-COPY.
*
PROCEDURE DIVISION.
The output file will be limited to 100 records, no matter how many employee records are in the database.
Chapter 4: CA-Datamacs/II Reports 81
Chapter 4: CA-Datamacs/II Reports
Overview
At the conclusion of a CA-Datamacs/II run, the system will print the job stream and run statistics. CA-Datamacs/II then adds a listing of the run stream from the first COBOL delimiter to the Procedure Division statement (record descriptions might be SUPPRESSed) and up to four reports. The number and content of these reports are run-dependent and are tabulated below.
CREATE UNLOAD LOAD MODIFY COPY
Record descriptions with prolog X X X
Record descriptions without prolog
X X
Records before & after alteration X
Records with prolog & epilog X
Records with prolog only X X
Records without prolog or epilog X X
Subschema Activity Report X X X X
Records obtained and unloaded X
Records stored X X X
Data base statistics X X X X X