SplHoldQueue - Example Code

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

#define INCL_SPL
#define INCL_SPLERRORS
#include <os2.h>
#include <stdio.h>       /* for printf function */

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

   /* Get queue name from the input argument  */
   pszQueueName = argv[1];

   /* Call the function to do the hold. If an error is returned, print it.   */
   splerr = SplHoldQueue(pszComputerName, pszQueueName);
   if (splerr != 0L)
   {
      switch (splerr)
      {
         case NERR_QNotFound:
            printf("Queue does not exist.\n");
            break;
         case  NERR_SpoolerNotLoaded:
            printf("The Spooler is not running.\n");
            break;
         default:
            printf("Errorcode = %ld\n",splerr);
      } /* endswitch */
   }
   else
   {
      printf("Queue %s was held.\n",pszQueueName);
   } /* endif */
  DosExit( EXIT_PROCESS , 0 ) ;
  argc; /* keep the compiler quiet */
  return (splerr);
}


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