Hello there again.
Do you guys could shed a light on this issue I’m facing? I know how to solve, but I can’t understand why it is happening.
this is part of the program.
LOCAL 1 #DAYS (N5) 1 #MAX (N5) 1 #far (d) END-DEFINE #DT := D'2021-06-28' READ MULTI-FETCH OF 10 PAR WITH CD-ST-PARC EQ ' ' THRU ' ' #DAYS := #DT - DT-VALID /* (d) this is the valid date on the billings. IF #DAYS > #MAX #MAX := #DAYS #FAR := DT-VALID END-IF IF #DAYS GT 9999 WRITE 'above 9999 =' #DAYS END-IF END-READ WRITE '=' #MAX '=' #FAR (EM=YYYYMMDD) END
this is the result: 8210 19990105
so far, ok.
The issue is that the version that is in production has #days defined as (n4). And I’m receiving 1320 (numeric value truncated)
You see that the oldest value for date I’ve got here is 1999-01-05. It doesn’t go over 9999 days. The if block is never used…
I know I could just go and increase the N4 to N5 in production and here we go, but I need to understand why 8210 doesn’t fit in a N4 in this case.
As always, thanks in advance,