Nested Procedures - IBM System 360 User Manual

Operating system: time sharing option terminal
Hide thumbs Also See for System 360:
Table of Contents

Advertisement

NESTED PROCEDURES
A command procedure can be made into a compile-lead-go sequence -- the
equivalent of the RUN command -- by using the procedure nesting and
conditional execution capabilities.
For instance, in Figure 14.3"
note
that the user enters two ALLOCATE commands, defining terminal input and
output for execution time, and a LOADGO command to invoke his program.
Like the commands used to invoke the compiler, these would normally be
used every time the user wants to invoke his program, and therefore can
be reasonably placed in a command procedure.
This second procedure can
be called from the compiler-invoking procedure, making it a
compile-load-go procedure.
The procedure to load and execute the user program might be defined
as shown in Figure 14.5, under a suitable name such as LDGO.
The FREE
command in record 2 is the same as the one in the PLIF procedure.
It
needs to be repeated here since it will not be executed in that
procedure, as explained below.
Records 3 and 4 allocate the terminal
for an SYSIN or SYSPRINT I/O statements in the user program, and
statement 5 is the LOAOGO command causing the program to be brought into
storage and given control.
r----------------------------------------------------------------------,
I
1
PROC 1 NAM1
I
I
2
FREE FILE(SYSUT1,SYSUT3,SYSIN,SYSPRINT)
I
I
3
ALLOCATE DATASET ( *) FILE (SYSIN)
I
I
4
ALLOCATE DATASET(*) FILE(SYSPRINT)
I
I
5
LOADGO &NAM1 ••
0BJ
PLILIB
I
I
6
END
I
L ______________________________________________________
~
_______________
J
Figure 14.5.
A Command Procedure to Invoke a User Program
It
~ould
be possible to call this procedure from the PLIF procedure
by inserting a record containing:
EXEC LDGO '&NAMl!:'
However, it would be preferable to call it only when the return code
from the compiler indicates successful execution is likely, that is, no
serious errors were detected during compilation.
To test the compiler
return code, the user inserts a WHEN statement:
WHEN SYSRC(LE 4) EXEC LOGO '&NAME'
The WHEN statement immediately follows the CALL command invoking the
compiler (record 8 in Figure 14.2).
I
f
the compiler return code is less
than or equal to four ("LE 4"), indicating that no errors or only minor
errors were detected, the EXEC command is executed, and the procedure
ends.
If the return code is greater than four, the EXEC command will be
ignored, the FREE command is executed, and the procedure ends.
The
terminal returns to command mode, and the user will probably use the
LIST command to display the compiler listing. determine the errors in
the source program, correct them with the EDIT command, and reinvoke the
procedure for another compilation.
Figure 14.6 shows the modified PLIF
command procedure.
A DELETE command has been added for the object
module, since it is not executable.
Figure 14.7 shows a use of the
procedure for a successful compilation.
The LIST operand is specified
to display each command as i t is executed.
85.3
TSO Terminal User's Guide
(Release 21.7)

Advertisement

Table of Contents
loading

Table of Contents