NetBatch Management Programming Manual

Sample Programs
NetBatch Management Programming Manual522462-003
C-46
Sample TAL Program
INT .jnum;
BEGIN
INT error; -- General error variable
! Initialize the SPI buffer
IF (error := SSINIT( spi^buf
, (zbat^val^buflen^min+6)
, zbat^val^ssid^init
, zspi^val^cmdhdr
, zbat^cmd^status -- Status command token
, zbat^obj^job -- Job object token
, 0 -- MAXRESP
,
, zspi^val^true)) THEN -- Enable checksum
stopwitherror(essinit, 13);
! Insert job-number token returned by the SUBMIT^JOB proc
IF (error := SSPUTTKN(spi^buf, zbat^tkn^sel^job^number, jnum)) THEN
stopwitherror(essput, 12);
RETURN SEND^SPI;
END; -- STATUS^JOB
--------------------------------------------------------------------------
--
-- The MAIN PROCEDURE.
-- Here the above procedures are called to communicate to the
-- scheduler $ZBAT and finally print out the data returned by
-- the scheduler through the SPI tokens.
--------------------------------------------------------------------------
--
PROC request MAIN;
BEGIN
INT .scheduler^name[0:10] := ["$ZBAT.#ZSPI"];
INT error;
INT jobnumber;
STRING .ascii^num[0:$LEN(zbat^ddl^netbatch^name^def)];
INT version;
INT .ptr; -- Working pointer
INT .job^status^map[0:zbat^map^status^job^wln] := zbat^map^status^job;
STRING buffer[0:79];
STRUCT .job^stat(zbat^ddl^status^job^def); -- Job status definition
structure
-- Read startup message
work^area ':=' "$RECEIVE";
CALL FILE_OPEN_(work^area:8, recv_chan,,,,,1);
(continued)