Previous Topic: @INVOKENext Topic: #MRB


@COPY IDMS

The @COPY IDMS statement copies source data description code and modules from the dictionary into the program at the location of the @COPY IDMS statement. This statement copies CA IDMS/DB database record descriptions, the IDMS communications block, map record descriptions, or MRBs. However, any source module or record description stored in the dictionary can be copied into either a CSECT or DSECT, as specified by the DSECT parameter (discussed below).

Source code requirements differ according to the usage (DML, LR, or MIXED) defined in the program's subschema. The program should not copy components that conflict with its usage. These usages determine the types of records a program can access, as follows:

The DML precompiler determines whether source record descriptions are copied into a CSECT or DSECT portion of the program, and applies the following rules:

Note: The DML defines record elements using the Assembler EQU instruction if the record element is:

Note: If the optional keyword DSECT is coded in the @COPY IDMS statement, the record being copied is established as an individual DSECT named with the record name.

Syntax

►►─── @COPY IDMS ─────────────────────────────────────────────────────────────►

 ►─┬─ ,SUBSCHEMA-DML-LR DESCRIPTION ───────────────────────┬──────────────────►
   ├─ ,SUBSCHEMA-DESCRIPTION ──────────────────────────────┤
   ├─ ,SUBSCHEMA-CTRL ─────────────────────────────────────┤
   ├─ ,SUBSCHEMA-RECORDS ──────────────────────────────────┤
   ├─ ,RECORD=record-name ─┬──────────────────────────┬────┤
   │                       └─ VERSION=version-number ─┘    │
   ├─ ,SUBSCHEMA-LR-DESCRIPTION ───────────────────────────┤
   ├─ ,SUBSCHEMA-LR-CTRL ─┬────────────────────────┬───────┤
   │                      └─ ,SIZE=lrc-block-size ─┘       │
   ├─ ,SUBSCHEMA-LR-CONTROL ───────────────────────────────┤
   ├─ ,SUBSCHEMA-LR-RECORDS ───────────────────────────────┤
   ├─ ,LR=logical-record-name ─────────────────────────────┤
   ├─ ,MAPS ───────────────────────────────────────────────┤
   ├─ ,MAP=map-name ───────────────────────────────────────┤
   ├─ ,MAP-CONTROLS ───────────────────────────────────────┤
   ├─ ,MAP-CONTROL=map-name ───────────────────────────────┤
   ├─ ,MAP-RECORDS ────────────────────────────────────────┤
   ├─ ,MODULE=module-name ─┬──────────────────────────┬────┤
   │                       └─ VERSION=version-number ─┘    │
   ├─ ,SUBSCHEMA-BINDS ────────────────────────────────────┤
   └─ ,MAP-BINDS ──────────────────────────────────────────┘

 ►─┬──────────┬───────────────────────────────────────────────────────────────►◄
   └─ ,DSECT ─┘

Parameters

SUBSCHEMA-DML-LR-DESCRIPTION

(Subschema usage is mixed); copies all components required to access both database and logical records: SUBSCHEMA-CTRL, SUBSCHEMA-RECORDS, SUBSCHEMA-LR-CTRL, and SUBSCHEMA-LR-RECORDS.

SUBSCHEMA-DESCRIPTION

(Subschema usage is DML); copies the source data description code for the IDMS communications block (SUBSCHEMA-CTRL) and for all records (SUBSCHEMA-RECORDS) defined in the subschema specified in the @INVOKE statement.

SUBSCHEMA-CTRL

Copies the IDMS communications block into the program.

SUBSCHEMA-RECORDS

Copies the source data description code for all records defined in the subschema into the program. You can copy Assembler synonyms defined for the subschema records in the data dictionary into the program according to the rules of synonym usage.

RECORD=

Copies the description of an individual record defined in the dictionary.

record-name

Can be the primary name or a synonym for a record or module stored in the dictionary.

A record that has been copied into a schema can only be copied into a program that uses a subschema associated with the schema. In other words, schema-owned records cannot be copied into non-IDMS programs (that is, programs that do not use a subschema and that do not access the database). However, a synonym defined for the schema-owned record can be copied into a non-IDMS program (use the VERSION clause to identify the synonym).

VERSION=version-number

Optional; can be used to qualify IDD records (but not schema-owned records) with a version number. If no version number is specified, CA IDMS/DB first assumes that record-name identifies a record that is included in the subschema named in the @INVOKE statement, and looks for it in that subschema. If the record is not associated with a subschema, version defaults to the highest version number of the record defined in the dictionary for the operating mode under which the program is being compiled.

