Previous Topic: Copying Table Descriptions from Datadictionary

Next Topic: Generated Fields

COPY Statement Formats

There are two forms of the COPY statement, a FORMAT I and a FORMAT II. Format I does not support assigning a different default key other than the master key. Nor does it support the assigning of an old table name to be used during a load. In fact, none of the options available to Format II can be used with Format I except the SUPPRESS option.

The FORMAT II COPY TABLE statement will retrieve the record description for the table occurrence name specified on the statement, which is related to the database name and status/version coded on the *DM DATACOM statement. Thus, one COPY TABLE statement would be coded for each table being processed.

The elements which are to be included in the record description can be specified by entering a DATAVIEW name and status/version, or the 1-to-32 character element occurrence names can be entered individually. Two other options can automatically select the appropriate elements if either of the following conditions are met and MAX-RECORD-SIZE has the actual table width in it;

  1. At least one element has all the fields related to it.
  2. The total length of all the elements defined equals the table width.

If both conditions are met, condition one will be used.

CA-Datamacs/II uses the Datadictionary Service Facility (DSF) OUTBOOK function to build the record description, specifying a COBOL syntax format. CA-Datamacs/II does some optimization of the COBOL copybook prior to passing it to the phase I record copybook processor for performance reasons. Also, each field has a sequence number attached to it. The purpose of the sequence number is to allow merging of the 'field generators' with the proper field.

The sequence number is constructed by placing the table's DATACOM-ID in the leftmost 3 positions, followed by a starting 5-digit sequence number of 00060. The sequence number will be incremented by the value coded in the INCREMENT-SEQ on the *DM COPY TABLE statement (defaults to 10).

When CA-Datamacs/II is used in batch mode and 'field generators' are desired, the user should first perform a syntax run, coding a COPY TABLE statement without the SUPPRESS option for each table needed. The resulting listing will show the fields and sequence numbers calculated. In this manner, the next higher sequence number of the COBOL field can be coded on the field generator in columns 73 to 80. This causes it to be merged following the correct field as the record description is retrieved from Datadictionary.

When a CA-Datamacs/II job is submitted to batch from the ISPF front-end, the sequence number assignments are done automatically by the program and are transparent to the user.

The record description is constructed by first using the table name as the 01 level record name, with a sequence number of nnn00010. A comment is then generated showing the version of the table, using sequence number nnn00020. If the CA-Datamacs/II function is UNLOAD, LOAD, or MODIFY, 3 fields are generated to define the prolog, which is attached to each user data record. They use sequence numbers nnn00030, nnn00040, and nnn00050. The first user field will then use sequence number nnn00060, regardless of the function. The first COBOL field level number always starts at 04.