This sample code will hold the queue name that is entered at the prompt.
#define INCL_BASE
#define INCL_SPL
#define INCL_SPLERRORS
#include <os2.h>
#include <stdio.h> /* for printf function */
#include <stdlib.h> /* 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);
}