April 1, 1981
r , PROr;RAr.'f CSECT S\VRET PROGRAM,12 LR 12,15 ST 14,SAVFET L DS 14,SAVRET 15,0 14
F ESTABLISH ADDRESSABILITY SAVE RETURN ADDRESS IN R14 LOAD RETURN ADDRESS SET RETURN CODE IN R15 GO SAVE AREA Figure Sample Assembler Proaram Entry and Exit Linkage RETURN CODE HANDLING Feqister 15, in addition to its role in entry linkage, is also used in CMS as return code reqister. All of the internal routines completion code by way of register 15, and the SVC routines that receive control when any proqram completes execution examine register 15.
If 15 contains a nonzero value, this value is placed in the ready messaqe, following the "R": hh:mm:ss
When you are executinq proqrams in it is good practice, if your
proqrams do not use reqister 15 as a return code register, to place a
zero in it before transferrina control back to CMS. Jtherwise, the ready
message may display meaningless data.
When YOI execute a proqram from your terminal, CMS scan routine sets UP a oarameter list based on your command input line. The parameter list
is doubleword-aligned, with parameters occupying successive doublewords.
The scan routine recoqnizes blanks and parentheses as argument
delimiters: parentheses are placed, in the parameter list, in separate
doublewords.
For example, if you have a CMS MODULE file named TESTPROG, and you
call it with the command line:
t es t pro g (f i 1 e 2)
The scan routine sets up the parameter list: CMNDLIST DS DC DC DC DC DC OD CL8'TESTPROG' CL8' ('
CL8'FILE2' Ct8 ') , 8X'FF' The last doubleword is made up of all 1s, to act as a delimiter.
If you enter any argument lonqer than eight characters,
truncated and only the first eight characters appear in the
However, no error condition results. 240 IBM VM/370 eMS User's Guide
it is
list.
The scan routine that sets up this parameter list places the address of
the list in register 1 and then calls the SVC handling routine. The SVC routine gives control to the program named in the first doubleword of
the parameter list. When your program receives control, it can examine the parameter list
passed to it by way of register 1. You can use this technique, also, to call CMS commands from your
programs. When you use the LOAD and RUN commands to execute
you can pass an argument list to the program on the
example, if you enter:
load myprog
start * run1 proga
a program in CMS, command line. For
the arguments *, RUN1, and PROGA are placed in a parameter list of
doublewords and register 1 contains the address of this list when your
program receives control. If you want to use the RUN command to perform
the load and start functions, you could enter:
run myprog (run1 proga
The parenthesis indicates the beginning of the argument list.
To detect the absence of a parameter list that occurs when the LOAD command START option is used, your program may test the doubleword
pointed to by register 1 for a delimiter made up of 1's in all of the
bit positions. Calling a CMS Command from a Program You can call a eMS command from a program by setting up a parameter
list, like that shown above, and then issuing an SVC 202. The parameter
list you set up must have doublewords that contain the parameters or
arguments you would enter if you were entering the command from the
terminal. For example: PUNCHER DS OD DC CL8'PUNCH' DC CL8'NAME' DC CL8'TYPE' DC CL8'*'
DC CL8' ('
DC CL8'NOH'
DC 8X'FF' In your program, when you want to execute this command, you should load
the address of the list into register 1, and issue the supervisor call
instruction (SVC) as follows:
LA 1,PUNCHER SVC 202 DC AL4 (ERROR) Section 13. Programming for the CMS Environment 241
Previous Page Next Page