CL command for Timestamp

CL command for Timestamp
CL command for Timestamp
CL command for Timestamp

Sometimes there were the need of fetching the current system timestamp in the CLLE program. So, the question here is that is there any command in the CL that can give me the current system timestamp.

So, the answer here is Yes, you can very easily get the system timestamp in your CL program by just using the below CL script

             DCL        VAR(&TIMESTAMP) TYPE(*CHAR) LEN(20)    
  • Here, we declared one variable named &TIMESTAMP of type character and length 20 to receive the current system timestamp.
  • Use the command RTVSYSVAL to retrieve the System date and time in variable &TIMESTAMP.

  • QDATETIME is a system value that stores system date and time as a single value.
  • The format of this system value is: YYYYMMDDHHNNSSXXXXXX where YYYY is the year, MM is the month, DD is the day, HH is the hours, NN is the minutes, SS is the seconds, and XXXXXX is the microseconds.
  • Post a Comment

    © AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain