You are here: Development Standards > OSAS Standards > Environment > Variables

# Variables

OSAS software was originally written on a Business BASIC II interpreter, which limited variable names to two characters. Each variable consisted of a letter and a number. The current interpreter allows much longer variable names. Make variable names as meaningful as possible without making maintenance too difficult.

To prevent conflict with other applications, study the other applications' data. This is especially important when you define a new file which is accessed in a program which accesses other data files.

The current interpreter allows for more flexible creation of matrices. String arrays and numeric matrices with variable starting and ending bounds are allowed. The example below shows a matrix with three elements, 1, 2 and 3, instead of the standard four elements, 0–3.

`0100 DIM A[1:3]`

Always use this form for arrays. This standard also allows an IOLIST to use the [ALL] option. It makes IOLISTs much smaller and easier to define and use.

Common Variables

Many common variables are defined and used throughout the system. The most commonly used variables are described below. There are three categories of variables: variables set before a program is run, global variables set before a program is run, and variables used in a program.

Below is a list of variables initialized by the menu program before a program is RUN (or CALLed).

Variable | Description
C0$, C1$ | Current company ID. These variables exist for compatibility with older versions of OSAS programs. Use STBL("CID") for the company ID.
C2$ | Current company name. C2$ exists for the same reason as C0$ and C1$. STBL("CNAME") is the new standard variable for the company name.
FILE[x] | Array of open file channels. The menu program DIMensions this array with zeros. When DIMensioned, x is set to the numeric value stored in STBL("CHANNELS").
GUI | Set to 1 if the user has chosen to run in graphical mode, or to 0 if the user has chosen to run in text mode.
O1$ | Program name to RUN upon completion of the current function. The value is normally "RMMENU." STBL("MENUPROG") also contains the appropriate program name.
O2$ | Option switch settings. The length of O2$ is 50. Each position represents one option switch. An option switch is ON if O2$(n,1)="1" and OFF if O2$(n,1)=" ".
OT$ | Menu title selected. In each program, set TITLE$=OT$ before displaying the screen box.
T$ | Table file name. The value is normally the 2- character application code plus "TB". The table name passed to a program in T$ is the table that relates to the menu file being used. If you run an AP program from a PO menu, T$ will contain "POTB". Read all tables from the active application's table file.
X0$ | The program parameter. The menu program sets X0$ to the current program's parameter entry in the menu record.
OSGUI$ | A template that stores information about GUI screens that are currently being used.

Here is a list of commonly used variables. The menu program does not initialize them before running a program, but program and general routines set and use them.

Variable | Description
F | Device number used in PRINT statements. Use the UNT function to assign the value of F. Reports must print to (F).
F0 | An array index associated with each file for the FILE[ ] array.
F$ | File name for a file operation. This variable is used by both the general file open routine and the general error routine.
Mx$ | Numeric mask variables. Use mask variables for consistent display and entry of numbers.
Y$ | Last command entered by the user.
O7 | Used with GOSUB GENERROR to generate standard messages.
X8$ | Used to display local messages and allow the cursor to return.
X9$ | Used to display messages and force a response.
TITLE$ | Holds the screen title. For consistency, set TITLE$=OT$ (see menu variables above).
X2 | Used to tell the help system on which of the possible screens the current field resides. Also used to allow multiple identical fields to access the same help screen. To do so, assign a six-digit number xxyyzz to X2 before calling GENINPUT to identify the help screen to use, where xx is the X0 value, yy is the X1 value, and zz is the X2 value.
X0 | Data entry variable.
X1 | Data entry variable.
X3 | Data entry variable.
X4 | Data entry variable.
X9 | Data entry variable.
X1$ | Data entry variable.
X$, X | Data entry variable.
WINDID$ | Window setup variable.
SELVAL$ | Window setup variable.
GUI_ID | Data entry variable.
L0 | Line counter.
P0 | Page counter.
P9 | Interprogram status control.
PROGID$ | File maintenance availability flag.
YDISABLE$ | Command control.
DEVICE$ | Output device set by GENOUT.PUB
INFO | INFO=0 means clear Info or Detl status flags from status bar. INFO=1 means display "Info" on the status bar, allow and trap keystroke, and return "I" to calling program in Y$. INFO=2 means display "Detl" on the status bar.
O1$ | Menu program name. Programs return to the menu by executing the line RUN O1$.
FLD_HLP$ | Help field ID. Set FLD_HLP$ if a field uses a common help screen for related fields in an application to cut down on the help file size by eliminating duplicate help IDs.
PG_LEN | Report page length. Set PG_LEN in report programs. PG_LEN is generally 56 for file or printer output and 21 for screen output.

