Calculate prior year

 2 Replies
 0 Subscribed to this topic
 17 Subscribed to this forum
Sort:
Author
Messages
Chesca
Veteran Member Send Private Message
Posts: 490
Veteran Member
Hello everybody, is there an API to calculate the prior year? Do I need to convert year to Julian and can I just subtract 1 from the current year?
Woozy
Veteran Member Send Private Message
Posts: 709
Veteran Member
If you already have just a year value, then you should be able to subtract. If you have a date, then you can use 900-INCREMENT-DATE for this. This API will increment/decrement a date by days, months, and/or years. Once you get that, then you would need to split out the year portion. Check out the "Lawson 4GL Application Program Interfaces" document for details.

MOVE INPUT-DATE TO WSDR-FR-DATE.
MOVE ZEROES TO WSDR-DAY-INCR
WSDR-MONTH-INCR.
MOVE -1 TO WSDR-YEAR-INCR.
MOVE "Y" TO WSDR-EOM-ROLLOVER.
PERFORM 900-INCREMENT-DATE.
MOVE WSDR-TO-DATE TO OUTPUT-DATE.

Good Luck

Kelly
Kelly Meade
J. R. Simplot Company
Boise, ID
Chesca
Veteran Member Send Private Message
Posts: 490
Veteran Member
Yayyy...Perfect, thank you so much, Woozy!