USER command questions
John Esak
john at valar.com
Fri Sep 11 02:33:12 PDT 2009
Well, since you used the archaic and essentially useless... If not just
plain difficult NEXTDIR() instead of the dead-easy method of accessing the
@dirlist arrays... I'm thinking I cannot help you much anymore. To consider
using "user" and mv or cp is not even on the map for doing what you want to
do. Aside from the simple fact that you would have to make hundreds of
system calls just to open and read a directory with hundreds of files in
it... When opendir()fills those arrays in one shot. Well, go for it if you
still feel that is the way to go.
Yes, you can moan and groan about not knowing the commands for filePro
because of its terrible documentation. But, I could list hundreds of other
programs with far less utility and far worse docs. I'm not into arguing
with you for arguing sake. I could teach you how to use the USER command
and what it might be good for... But I think it might stay in this kind of
murky complaint mode rather than being of value to the readers here, so I'll
let somebody else take on that task.
As I said before... Good luck. You actually will need it. In fact, that is
not much more than any of us had in learning the vagueries of programming in
all those decades you mention. Luck, perseverance, not putting down the
people who wrote the program and the docs for the product you are asking
about... All that usually helps.
Incidentally, I did read your code, but it is so off the mark for what you
want to do, I passed over it pretty quickly. Someone else may chirp up and
want to work on that for you. I am of the opinion that you can't make a
silk purse out of a sow's ear. Plus, unless you add a few ifdef lines and
some better pathing, you will be locked to *nix... No portability to
Windows... Of course, you may not need that. However, all the code I've
written in filePro for the past several years has been usable on any
platform. This, and speed is why I always choose the filePro version of a
function before ever considering some O/S utility. And in that vein, you
don't need the chdir in your code. Superfluous.
I will give you one credit though. It really is far and away the very best
advice I could give you. You are right about one of your complaints. I
wrote a complete, topic based index for the first online manual. It grouped
everything available in filePro by the function you wanted to accomplish.
All the screen commands like DISPLAY, MESGBOX, SCREEN, SHOW, etc. were
grouped under SCREEN I/O, all the file based functions like LOOKUP, EXPORT,
IMPORT, OPEN, CLOSE, etc., were grouped under that term. Everything about
PRINTING under that... Each applicable filePro command no matter how it fell
in the alphabet would be under the right category. There was a category for
everything you might want to do when programming filePro, and you did not
need to *know* the name of the command to find it. You complain that you
didn't know about OPENDIR() and you are right, there is no way to find
something alphabetically when you don't know what it is you are looking for.
Why the owners of filePro at the time *removed* that incredibly valuable
page-numbered category index is beyond me. It took me nearly 6 solid months
to compile it and add the missing examples as I went about translating the
paper manuals into Robohelp format for the web and other uses. Excising that
terrific section of the new manual was a huge loss for the community. I
will never understand why that was done.
Now, the only thing like it, and actually better is the thoroughly indexed
interactive movies found on the survivor Series CD's. Commands are grouped
by the category method just described and when you see a list of entries for
a topic, you click on it and a movie fully demonstrating the function with
step by step example code is shown in Windows Media Player. Most people
think it is light years ahead of the STN paper reference. And really, it
is. I may be touting my horn a bit... But don't care anymore. It took me
two years to write that set of CD'. Hundreds of them sold, and I believe
many more still will. It goes from Beginner through Advanced (to Expert)
with every movie (thousands of them) marked as to what level they are.
I'm doubting you would be interested. However, if you had the Survivor
Series loaded on a PC near you, you could have typed in something like
"directory" or any number of other keywords, and the system would have
prompted you to put in the correct CD (1 through 3) and then immediately let
you pick from several video presentations of how to use opendir()... Oh how
funny... One of the uses in there is to perform a copy operation on all the
files in one folder. Well, again you see we agree on that all important
precept. Having and knowing the right tools is the best way to proceed.
Good luck
John
Should you want to see a good demo of the Survivor Series CD's. They are
well described at www.valar.com/survivor_series
If you are using Vista and the first page doesn't "talk"... Just move ahead
and click continue. I don't know what Vista is doing there... But I'll check
it out some time when I have some of that very commodity, time.
> -----Original Message-----
> From: Tyler Style [mailto:tyler.style at gmail.com]
> Sent: Friday, September 11, 2009 1:01 AM
> To: john at valar.com
> Cc: filepro-list at lists.celestial.com
> Subject: Re: USER command questions
>
> John Esak wrote:
> > You sound frustrated at filePro for not being able to do something
> > simple. You haven't taken the time to find out how this should be
> > done. I suppose it is admirable that you at least tried
> something you
> > thought might work. However, when it didn't work, your
> bashing about
> > on filePro is disheartening.
> You're jumping to conclusions assuming this is the only thing I've
> tried. And to answer the obvious question, no, I didn't feel it
> necessary to list all the things I tried and didn't work,
> especially if
> the documentation I have indicates that they SHOULDN'T work.
>
> My frustration is perhaps more properly aimed at the documentation.
> Nonetheless, most people would consider the product and the
> documentation as one and the same, as the product is only as good as
> it's documentation. It doesn't matter if a program can solve world
> hunger with just two commands written in 3 seconds if you
> aren't aware
> of the command at all, or the documentation is inaccurate or
> too vague
> to understand.
> > When you want to open a directory (folder) and do something
> to each of
> > the files you find therein, use the "opendir() function.
> Actually, I don't want an alternative for opening a
> directory. USER ls
> is working beautifully for that. If you read the original post, I'm
> asking for help with USER and the unix mv command. But let's address
> the OPENDIR vs. USER issue anyway.
>
> I actually tried OPENDIR first. I couldn't get it to read in
> anything -
> all I got back was nulls. After reading the STN dev ref and
> online docs
> several times, I found this:
> "It returns the number of files in a filePro directory that meet the
> criteria."
>
> So...what the heck is a filePro directory in this context?
> The online
> docs do in fact list this in the contents and index.
> Unfortunately it's
> "FilePro Directory - Option ?". Totally off topic. How about
> "glossary?" That should work! Nope, content's entry doesn't have it
> listed, and the index entry leads to "Introduction To fileProODBC".
> Searches also turn up nothing obviously useful. Google of
> course brings
> back nada.
>
> So I decided that this must mean something within the filepro
> directory
> structure. Lots of other places refer to filePro
> directories, which are
> always the filePro file directories. Since the directory I want to
> examine is outside of that, I decided that the command had some
> arbitrary limit on what it could read.
> > It has some special masks to show you only the specified filePro
> > format types of screens outputs, etc. But, its real value is just
> > specifying some wildcard to retrieve only the exact files
> you want.
> > You could specify "*" and get every file in a directory (in
> which case
> > you will also get the . and .. entrires, so you have to be aware of
> > this and skip over them with a test. But essentially, to use
> > opendir() you do it like this:
> >
> > then: declare num_files(4,.0), cnt(4,.0); cnt="1"
> > then: num_files=opendir("*","/tmp/path/to/dir")
> The online docs show that the second argument is a filepro file
> filename, not a general filepath as in your example:
> "N = opendir("SCR_MASK", "fpcust") Creates a list of all
> screens for the fpcust file."
>
> When I tried it, I used this (derived from the dev ref):
> DECLARE filepath(128,*); filepath='/public/mailerLists/Prospect'
> CHDIR filepath;
> opendir("*.csv")
>
> There is no formal definition of the second parameter beyond
> that. So
> the documentation would lead one to believe this is a bad choice.
> > So, you will be saying something like the following. It will be
> > somewhat stylized, I haven't looked closely at your code, and don't
> > have time to code exadctly what you need... but you can modify the
> > code I"ll write now in about 3 minutes to do just what you
> need done.
> > Here I go, I'm timing myself....
> >
> > <GET_TIME>
> >
> > then: declare num_files(4,.0), num_files(4,.0); cnt="1"
> > then: num_files=opendir("*","/some/path/to/a/folder")
> > loop if: cnt gt num_files
> > then: num_files=closedir(); return (or go somewher else)
> > if: @dirlist_filename[..] eq "." or @dirlist_filename
> > [cnt] eq ".."
> > then: cnt=cnt + "1"; goto loop
> > if: @dirlist_filename[cnt] eq "something you
> want" to move"
> > then: declare SysCmd; SysCmd="mv" <
> > @dirlist_filename[cnt] the_other_place_and_name { ""
> > then: system SysCmd
> > then: cnt=cnt + "1"; goto loop
> >
> > </GET_TIME> Just about 1 minute 30 seconds.
> > So, you see, it is not so difficult to do a simple job in
> filePro if
> you use the right tool.
>
> Provided, of course, that you have decades of experience, you know in
> advance all of the commands and their undocumented features,
> and don't
> have to rely on the online manual or the dev ref. In which
> case, yes,
> it is not so difficult!
> >
> > Good luck,
> >
> > John Esak
> Thank you. I did try your variation out, and OPENDIR does
> work as you
> describe - huzzah! Here's the test code:
>
> ::DECLARE filepath(128,*):
> ::DECLARE filename(32,*):
> :':':
> ::filepath="/public/mailerListsSent/Prospects/":
> :':':
> ::'CHDIR filepath:
> ::i=OPENDIR("*.csv", filepath);:
> loop01s::filename=NEXTDIR():
> :filename eq "":goto loop01e:
> ::msgbox filename:
> loop01n::goto loop01s:
> loop01e:::
>
> Unfortunately, while interesting, none of this addresses why
> the mv and
> cp commands don't work with USER.
>
> Other than the original example I've also tried USER move=
> filepath{filename<filepath{"imported/"{filename and other variants
> trying to get it to work properly. Still no dice. Any ideas?
>
> Tyler Style
>
More information about the Filepro-list
mailing list