Find T format discriptor

I have a discriptor with T format, I want to Find or Read all records with given date. How can I convert date to T format to find all records on that specific date?

Regards,

ASLAM

Here is a program which demonstrates one way to do this:

DEFINE DATA LOCAL
1 #DATE (A8) INIT <‘02142000’>
1 #TIME (T)
END-DEFINE
*
MOVE EDITED #DATE TO #TIME (EM=MMDDYYYY)
WRITE #TIME (EM=MMDDYYYYHH)
ADD 50000 TO #TIME
WRITE #TIME (EM=MMDDYYYY
HH)
END

In other words, do a MOVE EDITED of your alpha date (I am assuming an alpha date such as MMDDYYYY) to a Time variable.

The Time variable will then be the start of the specified date.

You could then do a READ by the Time variable starting from #TIME.

For every returned Time, use a MOVE EDITED to create the date (in a BEFORE BREAK clause) then do an AT BREAK of the date variable.

Alternatively, compute the number of tenths of seconds (unit for Time) for a day, and have something like IF #DATE2 - #DATE1 GT #NUMBER OF TENTHS.

steve

If you are specifying the time manually in an ad hoc program or via an INPUT statement, rather than converting an alpha value from some external source, then you can use time literals, which are much easier than computing tenths of seconds.

Here’s a sample program which shows how to use a system variable (*TIMX) or an extended-time literal (E format) to initialize a time variable (T format).

[code]
DEFINE DATA LOCAL
1 #T (T) INIT /* NB the leading asterisk was removed by the Forum
END-DEFINE
ASSIGN #T = E’08/25/2008 14:35:50’
REPEAT
INPUT ‘Time:’ #T (EM=MM/DD/YYYY

My example: Read/Find all records created on 2008-08-25

define data local
1 file1 view of SOME-DDM
2 creation-time (EM=YYYY-MM-DD^HH:II:SS.T)
*
1 #date  (D) init <D'2008-08-25'>
1 #date2 (D)
end-define
*
#date2 := #date + 1
*
read file1 by timestamp starting from #date ending at #date
  display file1
end-read
*
skip 1
*
find file1 with timestamp = #date thru #date2 but not #date2
  display file1
end-find
end

Thanks Steve, it worked… :smiley:

Thanks to Ralph and Matthias also.

KAZI