Dialog protocols
Each kind of dialog defines its own application program interface. The Communications/Transactions feature implementations for APPC, MQI, and TCP/IP dialogs each include four different kinds of dialogs as follows:
• simple dialogs
• multi-receive dialogs
• multi-send dialogs
• proc dialogs
Because RPC and CICS OS/2 ECI interface does not permit complex dialogs, only simple and proc dialogs are implemented.
The dialog examples in the following sections use records as input or output. To learn more about how VA Smalltalk uses records and types from external functions, refer to the Programmer Reference
Simple dialogs
Simple dialogs take one data record from the initiator of the dialog, send it to the remote program, and return the result from the remote program to the initiator of the dialog. The following code segment illustrates the methods used to send a record:
resultRecord := aDialog initiate: aSendRecord
Multi-receive dialogs
Multi-receive dialogs take one data record from the initiator of the dialog, send it to the remote program, and return multiple records from the remote program to the object that initiated the dialog. This is accomplished by using one of the following two protocols.
The first protocol declares an owner for the dialog as in the following example:
aDialog owner: self.
result := aDialog initiate: aSendRecord.
Then the dialog passes each received record from the remote program to the owner object by sending the message receiveRecord: with the received record as a parameter. Note that this requires the receiveRecord: method to be present in the class of the owner object or in one of its superclasses. The receiveRecord: method manipulates the information in the received record.
The second, more complex protocol allows the received records to be passed to a block instead of being sent in a message to the owner, as illustrated in the following example:
aDialog when: #receiveRecord: evaluate:
[:rcvRecord | Transcript show: rcvRecord printString].
result := aDialog initiate: aRecord.
Multi-send dialogs
Multi-send dialogs take multiple data records from the initiator of the dialog, send the records to the remote program, and returns one or more records from the remote program to the object that initiated the dialog. As with the multi-receive dialogs, this is achieved by using one of the following two protocols. You can use both protocols at the same time, for example using a block to send records and an owner to receive records.
The first protocol declares an owner for the dialog, illustrated in the following example:
aDialog owner: self.
result := aDialog initiate.
Then the dialog requests each record to be sent to the remote program by sending the sendRecord: message to the owner and passing a blank record as a parameter to be filled in by the sendRecord: method. The dialog passes each received record from the remote program to the owner object by sending the message receiveRecord: with the received record as a parameter. Note that these methods must be present in the class of the owner object or in one of its superclasses.
The second protocol uses blocks to send and receive records, as illustrated in the following examples:
To send records
aDialog when: #sendRecord:
evaluate: [:blankRec | CODE].
Where:
blankRec
Is a blank record
CODE
Is a fragment of Smalltalk code that fills the blank record with data
You must follow the code fragment with the following line of code.
aDialog initiate.
To receive records
aDialog
when: #receiveRecord:
evaluate: [:recRecord | CODE].
Where:
recRecord
Is the record
CODE
Is a fragment of Smalltalk code that retrieves and manipulates the information in the recRecord
You must follow the code fragment with the following line of code.
aDialog initiate.
Proc dialogs
If your application needs to invoke program logic residing on a remote machine, you can use a proc dialog to do this.
A proc dialog communicates with the server program logic through a record, a formatted chunk of data that is both passed to and received from the server. When your VA Smalltalk / VAST Platform application runs the proc dialog, it passes to it a single record, which can contain both input and output fields. When the function completes, the output fields are filled in with the function's result values.
Last modified date: 10/06/2020