Question Check of when 4GL table got last updated

sgd123

New Member
I would like to know when a 4GL table got last updated. I was checking the _file table fields wherein there is one field named _last-change. I think this could give me the required information. But when I query to the existing code_mstr table I updated today (1-Sept-2014), the _last-change field displays an integer data. Anybody knows how to read this field and whether this is the right field which can give required last updated details. Thanks for your replies.

for each _file no-lock where _file-name ="code_mstr".
disp _file-number _file-name _last-change.
end.

┌─────────────────────────────────────────────────────────┐
│File-Number File-Name _Last-change│
│─────────── ──────────────────────────────── ────────────│
│ 28 code_mstr 1106323076│
│ │
│ │
 

tamhas

ProgressTalk.com Sponsor
If schema, try this from Dmitri Levin on PEG
Code:
/* _Last-change.p
* 10/06/2006 Dmitri
*/
DEFINE VARIABLE dtDate AS DATE NO-UNDO.
DEFINE VARIABLE iTime AS INTEGER NO-UNDO.
DEFINE VARIABLE iMillis AS INTEGER NO-UNDO.
for each _file where not _hidden  no-lock
  by _File._Last-change desc:
  RUN convertUnixTimestamp
      (INPUT _File._Last-change,
       OUTPUT dtDate,
       OUTPUT iTime).

  display _file-name dtDate STRING(iTime, "HH:MM:SS") "UTC":U.
end.

PROCEDURE convertUnixTimestamp:
  DEFINE INPUT PARAMETER pdTimestamp AS DECIMAL NO-UNDO.
  DEFINE OUTPUT PARAMETER pdtDate AS DATE NO-UNDO.
  DEFINE OUTPUT PARAMETER piTime AS INTEGER NO-UNDO.
  /* Seconds per day */
  DEFINE VARIABLE iSPD AS INTEGER NO-UNDO.
  /* Seconds per year */
  DEFINE VARIABLE iSPY AS INTEGER NO-UNDO.
  /* Variables to hold our calculation so far */
  DEFINE VARIABLE iYear AS INTEGER NO-UNDO.
  DEFINE VARIABLE iDay AS INTEGER NO-UNDO.
  DEFINE VARIABLE iSecsLeft AS INTEGER NO-UNDO.
  ASSIGN
    iSPD = 60 * 60 * 24
    iSPY = iSPD * 365
    /* Since it is impossible to have 365 or more leap years since
    ** 1970 this following calculation will always work and always
    ** come up with a correct year.
    */
    iYear = INTEGER(TRUNCATE (pdTimestamp / iSPY, 0))
    /* Calculate the number of seconds that have elapsed in the
    ** current year so far.
    */
    iSecsLeft = INTEGER(pdTimeStamp - (iYear * iSPY))
    .
/* Now we have to adjust the seconds left in the current year for the number of~
Feb 29th days that have elapsed since 1970, excluding the one in the current y~
ear, which will be handled further below.
*/
  /* How many leapyears since 1970? 1972 is the first one. */
  IF iYear > 2 THEN DO:
    DEFINE VARIABLE iLeapDays AS INTEGER NO-UNDO.
    ASSIGN /* subtract 3 from year to get relative to 1973 */
    /* 1973 = 1, 1977 = 2, etc. */
    /* We don't include the current year in this */
    iLeapDays = INTEGER(TRUNCATE((iYear - 3) / 4, 0)) + 1
    iSecsLeft = iSecsLeft - (iLeapDays * iSPD).
  END.

  /* Now the year and seconds since the beginning of the year are accurate
  */
  ASSIGN iDay = INTEGER(TRUNCATE(iSecsLeft / iSPD, 0))
  /* Now the year and day are in julian format (almost). */
  /* Julian would have year 2000 as "00", but we have "30". */
  /* If the current year is a leap year this is handled here. */
  /* DATE math allows us to add days to a date - add to Jan 1. */
  pdtDate = DATE('01/01/':U + STRING(iYear + 1970)) + iDay
  /* The number os seconds since midnight of the date above */
  piTime = iSecsLeft - (iDay * iSPD)
  .
END PROCEDURE. /* convertUnixTimestamp */
 
Top