1

I am trying to calculate what the balance of an invoice was at a certain period where

BAL = Invoice.AMT - sum(adj.amts). 

The adjustments amounts (adj.amts) are MV and have associated dates.

Therefore, I want to be able to have pass data via prompt for ACCTG.PERIOD.

SUBR('-IFS',SUBR('-LES',ACCTG.PERIOD,REUSE('ADJ.DATES')),'1','')

I also tried

SUBR('-IFS',SUBR('-LES',<<A,ACCTG.PERIOD>>,REUSE('ADJ.DATES')),'1','') 

and that did not work.

This cannot be in a paragraph.

This has to be done in an attribute otherwise audit gets all crazy. And I have to use the generic subroutines like IFS and LES.

Evgeny Minkevich
  • 2,319
  • 3
  • 28
  • 42

1 Answers1

0

If I get what you are saying, I think you can use the WHEN statement with SORT to get what you are after provided your dictionary is properly associated or you can figure out how to associate the Multi-values inline.

SORT FILE WHEN ADJ.DATES LT "YOURDATE" AND ADJ.AMTS GT 0 BREAK.ON @ID TOTAL ADJ.AMTS DET.SUP

This example would sort the contents of FILE which assumes that FILE has 2 multivalue fields call ADJ.DATES and ADJ.AMTS and that they are a Date and Decimal type. It then finds all the associations in each record that meet that criteria and totals ADJ.AMTS for each record. The ID.SUP suppress the details.

Good Luck.

Van Amburg
  • 1,207
  • 9
  • 15