Suggestions for "User" command.

Dave Snyder dave at wisvis.com
Thu Mar 3 09:19:19 PST 2011


 ----- Original Message -----
 | From: "Brian K. White" <brian at aljex.com>
 | To: filepro-list at lists.celestial.com
 | Sent: Wednesday, March 2, 2011 6:16:28 PM
 | Subject: Re: Fwd: Suggestions for "User" command.
 | On 3/2/2011 5:09 PM, Dave Snyder wrote:
 | > ----- Forwarded Message -----
 | > | From: "Dave Snyder"<dave at wisvis.com>
 | > | To: "Kenneth Brody"<kenbrody at spamcop.net>
 | > | Sent: Wednesday, March 2, 2011 4:01:00 PM
 | > | Subject: Re: Suggestions for "User" command.
 | > | ----- Original Message -----
 | > | | From: "Kenneth Brody"<kenbrody at spamcop.net>
 | > | | To: "Dave Snyder"<dave at wisvis.com>
 | > | | Cc: filepro-list at lists.celestial.com
 | > | | Sent: Wednesday, March 2, 2011 3:44:46 PM
 | > | | Subject: Re: Suggestions for "User" command.
 | > | | On 3/2/2011 4:33 PM, Dave Snyder wrote:
 | > | | [... Exiting a USER command ...]
 | > | |>
 | > | |>  Anyone have any brilliant ideas for ending the external
 | > | |>  program
 | > | |>  besides my @keyX solution.
 | > | | [...]
 | > | |
 | > | | Yes. When your program receives EOF on stdin, exit. No need
 | > | | for
 | > | | any
 | > | | special "I need to tell the USER program that I'm exiting"
 | > | | logic.
 | > | |
 | > | | --
 | > | | Kenneth Brody
 | >
 | >
 | > I understand. But when I get to the next record (remember that I'm
 | > in
 | > *clerk) and try to use the external program, I have a problem. I
 | > originally
 | > thought that the
 | >
 | > if not program
 | > then user program = /appl/bin/ext-prog
 | >
 | > logic would just start the external script again, but that doesn't
 | > seem to be the case.
 |
 | I use user in a only a few, but very frequently and heavily used
 | routines and I don't have special exit logic in the user command
 | other
 | than what Ken said, nor do I ever close aliasname, nor do I have a
 | problem with child processes being left behind.
 |
 
 
 I think Mark solved my problem by suggesting that I CLOSE the alias.
 Never thought about using CLOSE in that context. Use it to close a
 LOOKUP alias of course but didn't think of it with a USER alias. After
 the close, if I need the USER routine again, the IF NOT ALIAS construct
 seems to work. At least that's what I'm seeing so far. It seems to be
 more about telling *clerk that the alias is no longer valid and less
 about actually "closing" anything.
 
 
 Brian: I understand what you are saying. I also have my script run in
 a WHILE loop. First thing that the script expects is a directive for
 a case statement. For example alias=TIMESTAMP. The next thing that I send
 it is a format for the date command. I get back a date in the requested
 format (down to nano seconds with TZ). It then returns to the while loop.
 
 Or my directive might be PASSWORD, which runs a section that expects
 the next argument to be an account number. It then retrieves a password
 from MYSQL and returns that to filepro.
 
 Or I tell it COMMAND. It then expects a fully built SQL command. If I
 send it an UPDATE, move on. If I send it a SELECT or INSERT, better catch
 the return.
 
 Makes it very easy to have 1 USER routine that can be used for very
 specific things like the TIMESTAMP of PASSWORD examples. But can also
 be used for any *nix command where SYSTEM isn't appropriate because
 a reply is expected.
 
 Thanks All!
 
 
 Regards,
 
 Dave Snyder
 dave at snyderz.org


More information about the Filepro-list mailing list