IBMi (AS400) fans only : How to get today's date from CL (Control Language)
#IBMiSample
This example gets todays date in format YYMMDD without separators.
With simple changes you get other formats.
PGM
DCL VAR(&DATE) TYPE(*CHAR) LEN(6)
RTVSYSVAL SYSVAL(QDATE) RTNVAR(&DATE)
CVTDAT DATE(&DATE) TOVAR(&DATE) FROMFMT(*MDY)
TOFMT(*YMD) TOSEP(*NONE)
SNDPGMMSG MSG(&DATE)
ENDPGM
If you want the power of db2 date format or calculations you can write a view with the necessary fields and retrieve this in clle. https://github.com/prsbrc/Miscellaneous/tree/master/Receive%20view%20in%20cl%20example
ReplyDeleteThank you for your great contribution!
DeleteIt strikes me as funny that QDATE is stored as MDY - am I correct in thinking that the USA is the only country in the world that uses this format?
ReplyDelete