Coding your MPP program in Pascal
The program shown below is a skeleton MPP written in Pascal.
The numbers to the right of the program refer to the notes that follow the program. All storage areas that are referenced in the parameter list of your Pascal application program's call to IMS can reside in the extended virtual storage area.
Skeleton MPP written in Pascal
NOTES:
segment PASCIMS; 1
type
CHAR4 = packed array [1..4] of CHAR;2
CHARn = packed array [1..n] of CHAR;
IOPCBTYPE = record 3
(* Field declarations *)
end;
ALTPCBTYPE = record
(* Field declarations *)
end;
DBPCBTYPE = record
(* Field declarations *)
end;
procedure PASCIMS (var SAVE: INTEGER; 4
var IOPCB: IOPCBTYPE;
var ALTPCB: ALTPCBTYPE;
var DBPCB: DBPCBTYPE); REENTRANT;
procedure PASCIMS;
type 5
SSATYPE = record
(* Field declarations *)
end;
MSG_SEG_IO_AREA_TYPE = record
(* Field declarations *)
end;
DB_SEG_IO_AREA_TYPE = record
(* Field declarations *)
end;
ALT_MSG_SEG_OUT_TYPE = record
(* Field declarations *)
end;
var 6
MSG_SEG_IO_AREA : MSG_SEG_IO_AREA_TYPE;
DB_SEG_IO_AREA : DB_SEG_IO_AREA_TYPE;
ALT_MSG_SEG_OUT : ALT_MSG_SEG_OUT_TYPE;
const 7
GU = 'GU ';
ISRT = 'ISRT';
SSANAME = SSATYPE(...);
procedure PASTDLI; GENERIC; 8
begin
PASTDLI(const GU, 9
var IOPCB,
var MSG_SEG_IO_AREA);
PASTDLI(const GU, 10
var DBPCB,
var DB_SEG_IO_AREA,
const SSANAME);
PASTDLI(const ISRT, 11
var ALTPCB,
var ALT_MSG_SEG_OUT);
end; 12
Pascal language interface 13
Note:
- Define the name of the Pascal compile unit.
- Define the data types needed for the PCBs used in your program.
- Define the PCB data types used in your program.
- Declare the procedure heading for the REENTRANT procedure called by IMS. The first word in the parameter list should be an INTEGER, which is reserved for VS Pascal's use, and the rest of the parameters will be the addresses of the PCBs received from IMS.
- Define the data types needed for the SSAs and I/O areas.
- Declare the variables used for the SSAs and I/O areas.
- Define the constants (function codes, SSAs, and so forth) used in the PASTDLI DL/I calls.
- Declare the IMS interface
routine with the GENERIC Directive. GENERIC identifies external routines
that allow multiple parameter list formats. A GENERIC routine's parameters
are
declared
only when the routine is called. - The program issues a
GU
call to the I/O PCB to retrieve the first segment of an input message. The declaration of the parameters in your program might differ from this example. - The program can issue a
GU
call to a DB PCB to retrieve a database segment. The function codes for these two calls are identical; the way that IMS distinguishes between them is by the PCB to which each call refers. The declaration of the parameters in your program might differ from this example. - The program sends an output message segment to an alternate destination
by issuing an
ISRT
call to an alternate PCB. The declaration of the parameters in your program might differ from this example. - When there are no more messages for your MPP to process, you return control to IMS by exiting the PASCIMS procedure. You can also code a RETURN statement to leave at another point.
- You must bind your program to the IMS language interface module, DFSLI000, after you have compiled your program.