Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session Number

Status
Not open for further replies.

chyenne

Programmer
Joined
Oct 21, 2003
Messages
3
Location
US
Hello everyone,
Do you know if there's a quick way to get the current Session number?

Thanks in advance.
 
unix cmd: ps -p $$ -o sess
 
chyenne:


I'm assuming you're asking for the process id of the 4GL program you're executing. Since I don't know of a way to do that with creating a callable "C" function. Here's a solution:

/*
* procid.c: return the current processid
*/
#include <stdio.h>

procid(a)
{
long x;

x=getpid();
retlong(x);
return(1);
}

Here's a test 4GL stub:

# testprocid
main
define x integer,
ret_str char(6)

let x = procid()
display x at 10,10
prompt &quot;Press <enter> to continue: &quot; for char ret_str

end main

If you are using the compiled version of 4GL, it's easy to use:

c4gl testprocid.4gl procid.c -o testprocid

If you are using the Rapid Development System, RDS, you have to link the &quot;C&quot; code into the runtime. Check out my calling &quot;C&quot; functions from 4GL FAQ over in the Informix Dynamic Server forum on how to do the linking:

faq179-2007

Regards,

Ed




 
Thanks Ed.
I was able to get what I needed using the Unix command I posted earlier.

Thanks again.
Chyenne.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top