I need to calculate the first date of the current month and the first date of the previous month. I also need to display the previous month and year in the header. I have the first date of each month working but I would like the date in the header to be mixed case.
Here is my code:
-SET &START_DATE = &YYMD;
-SET &END_DATE = &YYMD;
-SET &DAY = EDIT(&YYMD, '$$$$$$99');
-SET &END_DATE = DATEADD(&END_DATE,'D',-&DAY+1);
-SET &START_DATE = DATEADD(DATECVT(&END_DATE, 'I8YYMD', 'YYMD'),'M',-1);
-SET &START_DATE = DATECVT(&START_DATE, 'YYMD', 'I8YYMD');
-SET &START_DISP = CHGDAT('YYMD', 'MYYX', &START_DATE, 'A17');
The &START_DISP uses MYYX to get long months but they come out in upper case only.
Is this the best way to do this type of calculation? I need it in a seperate fex that other fexes can include.
|<Pietro De Santis>|
Use the LCWORD function:
-SET &RUN_DATEX = CHGDAT('YYMD', 'MXDYY', &YYMD, 'A17');
-SET &RUN_DATE = LCWORD(&RUN_DATEX.LENGTH, &RUN_DATEX, 'A17');This message has been edited. Last edited by: <Mabel>,
Way Cool ! Exactly what I was looking for.
Another way is as follows:
TRD/I8 = &TRDATE ;
TRDTA/I8YYMD = TRD ;
This will give 11 Jun 2004 in TRDTS.
|Powered by Social Strata|