Is there a System Variable for IP Address?

I am trying to come up with a way to id terminals in order to tell where to route printouts. I am hoping to id the user terminal by IP and have a Database that contains IP’s within a department so I can tie groups of IP’s to certain printers. Can’t seem to find a system variable for IP address…
Can you point me in the right direction please… Looked in the docs already, cannot find it, although I could have missed it.

I think there’s no Natural environment variable containting the IP-Address. You can use *HOSTNAME instead. But I’m not sure if this would really help you.

If I understand you correctly you want to assign printing jobs to a printer by using an IP-Address of the user, who created the print job. Are we really talking about terminals? From my point of view, all programs started by terminals are running on one host. So all your jobs would have the same IP-Address. If possible, I would take *USER or *USER-NAME as an ID.

To identify the terminal you do not need the IP-Address. You can use *INIT-ID for this purpose. From the docs (UNIX):

Hope this helps.

[quote="Wilfried B

Hi papajohn,

there are several ways to get the ip-adress of the client/terminal:

  1. setting an unix-environment-variable for the ip-adress at login of the user. on our hp-ux system we have such a variable named “DISPLAY” and the
    content is like this “DISPLAY=”. using the USR1053N you can “read” the content of this Environment-Variable.

  2. if you don’t have this variable and its not possible to change the standard-login-procedure to create this variable,
    you can execute a “finger”-cmd (or a script with this cmd) via USR1052N and analyse/parse the output of the command.
    finger will give the informations below:

Login name: xyz12345     (messages off)  In real life: KlaBue
Directory: /home/xyz12345                Shell: /bin/ksh
On since Aug  3 11:08:42 on pts/td from
1 minute 36 seconds Idle Time

We are using HP-UX (PA-Risc and IA64).

Thanks for the suggestions,
*INIT-ID, gives me like Mathias says, pts-1, pts-2 etc, must be some kind of pseudo terminal id, but not very usefull for my purpose
*HOSTNAME, gives me the name of our adabas on Linux… also not usefull,

I like the suggestion (Klablu) saying to setup EV for ip upon startup.
Then each user that wants to print will have an id that I can use to route
printouts to, or user-id,
I also found an old thread on the SAG-List describing how to route printouts with an EV, then pipe output depending on the values set in the EV…

thanks a lot,
I will post back with results, when i figure it out :slight_smile:

We’re using IBM VSE Adabas/Natural/Predict/ converting to Suse Linux
with Nat 4.1.3 and Adabas

Also, we dont have usr1052 or usr1053, we have usr1051 and usr1054, but nothing in between… any ideas why we’re missing those?

I can do this: CALL ‘SHCMD’ 'echo $REMOTEHOST ’
and it does display the IP, but how to get it inside my program?
I’ve tried adding ‘using’ after the call, no luck,
I’m getting close,

You’re right! PTS is an abbreviation for pseudo terminal slave…

As you found out, you can use CALL ‘SHCMD’ instead of usr1052.
On my Unix (Solaris), I got usr1053 on Natural 6.1.1 and it works like follows:

define data local
01 #usr1053
  02 name     (A80)
  02 content  (A253)
  02 response (I04)
end-define := 'HOME'
callnat 'USR1053N' #usr1053
display #usr1053.content (AL=20) #usr1053.response

If usr1053 cannot be used for some reason (Natural too old?), I would do the following workaround:

  1. redirect the echo into a temporary workfile (e.g. CALL “SHCMD” “echo $VAR > /tmp/myipaddress.$$”)
  2. read the workfile

You can direct the output of the command into a file (CALL ‘SHCMD’ ‘echo $REMOTEHOST > out.txt’) and later read the file with READ WORKFILE. Of course you should use a user specific file name / location.
Kind regards, +o:-]

Hello again papajohn,

i am astonished that there is no usr1052n and usr1053n within your natural-installation for Suse Linux. but anyway, as attachment you will find a (standard-)c-routine which will do the same as usr1053n: SOSGetEV.

You will find the source, the documentation and an example in the file SOSGetEV.html.

Which natural-version do you have installed on SuseLinux? (5.87 KB)

Wow, thanks for all the help,
Going to try and read back the work file, I have it created, but reading it back isnt the same as it was on the big box always something new to figure out…
Mathias, we have Nat 4.1.3 on the Suse box.
Klabue, thanks for that download, I will chk that out as well.
Thanks to Benedict also…
My learning curve is getting shorter thanks to all of you

A correction for Kablue,
We have Nat 6.1.1 on the Suse box, sorry bout that