|
Doug,
The Retrieve Network Attributes (QWCRNETA) API will do this. Here is
an "as-is" sample of using the API to access the system name. The sample
does assume you have OS/400 option 13 (QSYSINC - Openness includes)
installed.
Bruce Vining
I/COPY QSYSINC/QRPGSRC,QWCRNETA
I/COPY QSYSINC/QRPGSRC,QUSEC
I* Declare the receiver variable
IRCV DS 256
I B 1 40NUMBER
I B 5 80OFF1
I* Declare the size of receiver, number of network attributes to
I* retrieve, and the attribute to retrieve (respectively)
IMISC DS
I I 256 B 1 40RCVSIZ
I I 1 B 5 80NBR
I I 'SYSNAME' 9 18 NETA
C* Set error reporting to exception mode
C Z-ADD0 QUSBNB
C* Call Retrieve Network Attributes API
C CALL 'QWCRNETA'
C PARM RCV
C PARM RCVSIZ
C PARM NBR
C PARM NETA
C PARM QUSBN
C* If we got here, then no exception took place
C NUMBER IFEQ 1
C* So, adjust the offset from base 0 to RPGs base 1
C OFF1 ADD 1 OFF 30
C* Get the header information for the network attribute
C 16 SUBSTRCV:OFF QWCBV
C* Adjust OFF to address the returned value
C ADD 16 OFF
C* Check for system name being returned
C QWCBVB IFEQ 'SYSNAME'
C* Blank out any residual data from SYSNAM
C MOVE *BLANKS SYSNAM 8
C* Get the returned value
C QWCBVF SUBSTRCV:OFF SYSNAM
C* Display the system name
C SYSNAM DSPLY
C END
C END
C* And get out
C MOVE '1' *INLR
C RETRN
> A quick RPG question: (If y'all don't mind!)
>
> Is there a way to retrieve the system name in an RPG program? (IE;
> S10-------) (I didn't see it anywhere in the SDS)
>
> Secondarily, I could retrieve it in a CL and parm it in. (Can't you
> RTVSYSVAL and get the system name?)
>
> (Incidentally, we are CISC (obviously by the serial #!) at V3R2)
>
> Doug Aarestad
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.