Issue: We got this question from M3 Tier 2 support team that how is CAS530 calcuate?


Answer: We got below information from Infor's Support Portal.


CAS530 was designed to work like this:

It starts with the current balance in MITBAL (or MITLOC if you are doing it at lot level) then if the report is run at a prior date it reads backwards through MITTRA adding or subtracting the transaction quantities until it hits a transaction with a date less than or equal to the report date, at which point it stops.


Looking at the program code for CAS531 it is more complicated than that! Firstly it ignores any items with valuation method zero, then there are 3different sub-routines for calculating the quantity.


One for attribute controlled items (CALQ3), one for lot controlled items unless on hand method in MITFAC is two and the report date is prior to today(CALQ1) and one for everything else (CALQ2).


CALQ1 reads the last values in MITTRF10 using company, facility, item and date 99999999 if the on hand balance method is two (it will be here only if report date is today) it creates one record in the work file for each lot by reading MITTRF90 though it does also reference MITLOC and MILOIN but I did not look at why as IDB are not using on hand balance method 2 as far as I know. For other on hand balance methods it creates one record in the work file for each warehouse, item and lot by reading MITLOC80 per company, warehouse and item and accumulating up the records found. Then if the report date is less than today it reads MITTRA90 (sorted in ascending order of CONO/WHLO/ITNO/BANO/TRDT/TRTM/RGDT/RGTM/TMSX) in reverse order starting at date 99999999 and selecting transactions with MTSTCD=1 (excluding goods in transit records if you selected that in CAS530) adding MTTRQT and MTCAWE as long as MTTRDT> report date and adjusts the records in the workfile by the sum of the quantities found.


It then recalculates lots with a change date of today based on what it finds in MITTRA – the reason noted in the code is that MITTRA and MITLOC are no always in sync due to the update being done by auto job but I can’t see quite how…

The result is then converted via conversion factor in MITAUN to the unit of measure chosen in CAS530/F if necessary.


CALQ2 is similar to CALQ1, but it starts from the records that already exist in the query submitted by CAS530 (read in from MITBAL) but it reads MITTRA10(sorted in ascending order of CONO/WHLO/ITNO/TRDT/TRTM/RGDT/RGTM/TMSX) and does not recalculate.CALQ3 is similar to CALQ1 but starts using cost attribute number (CANB) instead of lot number in MITLOC.