SplDeleteJob - Example Code

This sample code will delete the job id 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 ;
   ULONG  ulJob ;
   PSZ    pszComputerName = NULL ;
   PSZ    pszQueueName = NULL ;

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

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

   if (splerr != NO_ERROR)
   {
      switch (splerr)
      {
      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 */
   }
   else
   {
      printf("Job %d was deleted.\n",ulJob);
   } /* endif */
   DosExit( EXIT_PROCESS , 0 ) ;
   return (splerr);
}


[Back: SplDeleteJob - Related Functions]
[Next: SplDeleteJob - Topics]