SeeView Manual

SeeView Language Elements
HP NonStop SeeView Manual526355-004
5-3
Procedures
When you first start the SeeView program, it determines the name of its shell file and
executes all sections contained in that shell file. The SeeView program also executes
sections in a shell file or script when an INVOKE statement references a file containing
SeeView statements or when the execute-current-shell function key, SF15, is pressed.
This provides a mechanism for calling external SeeView programs and menus (for
example, INVOKE filename) or for reinitializing the current environment (for
example, SF15).
When a SeeView script is invoked, line 25 displays status messages that indicate what
section is being executed. If an error occurs, a message displays the source file and
section where the error occurred. When the SeeView program finishes processing a
section successfully, it indicates the source file and section name that generated the
display.
Sometimes a program generates one terminal page per section. This section-per-
display-page orientation forms a logical way to group statements.
Procedures
Procedures declare logical groups of SeeView statements that are executed with a
CALL statement. Procedures are callable anywhere a SeeView statement is permitted.
You can associate statements and procedures with a menu.
?PROC proc-name indicates the beginning of a procedure.
The PARM statement declares procedure parameters. Parameters can be passed
either by value or reference. They can be integer or string expressions.
Parameters are optional. You can specify a default parameter value to be used if the
caller does not supply the parameter value when calling the procedure. Example 5-2
shows a simple SeeView program with a procedure.
Use the VARIABLE (or VAR) statement to declare integer and string variables within a
procedure. These variables are local in scope. You can use the PRINT * statement to
display local procedure variables and their values after a procedure is executed, which
helps in debugging.
In addition to the parameters passed to a procedure, built-in string intrinsics provide
global information regarding the current SeeView environment. For more information
on string intrinsics, see String Operators and String Intrinsics on page 9-148.
Example 5-2. Simple SeeView Program With a Procedure
?PROC Listdev { #DeviceType }
{---------------------------}
PARM #DeviceType := "disc"; { # indicates DeviceType is type string
TASK pup;
WINDOW pup,"listdev " & #DeviceType;
?SECT main
{---------}
PAGE 2; CALL Listdev; { On page 2 display PUP LISTDEV DISC
PAGE 3; CALL Listdev ("tape"); { On page 3 display PUP LISTDEV TAPE