Tip of the day - USER command

Jerry Rains jmrains at peoplepc.com
Fri Mar 19 20:12:44 PST 2004


On Friday 19 March 2004 19:10, Bob Stockler wrote:
> On Fri, Mar 19, 2004 at 02:50:52PM -0600, Jerry Rains wrote:
> | Sent: Friday, March 19, 2004 2:33 PM
> | Subject: Re: Tip of the day - USER command
> |
> | > Jerry Rains wrote:
> | > > I've been working with the USER command a lot recently and was having
> | > > problems with it either hanging or blowing up.  I determined that if
> | > > the user presses Break just before the USER command was written to,
> | > > it
> |
> | caused
> |
> | > > filePro to exit to the shell.
> | >
> | > Ken Brody wrote:
> | >
> | > Only if your USER program exits when break is pressed.
> |
> | That's the problem.  It does, but it isn't my program and I don't have
> | the source code so I can't fix it.
> Bob Stockler wrote:
> What it you moved it to another name and wrote a shell
> script wrapper for it where you trapped the INT signal ???

I guess a little more information is in order.  /var/scripts/pcms is a shell 
wrapper for a customized version of 'netcat' that Brian White wrote.  It 
tunnels to a Windows box and connects to PC*Miler/CONNECT on port 8145.  I 
tried adding 'trap "" 2' to the pcms shell script, but that didn't help.  I 
think that 'netcat' is really the problem but it could also be 'CONNECT' in 
PC*Miler.

We have been using  the prc.pcms process table, also written by Brian White 
that uses USER to call /var/scripts/pcms.  It is a generalized program for 
accessing PC*Miler from filePro and it quite a piece of work.  However, I was 
only getting 2 to 3 calculations per second with Brian's process table and it 
would crash after about 2000 calculations and left zombie 'netcat' processes 
so I used it sparingly.  

My application determines the destination agent for moves so, to keep the 
number of PC*Miler uses down John Hemmer made a filePro file (zipjoin) that 
contained the mileages of all zipcodes within 120 miles of every one of our 
agents.  (1.9 million records).   It was while building this file that John 
found out about the zombie 'netcat' processes and crashing of prc.pcms.

I needed to be able to update the zipjoin file and to be able to use PC*Miler 
to calculate mileages for browse LOOKUP's.  The process table that needed to 
do the browse LOOKUP's is a CALLed table.  prc.pcms is also CALLed.  One of 
the real drawbacks to filePro is that you can't CALL a table from a CALLed 
table, so the combination of the two problems led me to try to make things 
better.  

I studied Brian's table (he has extensive documentation in it.  Thank you 
Brian) and found out that I could use 'pcms' to connect directly to CONNECT 
in PC*Miler.  Being able to see the results of the "C" commands to PC*Miler 
allowed me to detemine exactly which commands I needed, and I wrote a 
stripped down version of Brian's program that was only about 20 lines long 
and embedded it into my CALLed process table.  

My new process table does almost 10 calculations per second,  however, this is 
when the problems started.  I think the reason Brian's table wasn't crashing 
after Break was pressed is because it was CALLed.  Not only is the buffer 
flushed, but the USER command was started each time it was CALLed.  I also 
believe that the zombie processes were because he didn't CLOSE the USER 
process before he exited, however, I have not confirmed that.

I had the same situation crop up today after I replaced Brian's code with mine 
in an input process table.  In this case certain city/state combinations 
produced a PC*Miler error using Brian's table.  I didn't take the time to 
find out why, but after replacing his code with mine the combinations 
calculated correctly.  

Adding a 'CLOSE pcm' into my PCMILER subroutine kept it from crashing the 
table.  I am a speed deamon when it comes to code and I don't like to put in 
code that I know is slower, however, since that table only did one mileage 
calculation at a time the added time to CLOSE and reopen the USER process is 
negligable.

I really think the problem is in 'netcat'.  PC*Miler CONNECT is a TCP/IP 
service daemon and it doesn't close when Ctrl-C is pressed.  Does anyone know 
how to trap break in 'netcat'?  If so, maybe I can talk Brian out of the 
source code for his customized version.  It will be interesting to see if 
that will fix this problem.

Jerry
>
> Bob



More information about the Filepro-list mailing list