Previous Topic: Defining Input Record FieldsNext Topic: Data Area


Communications Area

The Communications Area is the first 300 bytes of storage following the INPUT command. It is made up of DEFINE statements which provide the space where the CA Datacom/DB commands, key names, key values, and element list are passed to CA Datacom/DB. Each DEFINE statement defines one field in the area.

The three DEFINE statements coded to make up the Communications Area in the sample program are shown following:

 DEFINE PERSONEL-COMMAND       001-005 X
 DEFINE PERSONEL-KEY           006-010 X
 DEFINE PERSONEL-ELMLIST       191-201 X

Organization of the Communications Area can be summarized as follows:

CA Datacom/DB Command
Key Name
Key Value
Element List
Filler

TOTAL

5
5
180
101
9

300

characters
characters
characters
characters
characters

characters

The order in which the above fields of the Communications Area are coded is always the same. Although the first 300 positions of the table are always reserved for the Communications Area, not all of the positions must be used.

For example, notice in the three DEFINE statements coded to make up the Communications Area in the sample program that the CA Datacom/DB command (PERSONEL-COMMAND) and the key name (PERSONEL-KEY) occupy the first five and second five positions, respectively, of the Communications Area. However, no key value was specified, so none of the 180 positions (11—190) reserved for the key value are allocated.

Positions 191—291 (101 characters) are reserved for the CA Datacom/DB Element list, but only 11 positions have been allocated in this case. Although the last nine positions (292—300) of the Communications Area are used as filler, do not specify these positions in the coding.

Allocating space within the first 300 positions is further explained in the following discussion.

Code the general DEFINE command in the Communications Area as follows:

►►─ DEFINE ─ fieldname ─ start-end ─ X ───────────────────────────────────────►◄

In the first DEFINE statement in the Communications Area, PERSONEL-COMMAND is the user-supplied name of the field where the CA Datacom/DB command will be moved using the MOVE command (explained later).

 DEFINE PERSONEL-COMMAND      001-005 X
 DEFINE PERSONEL-KEY          006-010 X
 DEFINE PERSONEL-ELMLIST      191-201 X

The start-end parameter indicates, in characters, the relative starting and ending position of the field within the record of the input table. Since the organization of the Communications Area requires that the CA Datacom/DB command occupy the first five positions of that area, start-end is replaced with 1—5.

The X parameter indicates that the field named PERSONEL-COMMAND contains alphanumeric data. See DEFINE Command for the complete DEFINE command format and for other parameters that could have been entered here.

The first DEFINE statement tells the Reporting Facility:

In the second DEFINE statement, PERSONEL-KEY is the user-supplied name of the field where the CA Datacom/DB key name will be moved using the MOVE command.

 DEFINE PERSONEL-COMMAND      001-005 X
 DEFINE PERSONEL-KEY          006-010 X
 DEFINE PERSONEL-ELMLIST      191-201 X

Since the organization of the Communications Area requires that the CA Datacom/DB key name occupy the second five positions of that area, start-end is replaced with 6—10.

X indicates that the field named PERSONEL-KEY contains alphanumeric data. Positions 11—190 (180 characters) of the Communications Area are used for specifying the key values, although no key value was specified in the sample program. Use the key value to tell CA Datacom/DB where to start accessing data.

For example, one of the key values associated with the key name EMPNO is the employee number 23100. To start accessing data associated with employee number 23100, assign space for the key value starting at position 11 in the Communications Area. Then use the MOVE command to move 23100 to the allocated space.

No key value field is defined in the sample program because the CA Datacom/DB command GETIT in the first MOVE statement indicates that the records will be retrieved sequentially, starting at the beginning of the table. However, the 180 characters reserved for the key value cannot be allocated for any other purposes, even if no key value is specified.

In the third DEFINE statement, PERSONEL-ELMLIST is the user-supplied name of the field where the CA Datacom/DB element list will be moved.

 DEFINE PERSONEL-COMMAND      001-005 X
 DEFINE PERSONEL-KEY          006-010 X
 DEFINE PERSONEL-ELMLIST      191-201 X

Positions 191—285 (95 characters) of the Communications Area are used for the element list. Each record in the database has from 1 to 255 elements associated with it. Up to 15 elements can be read at one time with this Communications Area.

Not all of the positions (191—285) must be used. The size of the field to contain the element is determined by the command used and the number of desired elements to be retrieved. These elements should not overlap.

Each element name requires five bytes (ADEMP in this example; shorter element names are padded with blanks) followed by a one-byte security code (blank in this example). CA Datacom/DB detects the end of the list when it finds five blanks instead of another element name. Since this example uses only one element and a blank security code, the element list field only needs to be five characters long.

Note: LOCXX commands do not retrieve data and do not use the element list.

In the sample program, there is only one element, ADEMP, designated in the third MOVE statement. This statement allows CA Datacom/DB to access the data associated with the element ADEMP, and to bring the correct data for the report into the Reporting Facility program.

X indicates that the field PERSONEL-ELMLIST contains alphanumeric data.