To make DL/I calls from a Smalltalk application, you must create an instance of the class that contains the DL/I calls you want to make. Each class contains class methods that your program can use to create an instance. In IMS, you must specify one of the following in the syntax of the DL/I call to get access:
A database program communication block (DB PCB) defines which segments of a database an application program is permitted to access. A PSB contains all of the PCBs an application program can access.
There are two ways to access the DB PCB:
The input/output PCB (IO PCB) is the PCB assigned by IMS and defines the terminal from which a message is sent. It is always the first PCB in the PSB.
There are two ways to access the IO PCB:
While the IO PCB represents the terminal that sent a message, an alternate PCB represents the terminal or printer to which an application program wants to send a message. To reply to a terminal other than the one that sent a message, use the alternate PCB instead of the IO PCB, or the alternate PCB's name (AIB).
Example 1
Creates an instance of the IMSDBRequester, using the AIB:
| myDB | myDB := IMSDBRequester usingDBPCBNamed: 'SAWTOOTH'.
Example 2
Creates an instance of the IMSTMRequester, using the IO PCB:
| myTM | myTM := IMSTMRequester usingIOPCB.
Example 3
Creates an instance of the IMSServiceRequester, using the position of the DB PCB in the PSB:
| myService | myService := IMSServiceRequester usingDBPCBAtPosition: 4.
Depending on which platform you invoke your application from, the output when using the Transcript class is written to different places. When your application uses the Transcript class under OS/2 or NT, the output appears in the Transcript window.
When your application uses the Transcript class under IMS/ESA, the output is written to the SYSPRINT data set of the job for both batch and MPR jobs, except in cases where the interactive debugger has been started. When the interactive debugger starts, all Transcript output is re-directed to the XD Transcript window on the workstation. If you are using the interactive debugger and you want all output directed to the job log instead of the XD Transcript window, use the class named TranscriptTTY.
IMS provides information about the results of each call by placing a two-character status code in the PCB after each IMS call your program issues. Likewise, IMS provides return and reason codes in the AIB. You should check the status, return, and reason codes after every IMS call; otherwise, your program might continue processing even though the last call produced an error.
Your program should test for those status codes that indicate exceptional but valid conditions. First, the program should check for an indication of a successful call. If IMS returns an unexpected code, your program should branch to an error routine.
In Smalltalk, your program can check the status, return, and reason codes using the instance methods available from the class IMSRequester. The instance methods are as follows:
See IMS/ESA Application Programming: DL/I Calls for a description of the DL/I status codes and the return and reason codes.