SUBSCHEMA-LR-DESCRIPTION

Copies all components required to access logical records: SUBSCHEMA-CTRL, SUBSCHEMA-LR-CTRL, and SUBSCHEMA-LR-RECORDS.

SUBSCHEMA-LR-CTRL

Copies the LRC block data description.

SIZE=lrc-block-size

Optional; specifies the size of that portion of the LRC block that contains information about the logical-record request's WHERE clause. Lrc-block-size defaults to 576 bytes. If included, it should specify a size large enough to accommodate the most complex WHERE clause in the program. Lrc-block-size is calculated as follows:

  1. Multiply the greatest number of operands and operators that will be included in a single WHERE clause by 16 bytes.
  2. Add the number of bytes, rounded up to the nearest multiple of 8, associated with the data field for each operand; that is:
    • The number of characters in a keyword
    • The number of characters in a field described by a program variable or by a logical-record field named in the OF LR clause.
  3. Add the length, rounded up to the nearest multiple of 8, of each operand that is a character literal.
  4. Add 12 bytes for each operand that is a numeric literal.
  5. Add 64 bytes for fixed logical-record request control (LRC) overhead.

Lrc-block-size must be a positive integer in the range 64 through 9999. Note that 64 can be specified if none of the logical-record requests issued by the program include WHERE clauses.

The following example illustrates the use of the DSECT parameter to create individual dummy control sections for the IDMS communications block and for a map request block:

         @MODE MODE=IDMSDC
         @INVOKE SUBSCHEMA=XYZ,SCHEMA=ABC,
               PROGRAM=TESTXYZ,MAP=DEFMAP

*  THE FOLLOWING @COPY IDMS STATEMENT COPIES THE SOURCE DATA
*  DESCRIPTION CODE FOR THE IDMS COMMUNICATION BLOCK (SUBSCHEMA-CTRL):

         @COPY IDMS,SUBSCHEMA-CTRL,DSECT

*  THE DML PRECOMPILER GENERATES THE DSECT INSTRUCTION FOR THE DUMMY
*  CONTROL SECTION TO CONTAIN THE SOURCE DATA DESCRIPTION CODE OF THE
*  IDMS COMMUNICATIONS BLOCK:

         DSECT
SSCTRL   DS
         .
         .
         .

*  THE FOLLOWING @COPY IDMS STATEMENT COPIES THE SOURCE DATA
*  DESCRIPTION CODE FOR THE REQUIRED MAP REQUEST BLOCK (MAP-CONTROLS):

          @COPY IDMS,MAP-CONTROL=DEFMAP,DSECT

*  THE DML PRECOMPILER GENERATES THE DSECT INSTRUCTION FOR THE DUMMY
*  CONTROL SECTION TO CONTAIN THE SOURCE DATA DESCRIPTION CODE FOR
*  THE MRB:

         DSECT
         DS
         .
         .
         .

*  THE END OF EACH DSECT MUST BE DESIGNATED EITHER BY AN ASSEMBLER
*  END, CSECT, OR ANOTHER DSECT INSTRUCTION.

A single DSECT is created for the IDMS communications block, CA IDMS/DB record descriptions, MRB, and map record description.


         @MODE MODE=IDMSDC
         @INVOKE SUBSCHEMA=XYZ,SCHEMA=ABC,                             *
               PROGRAM=TESTXYZ,MAP=DEFMAP

*  THE FOLLOWING ASSEMBLER DSECT INSTRUCTION IS CODED BY THE
*  PROGRAMMER TO DEFINE THE BEGINNING OF A DUMMY CONTROL SECTION:

IDMSSTG  DSECT

*  COPY STATEMENTS WITHIN A DSECT ENABLE RECORD DESCRIPTIONS TO BE
*  COPIED INTO THE DUMMY CONTROL SECTION.  NOTE THAT THE DSECT
*  PARAMETER IS NOT INCLUDED IN THE @COPY IDMS STATEMENTS:

         @COPY IDMS,SUBSCHEMA-DESCRIPTION
SSCTRL   DS
         .
         .
         .
         DS
         .
         .
         @COPY IDMS,MAPS
         DS
         .
         .
         .
         DS
         .
         .
         .

*  THE END OF THE DSECT MUST BE DESIGNATED BY AN ASSEMBLER END,
*  CSECT, OR ANOTHER DSECT INSTRUCTION.