There are quite a few ways of getting it done. Here’s an example that brings pretty much everything you mentioned into it:<pre>
D TstDat s d datfmt(*usa)
D TstDat2 8s 0
D TstDat3 8 overlay( TstDat2 )
D OutDat s 8
C seton LR
C eval TstDat = %date()-%days(1)
C eval TstDat2 = %dec( TstDat )
C eval OutDat = TstDat3
Note that OutDat isn’t actually necessary. I only included it to show that the value of TstDat3 really is what the dump says that it is. You can use TstDat3 as it is.
The value of %date() by itself is the current system date, but it’s in *ISO format. After subtracting one day from it, the result is formatted as MM/DD/YYYY by using the definition of the TstDat field. We put that date through the %dec() function in order to get the numeric digits out of the date. This value is in a field defined as zoned decimal, so we can access that memory directly as character. And we do that simply by overlaying a character field on it.
BTW, if you have any choice at all, use the *ISO format (or at the very least as YYYYMMDD) instead of putting the result out as MMDDYYYY.
Or you can skip the data structure conversion
C eval OutDat = %char( %date()-%days(1) : *usa0 )