PTD - Patch Last 21 Days Demand

Patch Bad Day of Sales Data

A customer can accidentally send multiple years worth of data in the nighttime interface file for daily demand.

These steps were used to patch the bad day of sales (Daily Product Journal), PTD, Sales Journal, and last 21 days demand.

1) Make backups of these files:

  • K_DLYPROD
  • K_INTDALY
  • K_PRODUCT

2) Identify the bad K_DLYPROD record using the R1_BATCH# and R1_BIRTH fields.

3) Subtract the bad K_DLYPROD record.

Create program that will read update primary on K_PRODUCT. This program will chain to K_DLYPROD for the exact record matching the birth date and the batch# fields. If found and if sales > 0 then you will subtract the sales from the products PTD values (PR_ACCSALE and PR_ACCDEM).

4) Zero out the back K_DLYPROD record.

Run the following SQL command.

update gja_5dta.k_dlyprod set r1_dlysale = 0, r1_dlyouts = 0
where r1_birth = ‘2021-09-23’ and r1_batch# = 912

5) Identify the bad K_INTDALY records.

6) Delete the bad K_INTDALY records.

Run the following SQL command.

delete from k3s_5dta.k_intdaly where IE_BIRTH = ‘ ‘ and IE_PROCESS = ‘ ‘

7) Create a work file that is a clone of K_INTDALY with different name and in will be located in library K3S_5CNV.

8) Bring in the correct records to a work file.

Run the following command with the proper company data.

CPYFRMIMPF FROMSTMF(/K3S/DailyDemandGoja01010001.csv) TOFILE(K3S_5CNV/INTDALY) MBROPT(REPLACE) RCDDLM(ALL) STRDLM(NONE) FLDDLM( ) FROMRCD(2) RPLNULLVAL(FLDDFT)

9) Data check the work file.

Force certain values into the work file. Ensure IE_PROCESS = IE_BIRTH and IE_PROCFLG = 1.

update gja_5cnv.zxintdaly set ie_birth = ‘0001-01-01’ ,
ie_process = ‘0001-01-01’ , ie_procflg = 1

10) Copy the data from the work file into the master file

Run the following command with the proper company data.

CPYF FROMFILE(K3S_5CNV/INTDALY) TOFILE(K3S_5DTA/K_INTDALY) MBROPT(*ADD)

11) Run a program to sum up the K_INTDALY records for the specific date and update our K_DLYPROD record with the correct total.

12)Run a program to add the specific K_DLYPROD record to the PTD values