How To Get System Date In Cl Program

/ Comments off

CL program to Convert dates into any date format(Julian,YMD,DMY,YYMD,Long Julian,...)

How do I get time using CL. I am trying to capture system time when I run a routine. I need this value to finally be in character form. Hi I wrote this program to retain system date, I am sending it to this forum because someone may need it during the year end. Schedule a job using ADDJOBSCDE command with schedule time 00:00:01 calling this CL program.

PGM PARM(&Indate &Outdate &FmtF &FmtT)
/* assuming you want to convert MMDDYYYY into a Julian date, but the length of the variables could varied */

DCL Var(&Indate) Type(*Char) Len(8)
DCL Var(&Outdate) Type(*Char)Len(7)
DCL Var(FmtF) Type(*Char)Len(5)

How To Get System Date In Java

DCL Var(FmtT) Type(*Char) Len(4)

/* You can avoid logging cl command calls by using the following */ CHGJOB LOG(1 20) LOGCLPGM(*NO)

/* Use the CL command CVTDAT */
CVTDAT DATE(&Indate) TOVAR(&OutDate) FROMFMT(&FmtF) TOFMT(&FmtT)
TOSEP(*NONE)

/* Monitoring wrong dates */
MONMSG MSGID(CPF0555) EXEC(CHGVAR VAR(&OutDate) VALUE('0000000'))

RETURN

How To Get System Date In Cl ProgramHow To Get System Date In Cl Program

ENDPGM

How To Get System Date In Cl Program