How To Get System Date In Cl Program
Posted admin
Is there a CL command to get the system timestamp? CL command for timestamp No.You get rtvsysval qtime and qdate and do a bunch of. System date and time.
- Apr 16, 2008. Do date manipulation in a CL program, and retrieving the system date. Date format that you wish, in this case, we have used YYYYMMDD.
- Semantics of UDATE and *DATE in IBM. Both reserved words retrieve the job date rather than the system date. Suppose the CL program includes a DLYJOB command.
For example,
I want to get the previous month from system value Qmonth, assuming current month is JULY 2004, so my expected result will be JUNE 2004.
And I also may want to get the value of last few months from system value Qmonth.
For example,
I want to get the value in past 3 months, assuming current month is JAN 2005, my expected result will be DEC 2004, NAV 2004 and OCT 2004.
I tried to create the CL program, but it's very hard to do it bacause I need to create many variables in order to archive it. And also have to take care of the program logic when the month is 1st few months of the year if I want to get the month values of past Qmonth.
Hope any expert in CL programming can give me some guidance, thank you very much. I am trying to capture system time when I run a routine. I need this value to finally be in character form. I have some of the code below but it is not working (CTIME is character type). What is correct way of acquiring a character time.
DCL VAR(&HOUR) TYPE(*CHAR) LEN(6)
DCL VAR(&MIN) TYPE(*DEC) LEN(6)
DCL VAR(&SEC) TYPE(*DEC) LEN(6)
DCL VAR(&TIME) TYPE(*CHAR) LEN(6)
DCL VAR(&CTIME) TYPE(*CHAR) LEN(6) /*CHAR TIME*/
DCL VAR(&DTIME) TYPE(*CHAR) LEN(6) /*DEC TIME*/
RTVSYSVAL SYSVAL(QTIME) RTNVAR(&TIME)
/* CONVERT TIME */
CHGVAR VAR(&HOUR) VALUE(%SST(&TIME 1 2))
CHGVAR VAR(&MIN) VALUE(%SST(&TIME 3 2))
How To Get System Date In Sql Server
CHGVAR VAR(&SEC) VALUE(%SST(&TIME 5 2))How To Get System Date In Cl Program
CHGVAR VAR(&CTIME) VALUE('(&SEC) + (&MIN * 60) + +
(&HOUR * 3600)')
thanks