Question

  Asked: May 16 2008   7:47 PM GMT
  Asked by: Bigdog55


Timestamps


RPG, Timestamp, D specs

I wish to:
1.) define a timestamp and initialize it to system date/time. What odes the D spec look like for this or can it not be done in the D spec?
2.)Load a data structure whihc is formatted to match timestamp defaults with data by field (CCYY MM DD...etc,).

I want to then 3.)

Move this data to another variable that is defined as a timestamp and do a SUBDUR using the two timestamp fields.

HELP!!!!

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0




dTimStmpSys s z inz(*sys)

dMyDS ds
d CCYY 4
d MM 2
d DD 2
d HH 2
d MI 2
d SS 2
d MS 6

dTimStmpLcl s z
dDays s 10i 0

/free
CCYY = '2008';
MM = '04';
DD = '01';
HH = '10';
MI = '30';
SS = '00';
MS = '000000';

TimStmpLcl = %timestamp(MyDS :*ISO0);

// Jump out of free as SUBDUR is fixed form only...
/end-free

c TimStmpSys subdur TimStmpLcl Days:*D
c Days dsply

c move '1' *inlr
c return


Bruce
  • AddThis Social Bookmark Button

Browse more Questions and Answers on AS/400 and Database.

Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Cwc  |   May 19 2008  8:06PM GMT

Here is an alternative to using SUBDUR, since it’s not supported in /Free, and you wouldn’t have to jump out in order to get the desired result.

Days = %Abs( %Diff(TimStmpSys: TimStmpLcl: *Days) ) ;
DSPLY Days ;
*InLr = *On ;