Here's a V5R2 RPG IV program that converts a numeric date in *YMD
format to a numeric date in *JUL format:
----------------------------------------------------
D date s 6p 0 inz(020711)
/free
date = %dec(%char(%date(date:*ymd):*jul0):6:0);
dsply date;
*inlr = *on;
/end-free
-----------------------------------------------------
The %DATE() built-in converts the numeric date to a data data type.
The next %CHAR() built-in converts the date to character data type
with the date in julian format. Finally, the %DEC() built-in
converts the date back to numeric type. That last step is new for
V5R2. In previous releases, you can use C run-time library function
"atol()" instead, but this also requires you to code a procedure
prototype for "atol()", as well as BNDDIR(QC2LE) on the H-Spec.
(You could probably also do this with a couple of MOVE opcodes, if
you're so inclined.)
Cheers! Hans