Data Division in the Communication Module [ Micro Focus COBOL Language Reference - Additional Topics ] MPE/iX 5.0 Documentation
Micro Focus COBOL Language Reference - Additional Topics
Data Division in the Communication Module
Communication Section
In a COBOL program the Communication Descriptionentries (CD) represent
the highest level of organization in the Communication Section. The
COMMUNICATION SECTION header is followed by a CD entry consisting of a
level indicator, a data-name and a series of independent clauses. These
clauses indicate the queues and subqueues, the message date and time, the
source, the text length, the status and end keys, and message count of
input. They also specify the destination count, the text length, the
status and error keys, and destinations for output.
For ANS85 only: For an input-output CD entry the clauses specify the
message date, message time, symbolic terminal, text length, and key and
status key.
The entry itself is terminated by a period. These record areas can be
implicitly redefined by user-specified record description entries
following the various CD clauses.
The Communication Description - Complete Entry Skeleton
Function.
The CD specifies the interface area between the MCS and a COBOL program.
General Formats.
Format 1.
Format 2.
For ANS85 only: Format 3.
Syntax Rules.
All Formats.
1. A CD must appear only in the Communication Section.
Formats 1 and (3 - ANS85).
2. Within a single program, the INITIAL clausecan be specified in only
one CD. The INITIAL clause must not be used in a program that
specifies the USING phrase of the PROCEDURE DIVISION Header. (See
the section The PROCEDURE DIVISION Header in the chapter Program
Definition in your Language Reference.)
3. Except for the INITIAL clause, the optional clauses can be written
in any order.
4. If neither option in the format is specified, a level 01 data
description entry must follow the CD entry. Either option can be
followed by a level 01 data description entry.
5. Record description entries following an input CD implicitly redefine
this record and must describe a record of exactly 87 standard data
format characters. Multiple redefinitions of this record are
permitted; however, only the first redefinition can contain VALUE
clauses. However, the MCS will always reference the record
according to the data descriptions defined in General Rule 4.
6. Data-name-1, data-name-2,..., data-name-11 must be unique within the
CD. Within this series, any data-name can be replaced by the
reserved word FILLER.
Format 2.
7. For ANS85 only: The optional clauses can be written in any order.
8. If none of the optional clauses of the CD is specified, a level 01
data description entry must follow the CD entry.
9. Record descriptions following an output CD implicitly redefine this
record. Multiple redefinitions of this record are permitted;
however, only the first redefinition can contain VALUE clauses. The
MCS will always reference the record according to the data
descriptions defined in General Rule 18.
10. Data-name-1, data-name-2,..., data-name-5 must be unique in a CD.
11. If the DESTINATION TABLE OCCURS clauseis not specified, one ERROR
KEY and one SYMBOLIC DESTINATION areais assumed. In this case,
neither subscripting nor indexing is permitted when referencing
these data items.
12. If the DESTINATION TABLE OCCURS clause is specified, data-name-4 and
data-name-5 can only be referred to by subscripting or indexing.
13. The value of the data item referenced by data-name-1 and integer-2
is not restricted.
For ANS85 only: Format 3.
14. Record descriptions following an input-output CD implicitly redefine
this record and must describe a record of exactly 33 standard data
characters. Multiple redefinitions of this record are permitted;
however, only the first redefinition may contain VALUE clauses. The
MCS will always reference the record according to the data
descriptions defined in General Rule 26.
General Rules.
All Formats.
1. Table 2-1 indicates the possible contents of the data items
referenced by data-name-10 for Format 1, data-name-3 for Format 2
and by data-name-6 for Format 3 (ANS85) at the completion of each
statement shown. An "X" on a line in a statement column indicates
that the associated code shown for that line is possible for that
statement.
Table 2-1: Communication Status Key Condition
Table 2-1: Communication Status Key Condition (continued)
Format 1.
2. The input CD information constitutes the communication between the
MCS and the program as information about the message being handled.
This information does not come from the terminal as part of the
message.
3. For each input CD, a record area of 87 contiguous standard data
format characters is allocated. This record area is defined to the
MCS as follows:
* The SYMBOLIC QUEUE clausedefines data-name-1 as the name of
an elementary alphanumeric data item of 12 characters
occupying positions 1-12 in the record.
* The SYMBOLIC SUB-QUEUE-1 clausedefines data-name-2 as the
name of an elementary alphanumeric data item of 12 characters
occupying positions 13-24 in the record.
* The SYMBOLIC SUB-QUEUE-2 clausedefines data-name-3 as the
name of an elementary alphanumeric data item of 12 characters
occupying positions 25-36 in the record.
* The SYMBOLIC SUB-QUEUE-3 clausedefines data-name-4 as the
name of an elementary alphanumeric data item of 12 characters
occupying positions 37-48 in the record.
* The MESSAGE DATE clausedefines data-name-5 as the name of a
data item whose implicit description is that of an integer of
6 digits without an operational sign occupying character
positions 49-54 in the record.
* The MESSAGE TIME clausedefines data-name-6 as the name of a
data item whose implicit description is that of an integer of
8 digits without an operational sign occupying character
positions 55-62 in the record.
* The SYMBOLIC SOURCE clausedefines data-name-7 as the name of
an elementary alphanumeric data item of 12 characters
occupying positions 63-74 in the record.
* The TEXT LENGTH clausedefines data-name-8 as the name of an
elementary data item whose implicit description is that of an
integer of 4 digits without an operational sign occupying
character positions 75-78 in the record.
* The END KEY clausedefines data-name-9 as the name of an
elementary alphanumeric data item of 1 character occupying
position 79 in the record.
* The STATUS KEY clausedefines data-name-10 as the name of an
elementary alphanumeric data item of 2 characters occupying
positions 80-81 in the record.
* The MESSAGE COUNT clausedefines data-name-11 as the name of
an elementary data item whose implicit description is that of
an integer of 6 digits without an operational sign occupying
character positions 82-87 in the record.
The second option can be used to replace the above clauses by a
series of data-names which, taken in order, correspond to the
data-names defined by these clauses.
Use of either option results in a record whose implicit description
is equivalent to the following:
Implicit Description term nogloss| Phrase|
01 data-name-0.
02 data-name-1 PIC X(12). SYMBOLIC QUEUE
02 data-name-2 PIC X(12). SYMBOLIC SUB-QUEUE-1
02 data-name-3 PIC X(12). SYMBOLIC SUB-QUEUE-2
02 data-name-4 PIC X(12). SYMBOLIC SUB-QUEUE-3
02 data-name-5 PIC 9(06). MESSAGE DATE
02 data-name-6 PIC 9(08). MESSAGE TIME
02 data-name-7 PIC X(12). SYMBOLIC SOURCE
02 data-name-8 PIC 9(04). TEXT LENGTH
02 data-name-9 PIC X. END KEY
02 data-name-10 PIC XX. STATUS KEY
02 data-name-11 PIC 9(06). MESSAGE COUNT
In the above, the information under "Phrase" is for clarification and is
not part of the description.
4. The contents of the data items referenced by data-name-2,
data-name-3, and data-name-4, when not being used must contain
spaces.
5. The data items referenced by data-name-1, data-name-2, data-name-3,
and data-name-4 contain symbolic-names designating queues,
sub-queues, ..., respectively. All symbolic-names must follow the
rules for the formation of system-names, and must have been
previously defined to the MCS.
6. A RECEIVE statement causes the serial return of the "next" message
or a portion of a message from the queue as specified by the entries
in the CD.
If during the execution of a RECEIVE statement, a message from a
more specific source is needed, the contents of the data item
referenced by data-name-1 can be made more specific by the use of
the contents of the data items referenced by data-name-2,
data-name-3, and in turn data-name-4. When a given level of the
queue structure is specified, all higher levels must also be
specified.
If not all levels of the queue hierarchy are specified, the MCS
determines the "next" message or portion of a message to be
accessed.
After the execution of a RECEIVE statement, the contents of the data
items referenced by data-name-1 through data-name-4 will contain the
symbolic-names of all the levels of the queue structure.
7. Whenever a program is scheduled by the MCS to process a message,
that program establishes a run unit and the symbolic-names of the
queue structure that demanded this activity will be placed in the
data items referenced by data-name-1 through data-name-4 of the CD
associated with the INITIAL clause as applicable. In all other
cases, the contents of the data items referenced by data-name-1
through data-name-4 of the CD associated with the INITIAL clause are
initialized to spaces.
The symbolic-names are inserted or the initialization to spaces is
completed prior to the execution of the first Procedure Division
statement.
The execution of a subsequent RECEIVE statement naming the same
contents of the data items referenced by data-name-1 through
data-name-4 will return the actual message that caused the program
to be scheduled. Only at that time will the remainder of the CD be
updated.
8. If the MCS attempts to schedule a program lacking an INITIAL clause,
the results are undefined.
9. Data-name-5 has the format "YYMMDD" (year, month, day). Its
contents represent the date on which the MCS recognizes that the
message is complete.
The contents of the data item referenced by data-name-5 are only
updated by the MCS as part of the execution of a RECEIVE statement.
10. The contents of data-name-6 have the format "HHMMSSTT" (hours,
minutes, seconds, hundredths of a second) and its contents represent
the time at which the MCS recognizes that the message is complete.
The contents of the data item referenced by data-name-6 are only
updated by the MCS as part of the execution of the RECEIVE
statement.
11. During the execution of a RECEIVE statement, the MCS provides, in
the data item referenced by data-name-7, the symbolic-name of the
communications terminal that is the source of the message being
transferred. This symbolic move must follow the rules for the
formation of system names. However, if the symbolic-name of the
communication terminal is not known to the MCS, the contents of the
data item referenced by data-name-7 will contain spaces.
12. The MCS indicates via the contents of the data item referenced by
data-name-8 the number of character positions filled as a result of
the execution of the RECEIVE statement. (See The RECEIVE Statement
later in this chapter.)
13. The contents of the data item referenced by data-name-9 are set only
by the MCS as part of the execution of a RECEIVE statement according
to the following rules:
* When the RECEIVE MESSAGE phraseis specified, then data-name-9
is set to one of the following:
* If an end of group has been detected, the contents of
the data item referenced by data-name-9 are set to 3;
* If an end of message has been detected, the contents
of the data item referenced by data-name-9 are set to
2;
* If less than a message has been detected, the contents
of the data item referenced by data-name-9 are set to
0.
* When the RECEIVE SEGMENT phraseis specified, data-name-9 is
set to one of the following:
* If an end of group has been detected, the contents of
the data item referenced by data-name-9 are set to 3.
* If an end of message has been detected, the contents
of the data item referenced by data-name-9 are set to
2.
* If an end of segment has been detected, the contents
of the data item referenced by data-name-9 are set to
1.
* If less than a message segment is transferred, the
contents of the data item referenced by data-name-9
are set to 0.
* When more than one of the above conditions is satisfied
simultaneously, the rule first satisfied in the order listed
determines the contents of the data item referenced by
data-name-9.
14. The contents of the data item referenced by data-name-10 indicate
the status condition of the previously executed RECEIVE, ACCEPT
MESSAGE COUNT, ENABLE INPUT, or DISABLE INPUT statements.
The actual association between the contents of the data item
referenced by data-name-10 and the status conditionitself is defined
in Table 2-1.
15. The contents of the data item referenced by data-name-11 indicate
the number of messages that exist in a queue, sub-queue-1,....The
MCS updates the contents of the data item referenced by data-name-11
only as part of the execution of an ACCEPT statement with the COUNT
phrase.
Format 2.
16. The nature of the output CD information is such that it is not sent
to the terminal, but constitutes the communication between the
program and the MCS as information about the message being handled.
17. For each output CD, a record area of contiguous standard data format
characters is allocated according to the following formula: (10
plus 13 times integer-2).
* The DESTINATION COUNT clausedefines data-name-1 as the name
of a data item whose implicit description is that of an
integer without an operational sign occupying character
positions 1-4 in the record.
* The TEXT LENGTH clausedefines data-name-2 as the name of an
elementary data item whose implicit description is that of an
integer of 4 digits without an operational sign occupying
character positions 5-8 in the record.
* The STATUS KEY clausedefines data-name-3 to be an elementary
alphanumeric data item of 2 characters occupying positions
9-10 in the record.
* Character positions 11-23 and every set of 13 characters
thereafter will form table items of the following
description:
* The ERROR KEY clausedefines data-name-4 as the name of
an elementary alphanumeric data item of 1 character.
* The SYMBOLIC DESTINATION clausedefines data-name-5 as
the name of an elementary alphanumeric data item of 12
characters.
Use of the above clauses results in a record whose implicit description
is equivalent to the following (the information under "Phrase" is for
clarification and is not part of the description):
Implicit Description Phrase
01 data-name-0.
02 data-name-1 PIC 9(04). DESTINATION COUNT
02 data-name-2 PIC 9(04). TEXT LENGTH
02 data-name-3 PIC XX. STATUS KEY
02 data-name OCCURS integer-2 TIMES. DESTINATION TABLE
03 data-name-4 PIC X. ERROR KEY
03 data-name-5 PIC X(12) SYMBOLIC DESTINATION
18. During the execution of a SEND, ENABLE OUTPUT, or DISABLE OUTPUT
statement, the contents of the data item referenced by data-name-1
will indicate to the MCS the number of symbolic destinations that
are to be used from the area referenced by data-name-5.
The MCS finds the first symbolic destination in the first occurrence
of the area referenced by data-name-5, the second symbolic
destination in the second occurrence of the area referenced by
data-name-5... , up to and including the occurrence of the area
referenced by data-name-5 indicated by the contents of data-name-1.
If during the execution of a SEND, ENABLE OUTPUT, or DISABLE OUTPUT
statement the value of the data item referenced by data-name-1 is
outside the range of 1 through integer-2, an error condition is
indicated and the execution of the SEND, ENABLE OUTPUT, or DISABLE
OUTPUT statement is terminated.
19. It is the responsibility of the user to insure that the value of the
data item referenced by data-name-1 is valid at the time of
execution of the SEND, ENABLE OUTPUT, or DISABLE OUTPUT statement.
20. As part of the execution of a SEND statement, the MCS will interpret
the contents of the data item referenced by data-name-2 to be the
user's indication of the number of leftmost character positions of
the data item referenced by the associated SEND identifier from
which data is to be transferred. (See The SEND Statement later in
this chapter.)
21. Each occurrence of the data item referenced by data-name-5 contains
a symbolic destination previously known to the MCS. These symbolic
destination-names must follow the rules for the formation of
system-names.
22. The contents of the data item referenced by data-name-3 indicate the
status condition of the previously executed SEND, ENABLE OUTPUT or
DISABLE OUTPUT statement.
The actual association between the contents of the data item
referenced by data-name-3 and the status condition itself is defined
in Table 2-1.
23. If, during the execution of a SEND, an ENABLE OUTPUT, or a DISABLE
OUTPUT statement, the MCS determines that any specified destination
is unknown, the contents of the data item referenced by data-name-3
and all occurrences of the data items referenced by data-name-4 are
updated.
The contents of the data item referenced by data-name-4 when equal
to 1 indicate that the associated value in the area referenced by
data-name-5 has not been previously defined to the MCS. Otherwise,
the contents of the data item referenced by data-name-4 are set to
zero.
Format 2.
24. Table 2-2 indicates the possible content of the data item referenced
by data-name-4 at the completion of each statement shown. An "X" on
a line in a statement column indicates that the associated error key
value shown for that line is possible for that statement.
Table 2-2 : Error Key Values
For ANS85 only: Format 3.
25. The input-output CD information constitutes the communication
between the MCS and the program about the message being handled.
This information does not come from the terminal as part of the
message.
26. For each input-output CD, a recoard area of 33 contiguous character
positions is allocated. This record area is defined to the MCS as
follows:
* The MESSAGE DATE clause defines data-name-1 as the name of a
data item whose implicit description is that of an integer of
6 digits, without an operational sign, occupying positions
1-6 in the record.
* The MESSAGE TIME clause defines data-name-2 as the name of a
data item whose implicit description is that of an integer of
8 digits, without an operational sign, occupying positions
7-14 in the record.
* The SYMBOLIC TERMINAL clause defines data-name-3 as the name
of an elementary alphanumeric data item of 12 characters
occupying positions 15-26 in the record.
* The TEXT LENGTH clause defines data-name-4 as the name of an
elementary data item whose implicit description is that of an
integer of 4 digits, without an operational sign, occupying
positions 27-30 in the record.
* The END KEY clause defines data-name-5 as the name of an
elementary alphanumeric data item of 1 character occupying
position 31 in the record.
* The STATUS KEY clause defines data-name-6 as the name of an
elementary alphanumeric data item of 2 character occupying
positions 32 and 33 in the record.
The second option may be used to replace the above clauses by a
series of data-names which, taken in order, correspond to the
data-names defined by these clauses.
Use of either option results in a record whose implicit description
is equivalent to the following (the information under "COMMENT" is
for clarification and is not part of the data description):
Implicit Description Comment
01 data-name-0
02 data-name-1 PIC9(6). MESSAGE DATE
02 data-name-2 PIC9(8). MESSAGE TIME
02 data-name-3 PICX(12). SYMBOLIC TERMINAL
02 data-name-4 PIC9(4). TEXT LENGTH
02 data-name-5 PICX. END KEY
02 data-name-6 PICXX STATUS KEY
27. When a program is scheduled by the MCS to process a message, the
first RECEIVE statement referencing the input-output CD with the
INITIAL clause returns the actual message that caused the program to
be scheduled.
28. Data-name-1 has the format "YYMMDD" (year, month, day). Its content
represents the date on which the MCS recognizes that the message is
complete.
The content of the data item referenced by the data-name-1 is
updated only by the MCS as part of the execution of a RECEIVE
statement.
29. Data-name-2 has the formal "HHMMSSTT" (hours, minutes, seconds,
hundredths of a second) and its content represents the time at which
the MCS recognizes that the message is complete.
The content of the data item referenced by data-name-2 is updated
only by the MCS as part of the execution of the RECEIVE statement.
30. Whenever a program is scheduled by the MCS to process a message,
that program establishes a run unit, and the symbolic name of the
communication terminal that is the source of the message that
invoked this program, is placed in the data item referenced by
data-name-3 of the input-output CD associated with the INITIAL
clause as applicable. This symbolic name must follow the rules for
the formation of system-names.
In all other cases, the content of the data item referenced by
data-name-3 of the input-output CD associated with the INITIAL
clause is initialized to spaces.
The symbolic name is inserted, or the initialization to spaces is
completed, prior to the execution of the first Procedure Division
statement.
31. If the MCS attempts to schedule a program lacking an INITIAL clause,
the results are undefined.
32. When the INITIAL clause is specified for an input-output CD and the
program is scheduled by the MCS, the content of the data item
referenced by data-name-3 must not be changed by the program. If
this content is changed, the execution of any statement referencing
cd-name-1 is unsuccessful, and the data item referenced by
data-name-6 is set to indicate unknown source or destination, as
applicable. (See General Rule 1.)
33. For an input-output CD without the INITIAL clause, or for an
input-output CD with the INITIAL clause when the program is not
scheduled by the MCS, the program must specify the symbolic name of
the source or destination in data-name-3 prior to the execution fo
the first statement referencing cd-name-1.
After executing the first statement referencing cd-name-1, the
content of the data item referenced by data-name-3 must not be
changed by the program. If this content is changed, the execution
of any statement referencing cd-name-1 is unsuccessful, and the data
item referenced by data-name-6 is set to indicate unknown source or
destination, as applicable. (See General Rule 1.)
34. The MCS indicates, through the content of the data item referenced
by data-name-4, the number of character positions filled as a result
of the execution of the RECEIVE statement. See the section The
RECEIVE Statement later in this chapter.)
As part of the execution of a SEND statement, the MCS interprets the
content of the data item referenced by data-name-4 as an indication
of the number of leftmost character positions of the data item
referenced by the associated SEND identifier from which data is
transferred. See the section The SEND Statement later in this
chapter.
35. The content of the data item referenced by data-name-5 is set only
by the MCS as part of the execution of a RECEIVE statement according
to the following rules:
* When the RECEIVE MESSAGE phrase is specified:
* If an end of group has been detected, the content of
the data item referenced by data-name-5 is set to 3.
* If an end of message has been detected, the content of
the data item referenced by data-name-5 is set to 2.
* If less than a message is transferred, the content of
the data item referenced by data-name-5 is set to 0.
* When the RECEIVE SEGMENT phrase is specified:
* If an end of group has been detected, the content of
the data item referenced by data-name-5 is set to 3.
* If an end of message has been detected, the content of
the data item referenced by data-name-5 is set to 2.
* If an end of segment has been detected, the content of
the data item referenced by data-name-5 is set to 1.
* If less than a message segment is transferred, the
content of the data item referenced by data-name-5 is
set to 0.
* When more than one of the conditions is satisfied
simultaneously, the rule first satisfied in the order listed
determines the content of the data item referenced by
data-name-5.
36. The content of the data item referenced by data-name-6 indicates the
status condition of the previously executed DISABLE, ENABLE, PURGE,
RECEIVE, or SEND statement.
The actual association between the content of the data item
referenced by data-name-6 and the status condition itself is defined
in General Rule 1.
MPE/iX 5.0 Documentation