Calling a COBOL platform function in a method
For the COBOL sample add the following method in your application:
invokeCOBOLATM
"This method calls the COBOL ATM function in the ATM DLL.
The method assumes the record wrapper has already been
created and that the constants in the ATM sample
structure have been placed in a pool dictionary"
| atmStruct platformFunction |
atmStruct := SampleCOBOLATMStruct new.
atmStruct pinNumber: '12345'.
platformFunction := PlatformFunction
callingConvention: 'abtc16'
function: 'ATM'
library: 'ATM'
parameterTypes: #(char pointer)
returnType: #none.
platformFunction
coroutineCallWithArray:
(Array with: AtmQuery with: atmStruct)
threadKey: nil.
Transcript show: (atmStruct firstName); cr;
show: (atmStruct lastName); cr;
show: (atmStruct checkingBalance); cr.
Type the following in the System Transcript window and run it:
MyExtFunc new invokeCOBOLATM
You should see the following in your System Transcript window:
John
Smith
7890.03
Last modified date: 01/29/2015