OpenTP1 Version 7 Programming Reference COBOL Language

[Contents][Index][Back][Next]

Coding in data manipulation language

When a UAP is created in COBOL language, OpenTP1 message exchange facilities can be created in Data Manipulation Language (DML). CALL statements and DML can coexist when one service is coded.

DML can be used only with the TP1/Server Base. It cannot be used with the TP1/LiNK.

The DML consists of a communication description entry for defining a work area and a communication statement used as an instruction.

Table 3-1 lists message exchange facilities provided in DML.

Table 3-1 DML provided by OpenTP1

Communication statement Facility Corresponding CALL interface
Data communication facility RECEIVE#1 Receive a message. CBLDCMCF('RECEIVE ')
Receive a synchronous message. CBLDCMCF('RECVSYNC')
SEND#1 Send a message. CBLDCMCF('SEND ')
Send a response message. CBLDCMCF('REPLY ')
Send a synchronous message. CBLDCMCF('SENDSYNC')
Exchange a synchronous message. CBLDCMCF('SENDRECV')
ENABLE#2 Send a synchronous message. CBLDCMCF('SENDSYNC')
DISABLE#2 Send a synchronous message. CBLDCMCF('SENDSYNC')
Service facility DISABLE Terminate continuous-inquiry- response processing. CBLDCMCF('CONTEND ')
RECEIVE Accept temporary-stored data. CBLDCMCF('TEMPGET ')
ROLLBACK Enable MHP rollback. CBLDCMCF('ROLLBACK')
SEND Activate an application program. CBLDCMCF('EXECAP ')
SEND Update temporary-stored data. CBLDCMCF('TEMPPUT ')
SEND Execute an operation command. CBLDCADM('COMMAND ')
SEND Acquire a user journal. CBLDCJNL('UJPUT ')

Note
There is no DML interface for the message resend
(CBLDCMCF('RESEND ' ) ).

#1: For details on the syntax, see the applicable OpenTP1 Protocol manual.

#2: Can be used only when TP1/NET/OSI-TP is used. See the OpenTP1 Protocol TP1/NET/OSI-TP manual for details on the syntax.
The UAP trace information of a UAP created in DML is equivalent to the information of the facility library which is called by a UAP created with a CALL interface of the COBOL or C language.

General syntax rules

The DML of a UAP operating under OpenTP1 consists of a communication section, communication statements, and a part coded in the original COBOL syntax. This section explains the coding rules of the communication section and communication statements, and the syntax rules that must apply to coding of the original COBOL language. Items not explained in this section must comply with the syntax rules of the COBOL language. For details about the general syntax rules of the COBOL language, see an appropriate COBOL language guide.

Coding symbols

The following table explains the symbols used in the coding format shown in this section:

Coding symbol Explanation
[ ] Indicates that items enclosed in brackets [ ] are optional. Example: [BEFORE ERASING]
{ } Indicates that items enclosed in braces { } represent alternative items. Only one of the items can be specified.
____ Indicates that a underlined reserved word is mandatory and cannot be omitted. A reserved word without double underlines is optional. (It is not always necessary to write the word.)

Unique names and data names

The unique names and data names in this manual have the same meanings as those used with COBOL85.

Example
A subscript and indicator are added to unique names, but not to data names. However, a subscript and indicator are not added to unique names in communication statements.

Formats

Communication section coding rules

The communication section is written in the data division. The figure below shows the data division including the communication section. Each section of the data division must be written in the format shown below.

DATA DIVISION.
 [ FILE SECTION.
        :     ]
 [ WORKING-STORAGE SECTION.
        :     ]
 [ LINKAGE SECTION.
        :     ]
 [ COMMUNICATION SECTION.
  communication-description-entry
        :     ]
 [ REPORT SECTION.
        :     ]

Write the communication section beginning from the section header (a reserved word list called COMMUNICATION SECTION which is ended with a period and space). Write at least one communication description entry (CD) following the header.

Communication description entry (CD) coding rules

