Global Variables

Global variables start with a plus sign (+). There are two types of global variables:

Global variables with value type Integer:

+CNT0 - 9 +FILEHOUR +FILETYPE
+COL +FILEMINUTE +FILEYEAR
+ELAPSETIME +FILEMONTH +LENGTH
+FILEDATE +FILESECOND +PARMNO
+FILEDAY +FILESIZE +ROW

Global variables with value type String:

+ENVIRONMENT +FILEMODE +FILETIME
+FILEDRIVE +FILENAME +PARM0 - 9
+FILEEXT +FILEPATH +RC
+FILEINFO +FILESPEC  

Mnemonic names have been chosen for the variables. For example, it is good policy to use the integer variable +COL to store a column number. However, it can also be used for totally different purposes.

You can access global variables from within a procedure file. All global variables, except +RC, are blank. The values are defined by the programmer in the procedure file or by the user in the command line, using the commands SET and RESET. Global variables, unlike local variables, are not automatically reset when the procedure file terminates. The value you set for a global variable will also be available to subsequent procedure files.

For each local variable there is a global variable with the same name.

This document covers the following topics:


Global Variables with Value Type Integer

Variables with value type Integer may contain a positive number between 0 and 32767.

+CNT0 - 9

You can use the variables +CNT1 through +CNT9 as counters.

+COL

You can use this variable to store the column number of the terminal emulation screen.

+ELAPSETIME

You can use this variable to store the difference between two date and time stamps.

+FILEDATE

You can use this variable to store the date on which a file was created or updated.

+FILEDAY

You can use this variable to store the day of the month on which a file was created or updated.

+FILEHOUR

You can use this variable to store the hour at which a file was created or updated.

+FILEMINUTE

You can use this variable to store the minute at which a file was created or updated.

+FILEMONTH

You can use this variable to store the month in which a file was created or updated.

+FILESECOND

You can use this variable to store the second at which a file was created or updated.

+FILESIZE

You can use this variable to store the size, in bytes, of the current file.

+FILETYPE

You can use this variable to store the file attributes. Valid values are:

01 read-only
02 hidden
03 read-only and hidden
04 system
05 read-only and system
06 hidden and system
07 read-only, hidden and system
10 directory
20 archive

Using combinations of the above list, you can also define attributes 21 through 27. For example, 25 contains the following values: archive, system and read-only (20+4+1).

+FILEYEAR

You can use this variable to store the year in which a file was created or updated.

+LENGTH

You can use this variable to store the length of data for which a search is to be performed or was performed.

+PARMNO

You can use this variable to store the number of +PARM0 through +PARM9 variables that were passed to a procedure file during processing.

+ROW

You can use this variable to store the row number of the terminal emulation screen.

Global Variables with Value Type String

Variables with value type String may contain any character or a group of characters. The maximum length is 254 characters.

+ENVIRONMENT

You can use this variable to store the value of an environment parameter. This variable is blank unless the SET command is used. The syntax of the SET command must include the name of the environment parameter from which the value is to be obtained. Example:

SET +ENVIRONMENT PATH

+FILEDRIVE

You can use this variable to store the drive on which a file is located.

+FILEEXT

You can use this variable to store the extension of a file name.

+FILEINFO

You can use this variable to store the following file information: name, extension, size, attributes, and the day and time the file was created or updated.

+FILEMODE

You can use this variable to store the file attributes. Valid values are:

A archive
D directory
H hidden
R read-only
S system

+FILENAME

You can use this variable to store the name of a file.

+FILEPATH

You can use this variable to store the directory or directories in which a file is located.

+FILESPEC

You can use this variable to store the path for a file.

+FILETIME

You can use this variable to store the time at which a file was created or updated.

+PARM0 - 9

You can use the variables +PARM0 through +PARM9 to read and write data, and to pass data to a procedure file (or to a group of nested procedure files).

+RC

This variable is filled by the EXIT command. It contains a programmer-defined return value which, for example, indicates the result of a procedure file.