BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Last Modifyed Timestamp

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi As400
View previous topic :: View next topic  
Author Message
Raymundo Perez
Guest





PostPosted: Tue Feb 10, 2004 6:25 pm    Post subject: Last Modifyed Timestamp Reply with 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 ?


Back to top
99pkc99
Guest





PostPosted: Mon Mar 01, 2004 11:29 am    Post subject: Re: Last Modifyed Timestamp Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi As400 All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.