CICS to IMS using the SEND LAST EXEC command
In a system in which CICS® is
the front-end subsystem and IMS the
back-end subsystem, IMS supports
the use of the CICS synchronous
API to allow access to IMS asynchronous
transactions. SEND LAST is used to process IMS nonresponse mode and nonconversational
transactions, message switches, and the /DISPLAY, /RDISPLAY and /FORMAT commands.
The general CICS application
program flow for CICS to IMS using SEND LAST is
shown in the following figure.

In this example, the CICS application reads the input message from the terminal and establishes a CICS-to-IMS session using the ALLOCATE command.
The CICS application program
builds the required ATTACH function management header (the only header
required, because this is a synchronous application) by using the BUILD
ATTACH EXEC command. The RPROCESS and RRESOURCE fields should
be specified in the BUILD ATTACH to identify the
terminal and transaction to be used to process the reply. Issuing
a SEND command causes the output message to be constructed.
A SEND LAST command causes end-bracket to be appended
to the message.
The output message is not sent on the session until the next command
is executed. The next EXEC command that is issued
depends upon the definition of the transaction within IMS, because this command both appends the sync-point
request to the message and issues the message on the ISC session.
If this transaction is defined to IMS as
recoverable, the next command must be SYNCPOINT.
SYNCPOINT causes the outbound message to be issued with an RQD2. If
the transaction is defined as nonrecoverable, either SYNCPOINT, FREE,
or RETURN can be issued next. FREE or RETURN issued
immediately after the SEND and without an intervening SYNCPOINT causes
the outbound message to be issued with RQE1.
If IMS generates a reply message
as a result of receiving this transaction, that reply from IMS is returned with the ATTACH FM
header. In order to get the IMS reply
message from the session, CICS must
issue a RECEIVE (because the reply message carries
only ATTACH).