TAL Programmer's Guide
Using Parameters
Using Procedures
096254 Tandem Computers Incorporated 11–27
Index Register Contents as Value Parameters
When you call a procedure or subprocedure, you can pass the content of an index
register as a value parameter. If the called procedure or subprocedure expects a
reference parameter, the compiler issues a warning. When the compiler encounters
the invocation, it saves the content of the index registers, evaluates actual parameters,
and branches to the called procedure or subprocedure. On return to the caller, the
compiler restores the saved register content.
Passing the content of an index register as a parameter, however, is not portable to
future software platforms. Also, if you accelerate your program for TNS/R systems,
the Accelerator requires that you provide additional information, as described in the
Accelerator Manual.
In support of existing programs, here are the steps for passing the content of an index
register:
1. Specify a USE statement to reserve an index register and give it a name.
2. Assign a value to the index register.
3. Specify a CALL statement to pass the index identifier as a value parameter.
4. Specify a DROP statement to free the index register.
Here is an example:
PROC some_proc (f);
INT f;
BEGIN
!Lots of code
END;
PROC m MAIN;
BEGIN
USE x; !Reserve and name an index register
x := 1; !Assign a value to the index register
CALL some_proc (x); !Pass the index register content
DROP x; !Free the index register
END;