Get the value of a specified variable


Inputs:  Parm1 = UJP pathname
         Parm2 = Name of variable (with NO @ or ` prefix)

Outputs: Parm2 = Value of requested variable

Returns:  0 = success
         -2 = cannot open UJP
         -3 = cannot read UJP
         -6 = variable name contains embedded white space

Before processing this function, any $fs_template $var_def commands are converted to normal $var_def commands.  The use of $fs_template for $var_def commands is deprecated (but continues to be supported).

The variable name passed in Parm2 should not contain embedded blanks.

The value returned in Parm2 is the effective value of the variable, from the last definition of the variable in the file.  Absence of a definition for the variable is not an error and will result in an empty string in Parm2.  If the value selected from the $var_def command is a double-quoted string, the double-quotes will be stripped before the result is placed in Parm2.

Variables (for example @FFBASE) in the value are NOT expanded before the value is placed in Parm2.

The result placed in Parm2 will be truncated if necessary to a length of 255 (or MaxBuf - 1) bytes plus a terminating null byte.

If you have several variables to read from the same UJP file, consider using GetFastVarValue.

This function will also obtain the values of a specific set of system and other variables:

The folder naming variables FFBASE, FFUSER, FFJOBS, FFREQ, FFLOG and FFPO.

All $var_def commands in FAXFACTS.CFG

All DATE... and TIME... variables, and DOW, as defined in Appendix D.

JOBOWNER_CODE, JOBOWNER_NAME, JOBTYPE_CODE and JOBTYPE_NAME if applicable to the passed UJP.

Windows environment variables

The above variables are treated as if they had been assigned (in the above sequence) ahead of those actually defined in the UJP file.  A valid UJP pathname in Parm1 is still required even if not actually used to obtain one of these variables.

Do not pass a literal string as parm2 because the parameter is also used to return the result.

Examples:

Get a user variable:

strcopy(parm1, "@FFJOBS\\00001234\\NO_JTYPE\\JOB12345678.UJP");

strcopy(parm2, "MY_VARIABLE");

res = JobDllEntry("GetVariableValue", parm1, parm2, 0);

The above command might return "my variable value".

Get a value expected to be a filename:

strcopy(parm1, "@FFJOBS\\00001234\\NO_JTYPE\\JOB12345678.UJP");

strcopy(parm2, "MY_filename");

res = JobDllEntry("GetVariableValue", parm1, parm2, 0);

...

res = JobDllEntry("ExpandFolderVariables", parm1, parm2, 0);

Get the current (Windows-formatted) system date:

strcopy(parm1, "@FFJOBS\\SYSTEM.UJP");

strcopy(parm2, "DATE_L");

res = JobDllEntry("GetVariableValue", parm1, parm2, 0);