 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Raymundo Perez Guest
|
Posted: Tue Feb 10, 2004 6:25 pm Post subject: Last Modifyed Timestamp |
|
|
How can i pul;l information from as/400 when the table was last time
modified?
Is there any system table there this data is stored or i can use Stored
Procedure of somkind ?
|
|
| Back to top |
|
 |
99pkc99 Guest
|
Posted: Mon Mar 01, 2004 11:29 am Post subject: Re: Last Modifyed Timestamp |
|
|
Raymundo Perez wrote:
| Quote: | How can i pul;l information from as/400 when the table was last time
modified?
Is there any system table there this data is stored or i can use Stored
Procedure of somkind ?
|
I use this stored procedure. It's not very optimized but it works..
create procedure LASTUSED (in LIB VARCHAR(10), in TAB VARCHAR(10), out
res TIMESTAMP)
LANGUAGE SQL
BEGIN
/* declare work field */
DECLARE TMPCMD VARCHAR(100);
DECLARE L NUMERIC(15,5);
DECLARE CENT CHAR(1);
DECLARE DT CHAR(6);
DECLARE TM CHAR(6);
declare MYDT varchar(14);
/* create a temporary file in QTemp with file description */
/* using operating system command */
set TMPCMD ='DSPFD FILE('||LIB||'/'||TAB||') TYPE(*MBR)
OUTPUT(*OUTFILE) OUTFILE(QTEMP/FFD)';
SET L = CHAR_LENGTH(TMPCMD);
CALL QSYS.QCMDEXC(TMPCMD,L);
/* read from temp file the last change date */
SELECT MBCHGC,MBCHGd, MBCHGT INTO CENT,DT,TM FROM QTEMP.FFD;
/* adjustment for century handling */
IF CENT = '1' THEN SET MYDT = '20'||DT||tm;
ELSE SET MYDT = '19'||DT||tm;
end if;
/* convert to timestamp */
set res = timestamp(MYDT);
/* temp file should be automatically deleted at end of procedure */
END
Marco
try my free As400Expert http://dartclub.tripod.com/as400expert.htm
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|