Jan 9 2009 5:10PM GMT
Posted by: David Vasta
CL Programming, Code Snippets
CL - Convert a date to julian in CLP
Posted by: David Vasta
Convert a date to julian in CLP
Posted By: Jamie Flanary
CODE:
-
PGM
-
DCL &DATE6 *CHAR LEN(6)
-
DCL &DATE5 *CHAR LEN(5)
-
RTVSYSVAL QDATE RTNVAR(&DATE6)
-
CVTDAT DATE(&DATE6) TOVAR(&DATE5) TOFMT(*JUL) TOSEP(*NONE)
-
ADDPFM LIB1/FILEX MBR(’MBR’ *CAT &DATE5)
-
.
-
.
-
.
-
ENDPGM
-
-
or use a c function
-
-
The following is an alternative program that uses the ILE bindable API, Get
-
Current Local Time (CEELOCT), to convert a date to Julian format. To create this
-
program, you must use the CRTBNDCL command alone or the CRTCLMOD
-
command and the CRTPGM command together.
-
PGM
-
DCL &LILDATE *CHAR LEN(4)
-
DCL &PICTSTR *CHAR LEN(5) VALUE(YYDDD)
-
DCL &JULDATE *CHAR LEN(5)
-
DCL &SECONDS *CHAR 8 /* Seconds from CEELOCT */
-
DCL &GREG *CHAR 23 /* Gregorian date from CEELOCT */
-
/* */
-
CALLPRC PRC(CEELOCT) /* Get current date and time */ +
-
PARMS (&LILDATE) /* Date in Lilian format */ +
-
&SECONDS /* Seconds field will not be used */
-
&GREG /* Gregorian field will not be used */
-
*OMIT /* Omit feedback parameter so exceptions +
-
are signalled */
-
-
CALLPRC PRC(CEEDATE) +
-
PARMS (&LILDATE) /* Today’s date */ +
-
&PICTSTR /* How to format */ +
-
&JULDATE /* Julian date */ +
-
*OMIT
-
-
ADDPGM LIB1/FILEX MBR(’MBR’ *CAT &JULDATE’)
-
ENDPGM



You must be logged-in to post a comment. Log-in/Register