OSAS makes use of global variables for data that applications or public programs frequently need. You access global variables with the STBL function—for example, STBL("CID").

String | Description
“APPS” | All applications currently installed on the OSAS system.
“BANK” | Default bank account ID. This variable carries the default bank account ID stored in the company information record.
“BANNER” | Banner page flag. The system sets this variable according to the workstation defaults. The GENOUT.PUB program checks the flag when the user selects output to a printer or file, and prints a banner page if the value is ON.
“BASEDIRPATH” | Base OSAS directory. This variable contains the base directory for the OSAS programs (the directory where the progXX directories reside). For example, the default directory is “C:/osas/” on a Windows server.
“BELL” | Bell flag. This variable determines if the terminal should beep when an error message or verification prompt appears. The system sets this value according to the workstation defaults, which can be toggled between null (off) and 'RB' (on) by pressing Ctrl-G in text mode, or by using the pull-down Modes menu in GUI mode.
“BRKT” | Bracketed field flag. The setup program sets this variable to "Y" if the terminal does not support reverse video for field input, or "N" if the terminal does support it. If it is set to “Y,” GENINPUT surrounds the field with square brackets ([ ]).
“CAPPS” | Applications installed and active for the current company.
“CHANNELS” | Number of FILE[ ] array elements. Currently this variable is set to 100. It is used by the menu program to DIMension the FILE[ ] array.
“CID” | This variable contains the current company ID.
“CNAME” | This variable contains the current company name.
“CTS” | Print compressed to screen. The system sets this variable ON if the terminal supports compressed report printing to the terminal, or OFF if the terminal does not support it.
“DATA1” | The first path on which live data files are stored.
“DATA2” | The second path on which live data files are stored.
“DATA3” | The third path on which live data files are stored.
“DATE” | System date. This variable replaces the DAY function. The menu initializes this value to the operating system's date formatted according to STBL("DATEMASK"). Resource Manager allows the user to edit it. Always use this variable for the system date. Do not use DATE(0), because the operating system date returned by that BBx function may be different from the OSAS system date.
“DATEMASK” | This variable contains the date mask for displaying dates. The setup program sets the value from the user-selected date format for the current company. Supported formats are "%Mz/%Dz/%Y" (U.S.) and "%Dz/%Mz/%Y" (European). Both formats generate a 4-digit year. You can force a 2-digit year by adding +"z" to the string. For example, the syntax to generate a date with a 2-digit year is DATE(X:STBL("DATEMASK")+"z"), where X is the Julian value of the desired date.
“DESTID” | Control ID of a GUI control that the user clicked so control can jump to that entry field.
“DOCUMENTDIR” | This is the directory where the OSAS document files reside relative to each workstation. Document files include the OSAS user’s guides, the productivity reports, and any other documents shared by multiple OSAS users.
“DOCUMENT_ SERVER” | This is the directory where OSAS documents are stored relative to the server where they are located. For example, if the files are located on the server’s C drive, the path might be “C:/osas/Document”. The directory path relative to the workstation is stored in the “DOCUMENTDIR” global variable.
“EMAIL” | This is the directory where the workstation’s email client is stored.
“EXIT” | Exit from menu flag. The system sets this variable ON to allow the user to exit from OSAS via the Exit command, or OFF if not. The system sets this value according to the workstation defaults. If the value is OFF, the system requires a program to RELEASE to the operating system when chosen from the menu.
“GLCURRYR” | The GL fiscal year with which the user is working. If STBL(“GLYEAR”)=STBL(“GLCURRYR”), the user is processing in the current GL fiscal year; if not, the user is processing in a prior year.
“GLMASK” | Company GL account mask. GENINPUT.PUB uses this variable to format account number type entries.
“GLYEAR” | The current fiscal year for GL processing.
“GUI” | Set to YES if the user chose to run in graphical mode, or to NO if the user chose to run in text mode.
“GUIRESPROG” | Contains a list of the public programs that are ADDR’ed when a function is run in graphical mode. It is used to set STBL(“RESPROG”) when launching a GUI function from the MDI menu. (See also “TXTRESPROG”.)
“GUIWIND” | Number of elements in each array in the OSGUI$ template (currently set to 50). It is used by the menu program to DIMension the OSGUI$ template arrays.
“INFOGUI” | This variable contains the directory where the graphical resource files are stored. (Graphical resource files carry .BRC extensions under Visual PRO/5 and .ARC extensions under BBj.)
“INSERT” | Insert flag. This variable determines if the user has selected typeover or insert mode for data entry. The system sets the value based on the workstation options, which can be toggled between ON and OFF by pressing the Insert (Ctrl+T) key.
“INSTALLPATH" | This variable contains the directory path to the installation media. It is used during application installation.
“INTTYPE” | Stores the type of interpreter being used to run OSAS, either PRO/5 or BBj.
“JULDATE” | System date in Julian format. To use this number, you must use the function NUM(STBL("JULDATE")) to convert the global string to a number.
“LIVE” | Live data access flag. The system sets this variable to "0" to allow the user access to live data, or "1" to allow access to sample data only. The system sets this value based on the workstation defaults.
“MAC” | The system sets this variable to “1” on an Apple Mac client, or to “0” on any other client operating system.
“MAP” | Stores the workstation default for the Map Lookup ID.
“MENUAPP” | The application from which the function was selected.
“MENUVER” | The version number of the application from which the function was selected.
“MENUDESC” | Title of the menu function. This global is the same as the variable OT$, with the exception that OT$ is padded by a space on both ends of the name so it can be used in painting the title of the screen.
“MGW” | Current channel on which the PRO/5 GUI device (always X0) is open.
“MPARAM” | The menu parameter passed to the running program. This is set in the Resource Manager Menus function.
“MPROG” | The name of the program run from the main menu.
“NUMOPTS” | Number of options and interfaces switches available per application. Currently this variable is set to 50.
“ONLINE” | Online help flag. The system sets this variable based on the workstation defaults. If the value is ON, GENINPUT.PUB displays a list of valid function keys at the bottom of the screen during processing.
“OPSYS” | The current running operating system under which OSAS is installed and running.
“OPTIONS” | Application options. This variable contains the options for the current application and company ID. Duplicate of the O2$ variable.
“OSTPL” | BBx channel on which the data file OSTPL is open.
“PGDN” | Page Down verification flag. GENERROR uses this variable to determine whether to require a second Proceed command. The system sets this value from the workstation defaults, and it can also be changed using the Modes pull-down menu in GUI mode.
“PRINT_FILE” | The path on which the current workstation ID is set up to create any print files.
“QUICK” | Quick entry flag. This variable determines if a function should use the associated quick-entry tables to determine field and jump stops during entry. The system sets this value according to the workstation defaults, which is toggled between OFF and ON by pressing Ctrl+F in text mode, or by using the Modes menu in GUI mode.
“RESPROG” | Resident public programs. This variable contains a list of programs that the menu program ADDRs before running a function. Other programs may ADDR their own public programs because the menu program drops all resident programs and ADDRs only those listed in this variable.
“RMPREFIX” | Path in which Resource Manager is installed.
“RWDATAPATH” | This variable contains the directory path to the Report Writer data.
“SAMPLE” | Path in which sample data files are stored.
“SAMPWIND” | Sample data flag. The presence of this variable indicates that the user is using sample data rather than live data.
“SCALEGUI” | GUI screens are designed using a 600x400 pixel form. If this variable is set to NO, GUI screens remain 600x400 regardless of the monitor resolution settings; if set to YES, GUI screens are enlarged in accordance with the monitor’s resolution.
“SCREENX” | The last X coordinate at which a GUI screen was placed. New GUI forms will start at this position.
“SCREENY” | The last Y coordinate at which a GUI screen was placed. New GUI forms will start at this position.
“SCREENS” | The total number of screens visible at any given time when a report is printed to the screen in text mode.
“SORTSEQ" | Contains a unique three-character sequence number used to create scratch files.
“SORT_FILE” | The path in which the current workstation ID is set up to create any sort files. If no directory is set up, sort files are created in the active data or sample data directory.
“SYSFIL” | The path in which system files are located. Any nondata files needed by applications are stored here.
“SYSOPEN” | The file extension used to open up both OSAPPL.xxx and OSINFO.xxx.
“TIMEMASK” | Time mask. This variable contains the mask for displaying times. The setup program sets the value from the user-selected time format for the current company. Supported formats are "%h:%mz %p" (12-hour) and "%Hz:%mz" (24-hour/ military).
“TXTRESPROG” | Contains a list of the public programs that are ADDR’ed when a function is run in character mode. It is used to set STBL(“RESPROG”) when launching a text function from the MDI menu. (See also “GUIRESPROG”.)
“UTILSPATH” | This variable stores the path to the development utilities directory, if specified through the Directories function.
“VERSION” | Current Resource Manager version. This version number is used as a default for accessing file conversion routines and file creation files.
“VERSW” | Verification flag. This variable determines whether to verify the Abandon and Exit keys when the user presses them. The setup program sets the value based on the workstation defaults, which can be toggled between OFF and ON by pressing Ctrl+V in text mode, or by using the pull-down Modes menu in GUI mode.
“WEB” | This is the directory where the workstation’s Internet browser is stored.
“WHSE” | Default warehouse ID. This variable carries the default warehouse ID stored in the company information record.
“WT” | Contains the workstation default for unit of measure used when entering weights in OSAS applications.
“xxDIR” | Path in which an application program files are stored (where xx is the application ID).

