This sample code will make a duplicate copy of the jobid that is entered at the prompt. Presently, there is a restriction that the job can only be duplicated on the same computer/queue; i.e. a local job.
#define INCL_SPL #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 ulSrcJob, ulTrgJob ; PSZ pszSrcComputerName,pszTrgComputerName ; PSZ pszSrcQueueName,pszTrgQueueName ; if (argc != 2) { printf("Command is: copyjob JOBID\n"); DosExit( EXIT_PROCESS , 0 ) ; } pszSrcComputerName = (PSZ)NULL ; /* The only valid values at present for these three parameters is NULL */ pszSrcQueueName = (PSZ)NULL; pszTrgComputerName = (PSZ)NULL ; pszTrgQueueName = (PSZ)NULL ; /* Convert input parameter to a ULONG */ ulSrcJob = atoi ( argv[1] ); if (splerr = SplCopyJob(pszSrcComputerName,pszSrcQueueName,ulSrcJob, pszTrgComputerName,pszTrgQueueName,&ulTrgJob)) { printf("Return code SplCopyJob = %d\n",splerr); } else { printf("New job ID is %d\n",ulTrgJob); } DosExit( EXIT_PROCESS , 0 ) ; return (splerr); } /* end main */