Re: Process IDs
Posted in 1995
> Date: Tue, 28 Mar 95 03:36 CST > From: john@wwa.com (pinoy_ako) > To: alan@po.den.mmc.com > Subject: Re: Performance > Newsgroups: comp.databases.informix > > In article <3l7jnq$rhv@cssun.mathcs.emory.edu> you write: > >Each separate user process will "own" a separate set of temp tables, so > >the re-use of the name should not cause a problem. > We use the C-compiler version and I just read the manual and it > says the table stays until I close the database(?) I'm not sure if > 'making temp tables' will work for us since our main program (a 1 MB > binary) contains all the object files so in essense, everything is run. Yes, you cannot create a temp table, delete it, and recreate it in the same database session. However, you could create it, use it, empty it, reuse it, etc. [your example deleted] > > >If you would prefer to use permanent scratch tables, then you might > >prefer the following technique: > The tables are real wide. This would be my second option. > > [step 1-4 deleted] > We use 4gl so I assume it's somewhat difficult(?) I'm thinking in the lines > of (like shell programming) > > echo $$ > /tmp/user.$$ > PID=`cat /tmp/user.$$` > > or just > > PID=`$$` These look like they should work, but you need to remember to build them into a script used to run your program. Below I offer a routine that can be build *directly* into the program, which I consider safer. > >USER is easier to use, but a single user running two queries at the same > >time, or multiple users using a generic login, will get garbled results. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > Yes. We have this situation. That's what prompted me to post a question > about two persons in the same part of the application (data-entry) and > doing their queries/adds/updates/deletes at the same time. > > Thanks for the ideas! > > John > -- > - J - You're welcome; but I try to offer solutions, not just ideas. How about the following: ----------- begin fgl_getpid.c -------------- /* function: fgl_getpid - return process id * author: Alan Popiel * date: 29 Mar 1995 * * fgl_getpid() returns the numeric process identifier for the current program * * usage: * CALL fgl_getpid() RETURNING number * LET number = fgl_getpid() * * CALL arguments: * none; no checking is done to ensure no input argument is passed * * RETURNING argument: * integer number -- numeric value of the process id */ int fgl_getpid(nargs) int nargs; { /* Push return argument to the stack. */ retint( getpid() ); /* Unix process id call */ return( 1 ); /* Number of arguments pushed. */ } ------------ end fgl_getpid.c --------------- ----------- begin pid_test.4gl -------------- main define pid integer let pid = fgl_getpid() display "process id is ", pid end main ------------ end pid_test.4gl --------------- This should work under pretty much any standard (it's a joke, right?) Unix. I make no promises about the more obscure Unix versions. I'm also posting this back to the newsgroup so other folks can use my fgl_getpid code if they want it. I'd appreciate knowing if this works for you, but I don't see any obvious reasons that it should not. The little tester program will let you verify that the function works before modifying any production code. Regards, Alan +---------------------------+-----------------------------------------------+ | R. Alan Popiel | Internet: alan@den.mmc.com | | Martin Marietta, SLS | Voice: 303-977-9998 | | P.O. Box 179, M/S 3810 | Standard disclaimers apply. Cutesy ones, too. | | Denver, CO 80201-0179 USA | Your mileage may vary. Void where prohibited. | +---------------------------+-----------------------------------------------+