× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Luis,

Well I've already started my work, let's see what you think of it so far.

Essentially what I'm doing right now is coming up with a way to search for files. There is no deleting going on in this procedure.

When the procedure is called, it Declares and Opens a SQL Cursor immediately. This means, if memory serves, that the file is read at that one point in time. Later when I'm fetching, I'm working with a result set that's already in memory.

(I'm going to call the procedures via CL, but for ease of typing here...) it's something like:
FuzzyName = '*FileA'; // (or '%FileA' - the procedure will replace * with %)
FileAttr = 'PF'; // optional
Lib = 'MYLIB'; //optional
$FindFile( INIT: *omit: FileName: Lib: FileAttr );

DoW Found;
FilePath = $FindFile( FIND: Found ); // This will return a file from the last fetch in the loop, or issue a new fetch if required
// - do whatever you need to do with the filepath here.
EndDo;

$FindFile( CLOSE );

It doesn't give you a list of files to refer back to, but you could easily create a report of all the files processed.

-Kurt


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Luis Rodriguez
Sent: Wednesday, August 17, 2011 3:08 PM
To: Midrange Systems Technical Discussion
Subject: Re: Batch Finding Files using Wildcards

Kurt,

There are some issues to consider: Do your files have LFs dependent on them?
Also, if you read QSYS/QADBXREF directly, a new file could appear later on your program, so you must be careful not to delete it.

Maybe you could consider doing first a list of your files, with DSPFD, something like:
DSPFD FILE(*ALLUSR/*ALL)
TYPE(*BASATR)
OUTPUT(*OUTFILE)
FILEATR(*PF)
OUTFILE(MYLIB/FILELIST)

That way, you would have the "original" list of tables, just in case something went wrong (you did not forgot to backup beforehand , did you? :-)

Then, just before your RCVF in your CL, you could do a OPNQRYF, something
like:
OPNQRYF FILE((QTEMP/FILELIST)) QRYSLT('atfile *ct ''%FILEA%''')

HTH,



Luis Rodriguez
IBM Certified Systems Expert - eServer i5 iSeries
--



On Wed, Aug 17, 2011 at 3:04 PM, Kurt Anderson <kurt.anderson@xxxxxxxxxxxxxx
wrote:

Looks like I'll give using QSYS/QADBXREF a try.

-Kurt

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:
midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Kurt Anderson
Sent: Wednesday, August 17, 2011 2:17 PM
To: 'Midrange Systems Technical Discussion' (midrange-l@xxxxxxxxxxxx)
Subject: Batch Finding Files using Wildcards

We have a number of files that we have copies of saved with a prefix to it.
For example:
FILEA, FILEB
ABCFILEA, ABCFILEB
XXXFILEA, XXXFILEB

This is the case across multiple libraries, and the prefixes can be
virtually anything, although I know it's always 3 long.

What I'd like to do is something like:
WRKOBJPDM LIB(MYLIB) OBJ(*FILEA) OBJTYPE(*FILE) However this isn't
allowed in batch mode.

I have a CL program that is going to spin through our libraries to
work with these files. What I will be doing with these files is
probably renaming them, creating a new file with the same name, and
copy map/dropping the data back in then deleting the old file.

Can anyone point me in the right direction?

Thanks,
Kurt Anderson
Sr. Programmer/Analyst
CustomCall Data Systems


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.