Add a $ command to a UJP file


Inputs:  Parm1 = UJP pathname
         Parm2 = Command line 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
         -6 = command does not start with $

This function adds the specified command line to the UJP.  It is positioned in the UJP as follows:

If the command name is $var_def, the command is added immediately following the last $var_def command in the file, or at the beginning of the file if there are no $var_def commands already in the file.

If the command name is $fs_template, and the template item is $email_header, then the command is added at the end of the file.

If the command name is $fs_template, and the template item is $email_body, $email_altbody, $email_text, $email_alttext, $sms_body or $sms_text, then for an instance UJP only, all existing body/text commands of the same type which originated in the system, owner or jobtype UJP are deleted; then the command is added at the end of the file.

If there is an existing command of the same name (other than the two cases described above), then the new command is added in front of the existing command in the UJP file.

If none of these conditions apply, the command is added at the end of the file.

The AddVariable function is the preferred function for adding a $var_def command.

The supplied command should be a fully formatted complete line and should conform to the normal CopiaFacts conventions for double-quoting and use of embedded folder-name variables such as @FFBASE.  However no validation of the command is performed by this function.

Example:

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

strcopy(parm2, "$fax_csid \"555 777 1234\"");

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