The system uses global variables to store text-based window colors. OSAS defines 13 window types and four additional text colors. Four colors are associated with each window type: background, text, border and title. This table shows the global variable string associated with each window and color type.

Window | Background | Text | Border | Title
Func Level 1 | "FBKG" | "FTXT" | "FBX" | "FTTL"
Func Level 2 | "FBKG2" | "FTXT2" | "FBX2" | "FTTL2"
Func Level 3 | "FBKG3" | "FTXT3" | "FBX3" | "FTTL3"
Menu Level 1 | "MBKG1" | "MTXT1" | "MBX1" | "MTTL1"
Menu Level 2 | "MBKG2" | "MTXT2" | "MBX2" | "MTTL2"
Menu Level 3 | "MBKG3" | "MTXT3" | "MBX3" | "MTTL3"
Information | "SBKG" | "STXT" | "SBX" | "STTL"
Help | "HBKG" | "HTXT" | "HBX" | --
Inquiry | "IBKG" | "ITXT" | "IBX" | --
Error | "EBKG" | "ETXT" | "EBX" | --
Message | "MSBKG" | "MSTXT" | "MSBX" | --
Verify | "VBKG" | "VTXT" | "VBX" | --
Options | "OBKG" | "OTXT" | -- | --
Attention- Warning | -- | "AWAR" | -- | --
Attention- Caution | -- | "ACAU" | -- | --
Attention- Alert | -- | "AALE" | -- | --
Attention- Highlight | -- | "AHIG" | -- | --

The system also stores user-defined numeric masks in global variables. There are nine numeric types to which the user can assign a numeric precision. The following table shows the global strings that contain various default masks and precision settings:

Number Type | Mask | Precision
Regular dollar amounts | "+DOLL" | "-DOLL"*
Quantities | "+IQTY" | "-IQTY"
Unit Prices | "+INUP" | "-INUP"
Unit Costs | "+INUC" | "-INUC"
Hours | "+HOUR" | "-HOUR"
Rates | "+RATE" | "-RATE"
Credit Limits | "+CRED" | "-CRED"
GL dollar amounts | "+GDOL" | "-GDOL"*
GL dollar amounts with commas | "+GCOM" | "-GCOM"*

*Regular dollar amounts and GL dollar amounts always have the same precision.