RATE THIS ANSWER
0
Click to Vote:
0
0
Assuming you're using RPG, use the TIME opcode to get the current date and/or time. You are correct in that UDATE gives the session date, and not the system date.
Rick
========================================================
A date field can be initialized to the current system date. This is not the same as the "job date" that is available through UDATE or *DATE. The INZ(*SYS) initialization brings system date into the variable. Example:
h dftactgrp( *NO )
h actgrp( *CALLER )
h debug
d curDate s d inz( *sys )
d ctr s 5i 0 inz( 0 )
/free
curDate = d'2009-10-01' ;
for ctr = 1 to 16 by 5 ;
reset curDate ;
curDate += %days( ctr ) ;
endfor ;
eval *inlr = *on ;
return ;
/end-free
Run that example in debug to watch how curDate changes. It initializes to system date when the program starts. The first executeable statement sets curDate to '2009-10-01'. In the FOR-loop, the RESET operation sets curDate to its initialization value -- the system date again.
The curDate is incremented by a duration based on the loop counter which counts by five. Each time through, curDate is reinitialized before being incremented by larger and larger values.
RESET is one simple way to set date fields to system date.
Tom
Last Answered:
Oct 30 2009 5:29 AM GMT by TomLiotta 
7560 pts.
Latest Contributors: RickMe
15 pts.