Add a $var_def command


Inputs:  Parm1 = UJP pathname
         Parm2 = Variable name and value to add

Returns:  0 = success
         -1 = cannot lock UJP
         -2 = cannot open UJP
         -3 = cannot read UJP
         -4 = cannot write UJP
         -5 = UJP is an active job instance

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 string in Parm2 should consist of a variable name, then white space, then the variable value.  The name should not contain embedded blanks.  If the value contains embedded blanks, it should be surrounded by double-quotes and any embedded double-quote characters should then be duplicated.

The variable BROADCAST_TYPE should not be set using this function. Use the SetBroadcastType function instead.

This function adds the generated command line to the UJP.  If there are existing $var_def commands in the file, the new command is added after the last such command. If not, the command is added at the start of the file.

To delete a variable, use the DeleteCommands function.

Note that defining variables with names of the form BCFn in a UJP file serves the special purpose of selecting records for launch. For more information see $var_def.

Example:

Add or override an existing variable:

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

strcopy(parm2, "MY_VARIABLE \"New Value\"");

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