Whylode
Memoir

Program

INVJOB.clle

No notes on this program yet.

INVJOB.clleScroll sideways for full lines
1/* INVJOB - Invoice Processing Job
2 *
3 * Submitted by the end-of-day batch scheduler.
4 * Calls ORDENT to process queued orders, then EDIOUT to
5 * produce the outbound EDI 810 file for the trading partner.
6 *
7 * Steps:
8 * 1. Override order files to production library
9 * 2. Call ORDENT for each unprocessed order
10 * 3. Call EDIOUT to write the EDI spool
11 * 4. Submit EDISND to transmit the file
12 */
13PGM
14
15 DCL VAR(&ORDLIB) TYPE(*CHAR) LEN(10) VALUE('ORDPRD')
16 DCL VAR(&ERRFLAG) TYPE(*CHAR) LEN(1)
17
18 /* Override to production order library */
19 OVRDBF FILE(ORDHDR) TOFILE(&ORDLIB/ORDHDR) OVRSCOPE(*JOB)
20 OVRDBF FILE(ORDDTL) TOFILE(&ORDLIB/ORDDTL) OVRSCOPE(*JOB)
21 OVRDBF FILE(CUSTMST) TOFILE(&ORDLIB/CUSTMST) OVRSCOPE(*JOB)
22 OVRDBF FILE(TAXTBL) TOFILE(&ORDLIB/TAXTBL) OVRSCOPE(*JOB)
23
24 /* Run invoice calculation for unprocessed orders */
25 CALL PGM(ORDENT) PARM(&ERRFLAG)
26 IF COND(&ERRFLAG *EQ 'Y') THEN(DO)
27 SNDPGMMSG MSG('INVJOB: ORDENT returned error. Check QSYSOPR.') +
28 TOPGMQ(*EXT) MSGTYPE(*ESCAPE)
29 ENDDO
30
31 /* Generate EDI 810 output */
32 CALL PGM(EDIOUT)
33
34 /* Transmit EDI file - submitted separately so job log stays clean */
35 SBMJOB CMD(CALL PGM(EDISND)) JOB(EDISND) JOBQ(QBATCH)
36
37 DLTOVR FILE(*ALL) LVL(*JOB)
38
39ENDPGM