The following simple example shows the sequence of calls in distributed dialogs via LU6.1. In each case there are indications as to which fields can or have to be set or evaluated. The field names are specified using COBOL notation.
In this example the job-submitting program consists of two program units: in the first unit, the subjob is submitted to the job-receiving service; in the second unit, the response of the job-receiving service is read and the response is output to the terminal, if necessary.
As explained in section "Error handling by the program unit" a job-submitting program unit which follows after a synchronization point is started not only in a normal run, but also after rolling back a distributed transaction with service restart. This is why a check is made in the first unit of the job-submitting program whether status information is available. Such a service restart only occurs, however, if the job-submitting service has set a synchronization point prior to the start of this program unit (with or without participation of a job-receiving service).
INIT Evaluate: KCKNZVG --> R service restart, status information might be available. MGET Input message from terminal. If the job-submitting service has already reached a synchronization point, status information may be present as well. Evaluate: KCRPI --> Return information from the job receiver blanks there is no status information present >svid there is status information from the job-receiving service with the specified service ID. In this case the status information is to be read with a 2nd MGET. 2. MGET Read the status information after which error handling is necessary. Set: KCOM <-- with NT KCLA <-- with the length 0 KCRN <-- with the service ID (>svid) KCMF <-- with blanks Evaluate: KCVGST --> service status: I job-receiving service inactive E job-receiving service terminated with PEND ER/FR Z job-receiving service terminated by openUTM with PEND ER R job-receiving service terminated with PEND RS T time has expired (timer) KCTAST --> transaction status: I transaction in job-receiving service inactive R transaction in job-receiving service rolled back M mismatch If there is no status information present: APRO Address the job-receiving service (if not already done) Set: KCOM <-- with DM for dialog service KCRN <-- with the LTAC of the job-receiving service KCPA <-- with double-step addressing: with the name of the partner application KCPI <-- with a self-selected service ID (>svid) KCLM , 0 MPUT to job-receiving service Set: KCOM <-- NT or NE KCRN <-- with the service ID (>svid) KCMF <-- possible format ID for job-receiver KCDF <-- binary 0 KCLM <-- length PEND (end of first unit) Set: KCOM <-- PEND call variant: KP normally recommended in the job-submitting service RE end of transaction is requested FI not allowed because job-receiver still open ER/FR also aborts job-receiving service PA prohibited after MPUT to job-receiving service PR prohibited after MPUT to job-receiving service SP prohibited after MPUT to job-receiving service FC prohibited after MPUT to job-receiving service KCRN <-- name of follow-up program unit of job submitter (second unit of the job-submitting program)
INIT Evaluate: KCBENID --> name of the session KCLOGTER --> name of the partner application KCTERMN --> ID of the partner application KCCP --> ID of the protocol used, '1' is entered for LU6.1 KCRMF --> format ID from first MPUT of the job submitter MGET Read message from job-submitting service Evaluate: KCRCCC --> KDCS error code 19Z through 39Z cannot occur KCRLM --> length from MPUT of the job submitter (KCLM) KCRST Byte1 --> service status of job-submitting service: O job-submitting service is open KCRST Byte2 --> transaction status of job-submitting service O transaction is open (PEND KP for job submitter) P end of transaction initiated (PEND RE) C transaction with job submitter terminated KCRMF if more message segments still present: format ID of the next segment, otherwise: format ID of segment read. MPUT unchanged Set: KCOM <-- with NT or NE KCMF <-- format ID or blanks KCLM <-- length of the message KCRN <-- with blanks to send the message to the job submitter KCDF <-- any value which the job submitter receives with MGET PEND End of job-receiving program unit Set: KCOM <-- depending on the transaction status: KP only allowed with KCTAST=O or C RE terminates the transaction with KCTAST=P or initiates end of transaction with KCTAST=O or C FI end of the job-receiving service, otherwise as PEND RE ER/FR end of the job-receiving service, transaction is rolled back, job submitter is informed PA/PR no special points, cannot be used to send a message to the job submitter KCRN <-- if necessary (with PEND KP or PEND RE), name of the follow-up program unit of job-receiving service
INIT Evaluate: KCRPI <-- service ID of the job-receiving service KCRMF <-- format ID from 1st MPUT of the job receiver MGET Read message from the job receiver Set: KCOM <-- NT KCLA <-- length of the message area KCRN <-- service ID from KCRPI of the INIT call KCMF <-- format ID from KCRMF of the INIT call Evaluate: KCRLM --> actual length of the input message KCRMF --> if more message segments present: format ID of next segment, otherwise: format ID of segment read. KCRDF --> value from the relevant MPUT of the job-receiving service. KCRPI --> service ID if further message segments present KCRST Byte1 --> service status of job-receiving service: O job-receiving service is open C job-receiving service is terminated (PEND FI) KCRST Byte2 --> transaction status of job-receiving service: O transaction is open (PEND KP) P job receiver has requested end of transaction (with PEND RE or FI, PTC status) C transaction is terminated (PEND RE or FI) MPUT to the terminal Set: KCRN <-- with blanks KCOM <-- with NT or NE KCLM <-- with the length of the message KCMF <-- with the format ID or blanks KCDF <-- if necessary, with a screen function PEND end of the follow-up program unit of the job-receiving service Set: KCOM <-- depending on status indicators in KCRST FI only allowed with KCVGST=C, terminates service and transaction RE terminates the transaction with KCTAST=P, not allowed with KCTAST=O (because message directed to terminal) ER/FR rolls back transaction, job-receiving service is also rolled back and terminated; only exception: KCTAST=C and KCVGST=C. KP not recommended if KCTAST=P PA/PR prohibited since message was sent to terminal. KCRN <-- if necessary (with PEND KP or PEND RE), name of the follow-up program unit of the job-submitting service