SplHoldJob

This function holds a job in a print queue.

Syntax
SplHoldJob(pszComputerName, pszQueueName, ulJob);

Parameters

 * pszComputerName (PSZ) - input
 * Name of computer where job is to be paused.


 * A NULL string specifies the local workstation.


 * pszQueueName (PSZ) - input
 * Queue Name.


 * ulJob (ULONG) - input
 * Job identification number.

Returns

 * rc (SPLERR) - returns
 * Return code.


 * NO_ERROR (0)
 * No errors occurred.
 * ERROR_ACCESS_DENIED (5)
 * Access is denied.
 * ERROR_NOT_SUPPORTED (50)
 * This request is not supported by the network.
 * ERROR_BAD_NETPATH (53)
 * The network path cannot be located.
 * NERR_NetNotStarted (2102)
 * The network program is not installed.
 * NERR_JobNotFound (2151)
 * The print job does not exist.
 * NERR_SpoolerNotLoaded (2161)
 * The spooler is not running.
 * NERR_JobInvalidState (2164)
 * This operation cannot be performed on the print job in its current state.
 * NERR_InvalidComputer (2351)
 * The computer name is invalid.

Sample
This sample code will hold the queue name that is entered at the prompt.


 * 1) define INCL_BASE
 * 2) define INCL_SPL
 * 3) define INCL_SPLERRORS
 * 4) include 
 * 5) include       /* for printf function */
 * 6) include      /* for atoi function   */

INT main (argc, argv) INT argc; CHAR *argv[]; {  SPLERR splerr ; PSZ   pszComputerName = NULL ; PSZ   pszQueueName = NULL ; ULONG ulJob ;

/* Get job id from the input argument. */  ulJob = atoi(argv[1]);

/* Call the function to do the hold. If an error is returned, print it. */  splerr = SplHoldJob( pszComputerName, pszQueueName, ulJob);

switch (splerr) {     case NO_ERROR: printf("Job %d was held.\n",ulJob); break; case NERR_JobNotFound: printf("Job does not exist.\n"); break; case NERR_JobInvalidState: printf("This operation can't be performed on the print Job.\n"); break; default: printf("Errorcode = %ld\n",splerr); } /* endswitch */ DosExit( EXIT_PROCESS, 0 ) ; argc; return (splerr); }

Call Sequence

 * 1) define INCL_SPL /* Or use INCL_PM, */
 * 2) include 

PSZ      pszComputerName;  /*  Name of computer where job is to be paused. */ PSZ      pszQueueName;     /*  Queue Name. */ ULONG    ulJob;            /*  Job identification number. */ SPLERR   rc;               /*  Return code. */

rc = SplHoldJob(pszComputerName, pszQueueName,      ulJob);

Remarks
If the job is already printing when the call is made, NERR_JobInvalidState (2164) is returned.

A user with administrator privilege can hold any job.

A job created locally can be held locally regardless of user privilege level, but can be held remotely only by an administrator.

A remote job can be held by a user without administrator privilege only if the username of the person initiating the request is the same as the username of the person who created the job.

Related Functions

 * SplEnumJob
 * SplQueryJob
 * SplReleaseJob