pipekit/config/modules/ffpdglr1.sql
Paul Trowbridge 51ee71638f Add a rollover hot set to ffpdglr1
The fiscal-period floor advances to the new period as soon as one batch
posts into it, so a late posting into the prior period stopped being
refreshed from that moment. FFPDGLR1 itself has no dates -- only
BTID/ENT#/SEQ# -- so RPRH is the only change signal available: the new
branches follow its NWPDAT/NWUDAT/NWCDAT stamps against a 14-day floor,
and carry the unposted batches too.

Strictly additive. Measured mid-period the hot set is a subset of the
period branch, adding 0 rows -- the run stays at 132,325 rows. It earns
its keep at a period boundary, the only time the two floors disagree.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 23:48:22 -04:00

38 lines
1.3 KiB
SQL

SELECT
RTRIM(SRCE) AS srce,
RTRIM(WRKO) AS wrko,
BTID AS btid,
"ENT#" AS "ent#",
"SEQ#" AS "seq#",
RTRIM(PART) AS part,
RTRIM(RPLN) AS rpln,
PQTY AS pqty,
RTRIM(ARSC) AS arsc,
RTRIM(ADEP) AS adep,
RTRIM(ACTN) AS actn,
RTRIM(ACCT) AS acct,
AMNT AS amnt,
RTRIM(SRSC) AS srsc,
RHRS AS rhrs,
RCRW AS rcrw,
SHRS AS shrs,
SCRW AS scrw,
RRAT AS rrat,
RSIZ AS rsiz
FROM FANALDEV.FFPDGLR1
INNER JOIN LGDAT.RPRH ON NWBTID = BTID
WHERE DIGITS(NWFSYY)||DIGITS(NWFSPP) >= '{ffpdglr1_wm}'
-- Rollover hot set. The period floor above advances to the new period as soon
-- as one batch posts into it, so a late posting into the prior period would
-- stop being refreshed from that moment. These branches follow RPRH's own
-- stamps instead, and carry the unposted batches too (NWPDAT stays
-- 0001-01-01 until a batch posts, so no period/date floor can see them).
-- FFPDGLR1 itself has no dates -- only BTID/ENT#/SEQ# -- so RPRH is the only
-- change signal available. Measured 2026-08-19 mid-period: this adds 0 rows,
-- a strict subset of the period branch. It earns its keep at a period
-- boundary, which is the only time the two floors disagree.
OR NWPDAT >= DATE('{ffpdglr1_hot}')
OR NWUDAT >= DATE('{ffpdglr1_hot}')
OR NWCDAT >= DATE('{ffpdglr1_hot}')
OR RTRIM(NWPOST) <> 'Y'