Share via


PRIVATE Command

Hides specified variables or arrays that were defined in a calling program from the current program.

PRIVATE VarList

-or-

PRIVATE ALL[LIKE Skeleton | EXCEPT Skeleton]

Parameters

  • VarList
    Specifies the variables or arrays to be declared private.
  • ALL LIKE Skeleton
    Causes PRIVATE to hide all variables and arrays whose names match Skeleton, which can contain the question mark (?) and asterisk (*) wildcards.
  • ALL EXCEPT Skeleton
    Causes PRIVATE to hide all variables or arrays unless their names match Skeleton, which can contain the question mark (?) and asterisk (*) wildcards.

Remarks

Items within VarList are separated by commas. The hiding of variables created in higher-level programs enables variables of the same name as the private variables to be manipulated in the current program without affecting the values of the hidden variables. Once the program containing PRIVATE has completed execution, all variables and arrays that were declared private are again available.

PRIVATE doesn't create variables; it simply hides variables declared in higher-level programs from the current program.

Example

*** Program example demonstrating PRIVATE ***
SET TALK OFF
val1 = 10
val2 = 15

DO down
? val1, val2  && Displays 10, 100

PROCEDURE down
PRIVATE val1
val1 = 50
val2 = 100
? '   Val1   Val2'
? val1, val2  && Displays 50, 100
RETURN

See Also

DIMENSION | FUNCTION | LOCAL | LPARAMETERS | PARAMETERS | PARAMETERS( ) | PROCEDURE | PUBLIC