Karen,

 

I've been offline a couple days so I missed this discussion.  Here's what we
do and how you could make it work for you:

 

1.       In a stored procedure create a temporary table with the proper
layout.  We use longfn for the table name, and it is constructed to match
the display at the R> when SHORTNAME is OFF.

2.       The SP then creates a temporary filename using (FILENAME(0)) and
does an OUTPUT to that filename.

3.       A variable is constructed with 'DIR' followed by the filename mask
you want to retrieve.  This mask is the parameter passed to the stored
procedure.  The variable command is executed.

4.       After an OUTPUT SCREEN the SP LOADs the temporary table from the
temporary file AS FORMATTED USING the appropriate parameters to place each
component into the proper column.

5.       There will be some irrelevant rows, so the SP DELETEs ROWS FROM ..
where the filename is null or a blank, or the file size is null.

6.       The SP converts the AM/PM times into 24-hour format.

7.       The SP cleans up the temp file and returns to the calling program.


 

The calling program then sees only the results you want.  If you have set up
your mask with a drive/path before the filename, you'll only see the file
names themselves, not the full path.

 

Here is the table structure:

 

CREATE TEMPORARY TABLE filen128 (filedate DATE,filetime TIME,ampm TEXT
(2),filesize INTEGER,longfn128 TEXT (128))

 

The LOAD command is:

 

LOAD filen128 FROM tempfilename AS FORMMATTED USING filedate 1 10,filetime
13 17,ampm 19 20,filesize 28 40,longfn128 42 169

 

Of course the SP checks the state of SHORTNAME, saves it, set it to ON, then
restores the state upon exit.  The RETURN value from the SP is the number of
rows on the temp table.  It is up to the calling program to DROP the temp
table when it is finished with it.

 

Now, in  your case, you could do an ALTER TABLE filen128 ADD COLUMN
revno=(formula to strip off the first part of the file name and convert it
to an integer) INTEGER, then SELECT MAX(revno) from the table.

 

Using the R> DIR command between OUTPUT commands, the user sees nothing at
all.

 

Emmitt Dove

Converting Systems Architect

Evergreen Packaging, Inc.

[email protected]

(203) 214-5683 m

(203) 643-8022 o

(203) 643-8086 f

[email protected]

 

From: [email protected] [mailto:[email protected]] On Behalf Of
[email protected]
Sent: Wednesday, February 09, 2011 10:54
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Getting a file from a directory

 

You and I are on the same track!  In that same email to him, I had asked
whether there could be >1 file for the same part with different revision#s,
and if so should I count backwards.   There are thousands of files and a
quick glance didn't show duplicates, but figured I should ask him.  

Karen





In the event that there may an older revision in the same directory, does it
make more sense to count _backwards_ and show only the highest revision
number?

--
Larry

 

Reply via email to