Today was the first day that COSTING ran automatically using my procedure to execute it, and it did so perfectly. After it finished, I thought of a new wrinkle. I had originally added my procedure to the TTS and marked it inactive; after running the accumulator last night, I marked it as active. It was my intention to mark it as inactive again until the next accumulator.
Then I thought: why not check whether the COSTFLAG is set for the most recent accumulator? If it is set, then don't run COSTING. As this external program is in a separate procedural step, I could issue an ERRMSG call that would halt the procedure, but I thought it better to set a flag that sets a :$.GO variable - and a GOTO step would skip over the COSTING stage if necessary.
So now the procedure is in the TTS and will run every Friday, but most weeks it will do nothing.
In stage 10, SQLI: /* My stuff */ :CURDATE = 01/01/88; SELECT MAX (CURDATE) INTO :CURDATE FROM ACCDATES; :FLAG = '\0'; SELECT COSTFLAG INTO :FLAG FROM ACCDATES WHERE CURDATE = :CURDATE; GOTO 99 WHERE :FLAG = 'Y'; LINK ACCDATES TO :$.DAT; ... LABEL 99; :$.GO = (:FLAG = 'Y' ? 50 : 30); /* End of stage 10 */
Stage/parameter | Name/type |
---|---|
10 | SQLI |
DAT | LINE |
GO | INT |
20 | GOTO |
GO | INT |
30 | COSTING |
ARG | INT |
MSG | ASCII |
DAT | LINE |
40 | SQLI |
50 | END |
Remember that ARG must be 1. Stage 40 sends me an email