Hitachi

JP1 Version 11 JP1/Script Description and Reference (For Windows Systems)


8.2.5 SetGV (set a global variable)

Purpose

Sets a global variable. In JP1/Script 05-00 and later versions, this command allows you to set a global variable on a remote computer.

Syntax
SetGV (GlobalName, [Value] [, CompName])
Arguments
GlobalName

Write the global variable name as a character string or as a variable that stores this value.

Value

Write the value to be set in the global variable as a string, number, or as a variable that stores this value.

This value is optional. If you omit this value, a zero-length string ("") is assumed.

CompName (from version 05-00)

Write the name of the computer on which this global variable is to reside, using a character string or a variable that stores this value.

This value is optional. If you omit this value, the computer on which the command is executed is assumed.

Note that JP1/Script must be installed and the JP1/Script service must be running on the remote computers to be specified. For details about accounts for accessing computers, see 2.2 Accounts for communication with other computers.

Description

The SetGV command sets a specified value in a specified global variable. The command returns True on successful execution, or False if an error occurs.

If you specify a non-existent global variable, a new global variable is created with the specified value. If you specify an existing global variable, its value is updated.

If you specify a remote computer in CompName and want to include n double quotation marks (") as characters in either GlobalName or Value, you must specify n*4 double quotation marks (") for GlobalName and n*8 double quotation marks (") for Value. However, If you specify 1 in the following registry, you can use n*2 double quotation marks instead of n*8:

Registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Hitachi\JP1/Script\SPTX

Value name

ParseDQ

Value datatype

REG_DWORD

Value

0: If you are using quotation marks in a parameter string, the setting that allows you to specify n*2 double quotation marks (") is disabled (this is the default value).

1: If you are using quotation marks in a parameter string, the setting that allows you to specify n*2 double quotation marks (") is enabled.

To specify both 1 and 2 (see the SeparateStrCount and SeparateStr commands) as the value of this registry, type 3.

When the setting takes effect

The setting takes effect the next time the script file is executed.

Note

This command creates a global variable file (SPTGV.SPG) in the DATA folder in the installation folder. However, in JP1/Script 06-51 and later versions, if you open the Options (Cluster Environment) dialog box (Tools, Options command) and change the folder for management file output, the file will be created in the folder you specified.

The global variable file is preserved when the script completes execution. Delete this file if you want to initialize the global variables.

When a remote computer is specified in the CompName argument, operation is guaranteed only in a LAN environment. This command does not operate across firewalls.

Examples
' Set a global variable on the local computer.
SetGV ("Debug_Mode", True)
 
' Set a global variable on computer "SOP4A065(SCRIPT)".
SetGV ("Debug_Mode", True, "SOP4A065(SCRIPT)")
JP1/Script version

Supported from JP1/Script 01-00.