I need to format date variables that will be used to select data between two dates. I can get the current timestamp formatted to my needs, but having issues with the past timestamp. Basically the past timestamp will be the current year/month with day starting at 01. I've tried using subst and concat, as well as dtefmt, but no luck. I keep hitting a brick wall with everything I try (or search for) 
I would go the SQL way, but one of the databases is a System/38 and does not support SQL; from what I understand.
Any guidance?

I would go the SQL way, but one of the databases is a System/38 and does not support SQL; from what I understand.
Any guidance?
Code:
D DateISO S D
D year S 4S 0
D month S 2S 0
D CurrentTS S 7S 0
D PastTS S 7S 0
/free
//Getting date from system and doing some parsing
DateIso = %Date();
year = %SubDt(DateISO: *y);
month = %SubDt(DateISO: *M);
//Formatting current timestamp for query
CurrentTS = %dec(DateISO:*cyMD);
//Formatting past timestamp for query
PastTS = %subst(CurrentTS:5:0) + '01';
//PastTS should look like '1121201'
// CYYMMDD
*INLR = *On;
/end-free



Comment