A communication description entry defines the type of communication and the interface areas of UAP and OpenTP1. The following figure shows the general communication description entry format:

CD communication-description-name
FOR {INPUT|OUTPUT|I-O} [STORAGE|JOURNAL|PROGRAM|COMMAND]
    [ STATUS KEY IS data-name-1]
    [ SYMBOLIC TERMINAL IS data-name-2]
    [ MESSAGE DATE IS data-name-3]
    [ MESSAGE TIME IS data-name-4]
    [ MAP NAME IS data-name-5]
    [ SYNCHRONOUS MODE IS {SYNC|ASYNC|data-name-6}]
    [ SWITCHING MODE IS {NORMAL|PRIOR|data-name-7}]
    [ NEXT TRANSACTION IS data-name-8]
    [ ACTIVE INTERVAL IS data-name-9]
    [ DETAIL MODE IS data-name-10]
    [ WAITING TIME IS data-name-11]

Communication statement coding rules

A communication statement is used in the procedure division. The following figure shows the general communication statement format:

RECEIVE communication-description-name {[FIRST]SEGMENT|MESSAGE}
         [INTO  unique-name-1] [ BEFORE ERASING ].
SEND communication-description-name [FROM unique-name-1]
      WITH {ESI|EMI|unique-name-2}]
        [ BEFORE RECEIVING MESSAGE INTO unique-name-3].
DISABLE communication-description-name [ WITH unique-name-1].
ROLLBACK [WITH STOPPING]

Communication description entry coding rules

Communication description entries used in a communication statement can be shared with multiple communication statements. The communication description entries include data names whose values are set in the UAP and data names whose values are returned from OpenTP1. The contents of data names other than data names whose values are returned from OpenTP1 are identical before and after the communication statement is issued. Therefore, there is no need to respecify a data name in the following case:

The same communication description entry is used in multiple lines, and the same contents as for the previously issued communication statement are used.

Table 3-2 shows clauses for specifying data names in a communication description entry, and their edit formats.

Table 3-2 Clauses for specifying data names in communication description entry and their edit formats

Clause for specifying data name Data area format Specification source of data area value#
1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
STATUS KEY data-name-1 PIC X(5). B B B B B B B B B B
SYMBOLIC TERMINAL data-name-2 PIC X(8). B -- U U U U U U -- --
MESSAGE DATE data-name-3 PIC 9(6). B -- -- -- -- -- -- -- -- --
MESSAGE TIME data-name-4 PIC 9(8). B -- -- -- -- -- -- -- -- --
MAP NAME data-name-5 PIC X(8). b -- U U -- -- -- -- -- --
SYNCHRONOUS MODE data-name-6 PIC X(1). -- -- u u -- -- -- -- -- --
SWITCHING MODE data-name-7 PIC X(1). -- -- u u -- -- -- -- -- --
NEXT TRANSACTION data-name-8 PIC X(8). -- -- u -- -- -- -- -- -- --
ACTIVE INTERVAL data-name-9 PIC X(8). -- -- -- -- -- -- u -- -- --
DETAIL MODE data-name-10 PIC X(1). -- -- u u -- -- -- -- -- --
WAITING TIME data-name-11 PIC 1(32) BIT. -- -- u u -- -- -- -- -- --

Legend:
1.: RECEIVE - Receive a message (the first segment)
2.: RECEIVE - Receive a message (An intermediate segment or the last segment)
3.: SEND - Send a message (the first segment)
4.: SEND - Send a message (An intermediate segment or the last segment)
5.: DISABLE - Terminate continuous-inquiry-response processing
6.: RECEIVE - Accept temporary-stored data
7.: SEND - Activate an application program
8.: SEND - Update temporary-stored data
9.: SEND - Execute an operation command
10.: SEND - Acquire a user journal
B: The value is returned from OpenTP1.
b: The value is returned from OpenTP1 under the specified conditions.
U: The value is specified in the UAP.
u: The value is specified in the UAP under the specified conditions.
--: Not applicable.

#: The ROLLBACK statement does not use a communication description entry.