Difference between revisions of "Information Systems:Overnight ENDOFDAY"
| Line 496: | Line 496: | ||
==WSOVERNIT2== |
==WSOVERNIT2== |
||
| + | |||
| + | /* KEEP LAST 14 ITEM MASTER FILES SO WEB ORDERS CAN TELL IF THERE HAS BEEN */ |
||
| + | /* A CUSTOMER PRICE CHANGE WITHIN LAST 2 WEEKS. */ |
||
| + | |||
| + | DLTF FILE(WSITEMX14) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX13) OBJTYPE(*FILE) NEWOBJ(WSITEMX14) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX12) OBJTYPE(*FILE) NEWOBJ(WSITEMX13) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX11) OBJTYPE(*FILE) NEWOBJ(WSITEMX12) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX10) OBJTYPE(*FILE) NEWOBJ(WSITEMX11) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX09) OBJTYPE(*FILE) NEWOBJ(WSITEMX10) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX08) OBJTYPE(*FILE) NEWOBJ(WSITEMX09) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX07) OBJTYPE(*FILE) NEWOBJ(WSITEMX08) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX06) OBJTYPE(*FILE) NEWOBJ(WSITEMX07) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX05) OBJTYPE(*FILE) NEWOBJ(WSITEMX06) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX04) OBJTYPE(*FILE) NEWOBJ(WSITEMX05) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX03) OBJTYPE(*FILE) NEWOBJ(WSITEMX04) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX02) OBJTYPE(*FILE) NEWOBJ(WSITEMX03) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RNMOBJ OBJ(WSITEMX01) OBJTYPE(*FILE) NEWOBJ(WSITEMX02) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | CRTPF FILE(&DATALIB/WSITEMX01) OPTION(*NOSOURCE + |
||
| + | *NOLIST) SIZE(*NOMAX) |
||
| + | CPYF FROMFILE(WSITEMP) TOFILE(WSITEMX01) + |
||
| + | MBROPT(*REPLACE) CRTFILE(*NO) FMTOPT(*NOCHK) |
||
| + | MONMSG MSGID(CPF0000) EXEC(DO) |
||
| + | CHGVAR VAR(&MESSAGE) VALUE('WSITEMP not copied') |
||
| + | CHGVAR VAR(&TEXT) VALUE('Something happened while + |
||
| + | saving last 14 days of WSITEMP') |
||
| + | CALL PGM(OPMSGSEND) PARM(&MESSAGE &TEXT) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | ENDDO |
||
| + | |||
| + | /* Clear files. */ |
||
| + | |||
| + | CLRPFM FILE(WSITEMP) |
||
| + | MONMSG MSGID(CPF0000) EXEC(DO) |
||
| + | SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) + |
||
| + | MSGDTA('WSOVERNITE -- Unable to clear + |
||
| + | file WSITEMP -- job cancelled') + |
||
| + | TOMSGQ(*SYSOPR) MSGTYPE(*ESCAPE) |
||
| + | GOTO CMDLBL(EXIT) |
||
| + | ENDDO |
||
| + | |||
| + | CLRPFM FILE(WSVENDP) |
||
| + | MONMSG MSGID(CPF0000) EXEC(DO) |
||
| + | SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) + |
||
| + | MSGDTA('WSOVERNITE -- Unable to clear + |
||
| + | file WSVENDP -- job cancelled') + |
||
| + | TOMSGQ(*SYSOPR) MSGTYPE(*ESCAPE) |
||
| + | GOTO CMDLBL(EXIT) |
||
| + | ENDDO |
||
| + | |||
| + | CLRPFM FILE(WSALTIP) |
||
| + | MONMSG MSGID(CPF0000) EXEC(DO) |
||
| + | SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) + |
||
| + | MSGDTA('WSOVERNITE -- Unable to clear + |
||
| + | file WSALTIP -- job cancelled') + |
||
| + | TOMSGQ(*SYSOPR) MSGTYPE(*ESCAPE) |
||
| + | GOTO CMDLBL(EXIT) |
||
| + | ENDDO |
||
| + | |||
| + | CLRPFM FILE(WSPROMP) |
||
| + | MONMSG MSGID(CPF0000) EXEC(DO) |
||
| + | SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) + |
||
| + | MSGDTA('WSOVERNITE -- Unable to clear + |
||
| + | file WSPROMP -- job cancelled') + |
||
| + | TOMSGQ(*SYSOPR) MSGTYPE(*ESCAPE) |
||
| + | GOTO CMDLBL(EXIT) |
||
| + | ENDDO |
||
| + | |||
| + | /* Clear spool files from output queues. */ |
||
| + | /* These are only used when first generated. */ |
||
| + | |||
| + | CLROUTQ OUTQ(CATPRCTKTS) |
||
| + | CLROUTQ OUTQ(CATSHFLBLS) |
||
| + | |||
| + | /* Overrides */ |
||
| + | |||
| + | OVRDBF FILE(SRBPRG) SHARE(*NO) |
||
| + | |||
| + | /* Import item data. */ |
||
| + | |||
| + | CALL PGM(WSIMPITM) PARM(&BLANKITEM &BLANKPROMO + |
||
| + | &BLANKBOOK) |
||
| + | |||
| + | /* Import promotions. */ |
||
| + | |||
| + | CALL PGM(WSIMPPRO) |
||
| + | /* Import Vendors. */ |
||
| + | |||
| + | CALL PGM(WSIMPVND) |
||
| + | |||
| + | /* Update minimum order values in site options files. */ |
||
| + | |||
| + | CALL PGM(WSUPDMIN) |
||
| + | |||
| + | /* Rebuild top sellers file if this is the first day of the month. */ |
||
| + | |||
| + | RTVJOBA DATE(&DATE) |
||
| + | IF COND(%SUBSTRING(&DATE 3 2) = '01') THEN(CALL + |
||
| + | PGM(WSIMPTOPC)) |
||
| + | |||
| + | /* Rebuild top "buyers" file if this is the first day of the month. */ |
||
| + | |||
| + | IF COND(%SUBSTRING(&DATE 3 2) = '01') THEN(CALL + |
||
| + | PGM(WSIMPBUY)) |
||
| + | |||
| + | /* BUILD FILE OF ITEM GROUPS THAT ARE IN THE WEB TOP BUYERS OR TOP */ |
||
| + | |||
| + | /* SELLERS FILES */ |
||
| + | |||
| + | CLRPFM FILE(WSCTLDB) |
||
| + | MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(NEXT8)) |
||
| + | CALL PGM(WSITEMGRP) |
||
| + | NEXT8: |
||
| + | |||
| + | /* BUILD FILE OF ITEM CATEGORY 1 THAT ARE IN THE WEB ITEM FILE */ |
||
| + | |||
| + | CLRPFM FILE(WSCTLP1) |
||
| + | MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(NEXT9)) |
||
| + | CALL PGM(WSCAT1) |
||
| + | NEXT9: |
||
| + | |||
| + | /* BUILD HIERARCHIAL GROUP/CLASS FILE */ |
||
| + | |||
| + | RUNQRY QRY(CATEGORY1) QRYFILE((*LIBL/WSITEMP) + |
||
| + | (*LIBL/SROPRG)) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | RUNQRY QRY(CATEGORY2) QRYFILE((*LIBL/CAT1) + |
||
| + | (*LIBL/SROCTLDG) (*LIBL/SROCTLDB) + |
||
| + | (*LIBL/SROCTLP1)) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | |||
| + | /* BUILD NEW ITEMS FILE (FIRST RECEIPT WITHIN LAST MONTH) */ |
||
| + | |||
| + | CLRPFM FILE(WSNEWITM) |
||
| + | MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(NEXT10)) |
||
| + | CALL PGM(WSNEWITEMS) |
||
| + | MONMSG MSGID(CPF0000) |
||
| + | NEXT10: |
||
| + | |||
| + | /* Exit. */ |
||
| + | |||
| + | GOTO CMDLBL(EXIT) |
||
| + | |||
| + | /* Fatal error. */ |
||
| + | |||
| + | FATAL: |
||
| + | SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) + |
||
| + | MSGDTA('WSOVERNITE -- Unknown error + |
||
| + | occurred -- see job log -- job + |
||
| + | cancelled') TOMSGQ(*SYSOPR) MSGTYPE(*ESCAPE) |
||
| + | CHGJOB LOG(4 00 *MSG) LOGCLPGM(*YES) |
||
| + | EXIT: |
||
| + | |||
| + | /* Delete overrides */ |
||
| + | |||
| + | DLTOVR FILE(SRBPRG) |
||
| + | MONMSG MSGID(CPF0000 MCH0000) |
||
Revision as of 16:33, 4 February 2016
The scheduler starts this job at 1:00AM; every morning except Sunday - when the End of Week is called. It calls EODDAILY, which will -
- End all programs that use ASW or extension files, and end subsystems so users cannot sign on.
- Do a 'temporary' backup of data libraries only. This uses tape '999999', which has a retention period of one day so that it can be over written every night. It can be used if something happens during the overnight processing, to quickly restore a file the next day if needed (without having to call the tape from off site storage), and to rebuild the test environment.
- Run updates, reports, and housekeeping (clear work files and out queues, and delete unnecessary spool files).
The following sections only show the main functions in the programs; not any error checking. Whenever there can be an error that shouldn't affect processing, the programs have the MONMSG (monitor message) command to ignore it. When a file that is to be rebuilt can't be cleared (because it is in use by another job), the program will automatically skip the rebuild.
EODDAILY
/* send email that daily overnight process is starting */
CHGVAR VAR(&SMSG) VALUE('EOD starting (2:15 3:00 +
5:00 6:30)')
CHGVAR VAR(&LMSG) VALUE(&SMSG)
CALL PGM(OPMSGSEND) PARM(&SMSG &LMSG)
/* End all processes that use either ASW or extension files. This is */
/* so that the temporary backup can save all files, and because some of */
/* the ASW jobs cannot run if any other jobs are using their files. */
CALL PGM(EODEND2)
/* run End of Day processing */
CALL PGM(EOD)
/* send email that daily overnight process ended normally */
CHGVAR VAR(&SMSG) VALUE('Daily overnite processing +
ended Normally')
CHGVAR VAR(&LMSG) VALUE('This message means there +
were no errors that halted processing. If +
this message is not sent, it means the +
full backup cancelled this job.')
CALL PGM(OPMSGSEND) PARM(&SMSG &LMSG)
EODEND2
This will end all processes that can use either ASW or extension files. This does not end Domino, so that I.T. staff will receive the emails being sent.
/* End EDI monitors for SPS Commerce and EDI Gateway */
EDIENDMON
EDIENDEDIG
/* End subsystems that run user jobs */
ENDSBS SBS(QINTER) OPTION(*IMMED)
ENDSBS SBS(QBATCH) OPTION(*IMMED)
ENDSBS SBS(DCRF) OPTION(*IMMED)
ENDSBS SBS(UP1480BS) OPTION(*IMMED)
ENDSBS SBS(TLABARCODE) OPTION(*IMMED)
ENDSBS SBS(BC400SERVR) OPTION(*IMMED)
ENDSBS SBS(MONITOR2) OPTION(*IMMED)
/* End IMS, IMP, IOP, OMS, and EMA */
CHGDTAARA DTAARA(IMSWITCH) VALUE('STOP ')
CHGDTAARA DTAARA(IMPSWITCH) VALUE('STOP ')
CHGDTAARA DTAARA(IOPSWITCH) VALUE('STOP ')
CHGDTAARA DTAARA(OMSWITCH) VALUE('STOP ')
CHGDTAARA DTAARA(EMASWITCH) VALUE('STOP ')
ENDIMSJOB
ENDIMPJOB
ENDIOPJOB
ENDOMSJOB
ENDEMAJOBS
ENDIMSSUB OPTION(*IMMED)
ENDIMPSUB OPTION(*IMMED)
ENDIOPSUB OPTION(*IMMED)
ENDOMSSUB OPTION(*IMMED)
ENDEMASUB OPTION(*IMMED)
/* End Web servers, pause for one minute, then end subsystem */
ENDTCPSVR SERVER(*HTTP) HTTPSVR(WEBSMART)
ENDTCPSVR SERVER(*HTTP) HTTPSVR(WEBTEST)
ENDTCPSVR SERVER(*HTTP) HTTPSVR(WEBINTER)
DLYJOB DLY(60)
ENDSBS SBS(QHTTPSVR) DELAY(60)
/* Explicity end Telnet server with a 5 minute delay - otherwise */
/* there could be a problem with the RF guns */
ENDTCPSVR SERVER(*TELNET)
DLYJOB DLY(300)
EOD
/* Do temporary backup. This is to restore files if update program */
/* bombs. It can be used to do a quick restore if say, a user deletes */
/* something they shouldn't. And it is used to rebuild test libraries. */
CALL PGM(EODBUTEMP)
/* Set up production environment for company VA. */
CHGASWCOM COMPANY(VA)
/* Run End of Day updates. */
CALL PGM(EODUPD)
/* Run End of Day reports. */
CALL PGM(EODRPT)
/* Run End of Day housekeeping. */
CALL PGM(EODCLR)
/* Clear consolidated item master file (XXITEMP). This is rebuilt in */
/* EODREBLD, but as it is used by so many jobs, it can be cleared only */
/* in the Application Restricted State. */
RCLRSC
CLRPFM FILE(XXITEMP)
/* Rebuild statistics files, and update summary files. As this can run */
/* while users are on the system, submit job to QBATCH so that it will */
/* run after the system is brought back up again. This gets it out of */
/* the restricted state sooner. */
SBMJOB CMD(CALL PGM(EODREBLD)) JOBQ(QS36EVOKE)
EODBUTEMP
/* Hold BRMS maintenance report so it doesn't print. */
OVRPRTF FILE(QP1AEP) HOLD(*YES)
/* Call BRMS Maintenance to expire tape '999999'. It has a one day */
/* retention, but still must be expired before it can be used again. */
/* Note that this temporary backup won't work if it runs before midnight.*/
STRMNTBRM RMVLOGE(*NONE) RUNCLNUP(*NO) RTVVOLSTAT(*NO) +
CHGJRN(*NO) PRTEXPMED(*NO) PRTVSNRPT(*NO) +
PRTBKUACT(*NO) PRTRCYRPT(*NONE)
/* Delete BRMS maintenance report */
DLTSPLF FILE(QP1AEP) SPLNBR(*LAST)
/* Run BRMS control group UNITEMP, which will save user data files only. */
STRBKUBRM CTLGRP(UNITEMP) SBMJOB(*NO)
EODUPD
/* Generate bills to suppliers for COOP AND VEDI. This has to run first */
/* so that generated entries will be included in the updates. */
CXBILL03C
CALL PGM(CXBILL06)
/* Run ASW command to put the current date minus 1 (as this job is */
/* running after midnight) into the LDA (local data area) */
CHGASWLDA TYPE(*DATDZ) RELVAL(-1) STARTPOS(001)
/* Extract yesterday's date from the LDA and convert it to numeric */
RTVDTAARA DTAARA(*LDA (1 8)) RTNVAR(&DATEC)
CHGVAR VAR(&DATE) VALUE(&DATEC)
/* Call ASW program to get yesterday's fiscal period, and convert to */
/* character. */
GETPERIOD DATE(&DATE) PERIOD(&PERIOD)
CHGVAR VAR(&PERIODC) VALUE(&PERIOD)
/* Print invoice journal. This will be file DMR352P in WRKSPLF EDOJOB. */
/* There are saved parameters for this. Just change the date and period.*/
RTVASWPAR PGM(DMC352) PAID(INVJOURNAL) USER(*ALL)
CHGASWLDA TYPE(*DATDZ) RELVAL(-1) STARTPOS(082)
CHGASWLDA VALUE(&PERIODC) TYPE(*CHAR) STARTPOS(090) +
POSITIONS(6)
EXCASWPGM PGM(DMC352) PARM(N)
/* Run nightly DIS to FIN. Again, there are saved parameters for this. */
/* Change the date and period. */
RTVASWPAR PGM(GCFC751) PAID(DIS2FIN) USER(*ALL)
CHGASWLDA TYPE(*DATDZ) RELVAL(-1) STARTPOS(082)
CHGASWLDA VALUE(&PERIODC) TYPE(*CHAR) STARTPOS(090) +
POSITIONS(6)
EXCASWPGM PGM(GCFC751) PARM(N)
/* Clear intermediate purchase suggestions from yesterday. */
RTVASWPAR PGM(DIC801) PAID(CLRSUGPO) USER(*ALL)
CHGASWLDA TYPE(*DATDZ) STARTPOS(1)
EXCASWPGM PGM(DIC801) PARM(N)
/* Generate purchase suggestions. */
RTVASWPAR PGM(INVC431) PAID(PURSUG2MAI) USER(*ALL)
EXCASWPGM PGM(INVC431) PARM(N)
RTVASWPAR PGM(INVC431) PAID(PURSUG3MAI) USER(*ALL)
EXCASWPGM PGM(INVC431) PARM(N)
/* Keep copy of purchase suggestions as there are sometimes questions */
/* about whether something was generated here, or manually. */
CPYF FROMFILE(UP1480BFVA/SROPUH) +
TOFILE(UP1480BFVA/SROPUH.B1) MBROPT(*REPLACE)
CPYF FROMFILE(UP1480BFVA/SROPUL) +
TOFILE(UP1480BFVA/SROPUL.B1) MBROPT(*REPLACE)
/* Update ASW Item Cost With Effective VEBA From CCP */
CALL PGM(IXRUP880)
/* Note that we can operate if the following jobs are not run. There may */
/* be some 'unexpected results', but that will not stop us from receiving,*/
/* picking, and shipping orders. */
/* Rebuild the Time Axis File */
RTVASWPAR PGM(DMC951) PAID(TIMEAXIS) USER(*ALL)
CHGASWLDA VALUE(&PERIODC) TYPE(*CHAR) STARTPOS(007) +
POSITIONS(6)
EXCASWPGM PGM(DMC951) PARM(N)
/* Rebuild A/R Credit Time Axis */
RTVASWPAR PGM(GDMC195) PAID(ARAXIS) USER(*ALL)
EXCASWPGM PGM(GDMC195) PARM(N)
/* Rebuild A/R and A/P Totals */
RTVASWPAR PGM(FSC880) PAID(ARAPREBLD) USER(*ALL)
EXCASWPGM PGM(FSC880) PARM(N)
/* Calculate items that will have a 5% increase in cost or 5% decrease */
/* in gross margin %, and email buyer. */
CALL PGM(IXRIQ405)
/* Send any 'READY' promos to ECU */
ECUPROMO
/* Adjust demand by items on promo. This is so that purchase */
/* suggestions for regular stocked items are not inflated by promo sales.*/
PXDEMAND
/* Use average purchase cost for warehouse MAI in SROSRO to update */
/* average purchase cost in SROSRO for RET, and average purchase cost */
/* in base item master file SROPRG. */
/* Do not share open data path, as SRBPRG may not be open for update. */
OVRDBF FILE(SRBPRG) TOFILE(SRBPRG) SHARE(*NO)
CALL PGM(AVGCST01)
/* Run miscellaneous billing - extract VEDI and COOP to be billed */
CALL PGM(CXBILL)
/* FTP Sales Orders with no invoiced lines. Normally, the FTP'ed */
/* invoice file includes cancelled order lines. This will send orders */
/* that haven't generated an invoice. */
CALL PGM(INVCUP300)
/* For miscellaneous (VEDI & COOP) billing, settle invoice to transfers */
CALL PGM(CXBILL07)
/* Cancel any held POS orders that are four days old or more */
CALL PGM(IOPMIN04)
/* Delete item notes that have expired */
CALL PGM(DMRUP101)
/* Try to reorganize Carrier Interface File */
RGZPFM FILE(ATLASPF)
EODRPT
/* DIS and WHM Integrity Reports - WHOLOP not balanced to SROSRO. For */
/* both MAI and RET. */
RTVASWPAR PGM(WMC251S) PAID(MAIINT) USER(*ALL)
EXCASWPGM PGM(WMC251S) PARM(N)
RTVASWPAR PGM(WMC251S) PAID(RETINT) USER(*ALL)
EXCASWPGM PGM(WMC251S) PARM(N)
/* Print onhand inventory at cost for both warehouses */
CHGJOB OUTQ(ELAHO)
RUNQRY QRY(STOCKST02A)
/* Print Lost Sales Report */
LOSTSALES
/* Reset out of stock code of 'A' or 'B' for items not back in stock. */
CALL PGM(PLZUP050)
EODCLR
/* Delete spool files generated by ASW End of Day - only keep Invoice */
/* Register. */
DLTSPLF FILE(GCFP752) SPLNBR(*LAST)
DLTSPLF FILE(FKR050P) SPLNBR(*LAST)
DLTSPLF FILE(FMR050P) SPLNBR(*LAST)
DLTSPLF FILE(FMR050P) SPLNBR(*LAST)
DLTSPLF FILE(FMR066P) SPLNBR(*LAST)
DLTSPLF FILE(FMR065P) SPLNBR(*LAST)
DLTSPLF FILE(FMR065P) SPLNBR(*LAST)
/* Clear out queues of reports generated, but never actually printed */
CLROUTQ OUTQ(ASWPICKLST)
CLROUTQ OUTQ(ASWPUTAWAY)
CLROUTQ OUTQ(ASWSOREDI)
CLROUTQ OUTQ(JFPIPE)
/* Clear Pick List work files (these should be cleared each time the */
/* user exists the program, but apparently aren't always) */
CLRPFM FILE(WKPL30P)
CLRPFM FILE(WKPL40P)
CLRPFM FILE(WKPL45P)
/* Clear work files. Some of this are used in WebSmart; they are by */
/* user, and are only cleared when they make a new selection. Which */
/* means if they are not cleared here, there will be a set of records */
/* for every user who has ever used the program, and the file will grow. */
CLRPFM FILE(UROLCU)
CLRPFM FILE(WSVENODTP)
CLRPFM FILE(WSVENOSP)
CLRPFM FILE(WSGENERP)
CLRPFM FILE(WOPUR01AP)
CLRPFM FILE(WSCSTSLS1P)
CLRPFM FILE(INTRANSP)
CLRPFM FILE(INTRANS2P)
CLRPFM FILE(CAINTSLSP)
CLRPFM FILE(DETORDCST)
CLRPFM FILE(IUSERS)
CLRPFM FILE(SUMDCACT)
CLRPFM FILE(SUMINVC01)
CLRPFM FILE(SUMINVC02)
CLRPFM FILE(SUMSLSC02)
CLRPFM FILE(SUMSLSC03)
CLRPFM FILE(POSUM01)
CLRPFM FILE(POSUM01A)
CLRPFM FILE(PODET01)
/* Clear promo report work files */
CLRPFM FILE(PXWRK05P)
CLRPFM FILE(PXWRK06P)
/* Clear unused reports from Out Queues */
CALL PGM(OUTQCLEAR)
EODREBLD
/* clear files and folders for Web Orders */
/* there are some Unix commands run in Qshell that sometimes fail, so */
/* submit it to batch and wait for it to complete. If it doesn't, it */
/* won't affect the end of day - but the image and specification in Web */
/* Orders may not be correct. */
SBMJOB CMD(CALL PGM(WSOVERNIT1)) JOBQ(QS36EVOKE)
DLYJOB DLY(420)
/* Build consolidated item master file (XXITEMP). This must run before */
/* Web Order files are rebuilt. */
CALL PGM(ITEMINFOCA)
/* rebuild files for Web Orders */
CALL PGM(WSOVERNIT2)
/* Run End of Day housekeeping. */
CALL PGM(EODCLR)
/* Build summary file of lost sales */
/* (ITEMSTAT uses this file, so this has to run first) */
CLRPFM FILE(SUMVENLST)
CALL PGM(BLDSUMLST)
/* Rebuild item statistics file (XXSTATSP) */
CLRPFM FILE(XXSTATSP)
CALL PGM(ITEMSTAT)
/* Rebuild promo results files (for InfoNet) */
CALL PGM(PXRESBUILD)
/* Build summary file of sales (including brand) by customer */
/* (for IN_CUSTSLS) */
CALL PGM(BLDCSTSL2) PARM(' ')
/* Build summary file of freight vs sales (current and previous month) */
CALL PGM(BLDSUMFRT) PARM(' ')
CALL PGM(BLDSUMFRTP)
/* Build summary file to validate Analyser */
CALL PGM(BLDANAWRK)
/* Search for duplicate keys in ANOSTK */
RUNQRY QRY(ANOSTKCNT1) QRYFILE((*LIBL/ANOSTK))
RUNQRY QRY(ANOSTKCNT2) QRYFILE((*LIBL/ANOCOUNT))
/* Build file of sales order pattern - sales by the hour */
CALL PGM(BLDORDLIN) PARM(' ')
/* Build file of sales order statistics by day */
CALL PGM(BLDDAYLINF)
/* Build file of PO fill rates */
CALL PGM(BLDPOFRT) PARM(' ')
/* Build file of sales and budget by item account group */
CALL PGM(BLDSLSBUD) PARM(' ')
/* Build summary file of lost sales by warehouse */
CLRPFM FILE(SUMWHSLST)
CALL PGM(BLDWHSLST)
/* Build file of VEBA by province by day */
CALL PGM(BLDVEBA) PARM(' ')
/* send email that rebuild is complete */
CHGVAR VAR(&SMSG) VALUE('Statistics files rebuild +
is complete')
CHGVAR VAR(&LMSG) VALUE(&SMSG)
CALL PGM(OPMSGSEND) PARM(&SMSG &LMSG)
OUTQCLEAR
/* Write list of spool files in out queues PRT01 and QPRINT to spool */
/* files, then copy those spool files to a data file. */
WRKOUTQ OUTQ(PRT01) OUTPUT(*PRINT)
CPYSPLF FILE(QPRTSPLQ) TOFILE(REPORT) SPLNBR(*LAST) +
TOMBR(OUTQ)
WRKOUTQ OUTQ(QPRINT) OUTPUT(*PRINT)
CPYSPLF FILE(QPRTSPLQ) TOFILE(REPORT) SPLNBR(*LAST) +
TOMBR(OUTQ) MBROPT(*ADD)
/* Run a query to build a file of all spool files that can be deleted. */
/* This query has a list of reports that are never printed. */
RUNQRY QRY(OUTQCLR) QRYFILE((*LIBL/REPORT))
/* Read through the created file, and delete those spool files in it. */
NEXT:
RCVF RCDFMT(OUTQDEL)
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END))
CHGVAR VAR(&NUMBER) VALUE(&FILENUMB)
DLTSPLF FILE(&FILE) JOB(&JOBNUMB/&USER/&JOB) +
SPLNBR(&NUMBER)
GOTO CMDLBL(NEXT)
END:
/* Delete the two spool files that were created. */
DLTSPLF FILE(QPRTSPLQ) SPLNBR(*LAST)
DLTSPLF FILE(QPRTSPLQ) SPLNBR(*LAST)
WSOVERNIT2
/* KEEP LAST 14 ITEM MASTER FILES SO WEB ORDERS CAN TELL IF THERE HAS BEEN */ /* A CUSTOMER PRICE CHANGE WITHIN LAST 2 WEEKS. */
DLTF FILE(WSITEMX14)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX13) OBJTYPE(*FILE) NEWOBJ(WSITEMX14)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX12) OBJTYPE(*FILE) NEWOBJ(WSITEMX13)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX11) OBJTYPE(*FILE) NEWOBJ(WSITEMX12)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX10) OBJTYPE(*FILE) NEWOBJ(WSITEMX11)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX09) OBJTYPE(*FILE) NEWOBJ(WSITEMX10)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX08) OBJTYPE(*FILE) NEWOBJ(WSITEMX09)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX07) OBJTYPE(*FILE) NEWOBJ(WSITEMX08)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX06) OBJTYPE(*FILE) NEWOBJ(WSITEMX07)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX05) OBJTYPE(*FILE) NEWOBJ(WSITEMX06)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX04) OBJTYPE(*FILE) NEWOBJ(WSITEMX05)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX03) OBJTYPE(*FILE) NEWOBJ(WSITEMX04)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX02) OBJTYPE(*FILE) NEWOBJ(WSITEMX03)
MONMSG MSGID(CPF0000)
RNMOBJ OBJ(WSITEMX01) OBJTYPE(*FILE) NEWOBJ(WSITEMX02)
MONMSG MSGID(CPF0000)
CRTPF FILE(&DATALIB/WSITEMX01) OPTION(*NOSOURCE +
*NOLIST) SIZE(*NOMAX)
CPYF FROMFILE(WSITEMP) TOFILE(WSITEMX01) +
MBROPT(*REPLACE) CRTFILE(*NO) FMTOPT(*NOCHK)
MONMSG MSGID(CPF0000) EXEC(DO)
CHGVAR VAR(&MESSAGE) VALUE('WSITEMP not copied')
CHGVAR VAR(&TEXT) VALUE('Something happened while +
saving last 14 days of WSITEMP')
CALL PGM(OPMSGSEND) PARM(&MESSAGE &TEXT)
MONMSG MSGID(CPF0000)
ENDDO
/* Clear files. */
CLRPFM FILE(WSITEMP)
MONMSG MSGID(CPF0000) EXEC(DO)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) +
MSGDTA('WSOVERNITE -- Unable to clear +
file WSITEMP -- job cancelled') +
TOMSGQ(*SYSOPR) MSGTYPE(*ESCAPE)
GOTO CMDLBL(EXIT)
ENDDO
CLRPFM FILE(WSVENDP)
MONMSG MSGID(CPF0000) EXEC(DO)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) +
MSGDTA('WSOVERNITE -- Unable to clear +
file WSVENDP -- job cancelled') +
TOMSGQ(*SYSOPR) MSGTYPE(*ESCAPE)
GOTO CMDLBL(EXIT)
ENDDO
CLRPFM FILE(WSALTIP)
MONMSG MSGID(CPF0000) EXEC(DO)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) +
MSGDTA('WSOVERNITE -- Unable to clear +
file WSALTIP -- job cancelled') +
TOMSGQ(*SYSOPR) MSGTYPE(*ESCAPE)
GOTO CMDLBL(EXIT)
ENDDO
CLRPFM FILE(WSPROMP)
MONMSG MSGID(CPF0000) EXEC(DO)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) +
MSGDTA('WSOVERNITE -- Unable to clear +
file WSPROMP -- job cancelled') +
TOMSGQ(*SYSOPR) MSGTYPE(*ESCAPE)
GOTO CMDLBL(EXIT)
ENDDO
/* Clear spool files from output queues. */ /* These are only used when first generated. */
CLROUTQ OUTQ(CATPRCTKTS)
CLROUTQ OUTQ(CATSHFLBLS)
/* Overrides */
OVRDBF FILE(SRBPRG) SHARE(*NO)
/* Import item data. */
CALL PGM(WSIMPITM) PARM(&BLANKITEM &BLANKPROMO +
&BLANKBOOK)
/* Import promotions. */
CALL PGM(WSIMPPRO)
/* Import Vendors. */
CALL PGM(WSIMPVND)
/* Update minimum order values in site options files. */
CALL PGM(WSUPDMIN)
/* Rebuild top sellers file if this is the first day of the month. */
RTVJOBA DATE(&DATE)
IF COND(%SUBSTRING(&DATE 3 2) = '01') THEN(CALL +
PGM(WSIMPTOPC))
/* Rebuild top "buyers" file if this is the first day of the month. */
IF COND(%SUBSTRING(&DATE 3 2) = '01') THEN(CALL +
PGM(WSIMPBUY))
/* BUILD FILE OF ITEM GROUPS THAT ARE IN THE WEB TOP BUYERS OR TOP */
/* SELLERS FILES */
CLRPFM FILE(WSCTLDB)
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(NEXT8))
CALL PGM(WSITEMGRP)
NEXT8:
/* BUILD FILE OF ITEM CATEGORY 1 THAT ARE IN THE WEB ITEM FILE */
CLRPFM FILE(WSCTLP1)
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(NEXT9))
CALL PGM(WSCAT1)
NEXT9:
/* BUILD HIERARCHIAL GROUP/CLASS FILE */
RUNQRY QRY(CATEGORY1) QRYFILE((*LIBL/WSITEMP) +
(*LIBL/SROPRG))
MONMSG MSGID(CPF0000)
RUNQRY QRY(CATEGORY2) QRYFILE((*LIBL/CAT1) +
(*LIBL/SROCTLDG) (*LIBL/SROCTLDB) +
(*LIBL/SROCTLP1))
MONMSG MSGID(CPF0000)
/* BUILD NEW ITEMS FILE (FIRST RECEIPT WITHIN LAST MONTH) */
CLRPFM FILE(WSNEWITM)
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(NEXT10))
CALL PGM(WSNEWITEMS)
MONMSG MSGID(CPF0000)
NEXT10:
/* Exit. */
GOTO CMDLBL(EXIT)
/* Fatal error. */
FATAL:
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) +
MSGDTA('WSOVERNITE -- Unknown error +
occurred -- see job log -- job +
cancelled') TOMSGQ(*SYSOPR) MSGTYPE(*ESCAPE)
CHGJOB LOG(4 00 *MSG) LOGCLPGM(*YES)
EXIT:
/* Delete overrides */
DLTOVR FILE(SRBPRG)
MONMSG MSGID(CPF0000 MCH0000)