× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Try this.


//===================================================================
// @Name - Utl_RtvNetServer
// @Description - Retrieve the Net Server Name and IP.
// @Usage - IF 0 <> Utl_RtvNetServer(ServerName :Domain :ServerIP :ServerSecondIp);
// MSGSEND('ERR9996':'Error occurred retrieving server name');
// ENDIF;
// @Params - Output Server Name
// - Output Domain Name
// - Output WINS Primary Ip Address
// - Output WINS Secondary Ip Address

// @Returns - non-zero when an error occurred.

//===================================================================
/DEFINE Utl_RtvNetServer
Dcl-Pr Utl_RtvNetServer Int(10);
ServerName Char(15);
DomainName Char(15) OPTIONS(*NOPASS);
WINSprimaryIp Char(15) OPTIONS(*NOPASS);
WINSsecondaryIp Char(15) OPTIONS(*NOPASS);
End-Pr;

Dcl-Proc Utl_RtvNetServer Export;
//===================================================================
//===================================================================
// @Procedure name: Utl_RtvNetServer
//===================================================================
//===================================================================
Dcl-Pi Utl_RtvNetServer Int(10);
ServerName Char(15);
DomainName Char(15) OPTIONS(*NOPASS);
WINSprimaryIp Char(15) OPTIONS(*NOPASS);
WINSsecondaryIp Char(15) OPTIONS(*NOPASS);
End-Pi;
Dcl-S InfoQual Char(15);
Dcl-Ds ListInfo QUALIFIED;
TotRecords Int(10); // Total records
RtnRecords Int(10); // Records returned
RecordLen Int(10); // Record length
InfoLength Int(10); // Info Returned Len
InfoComplete Char(1); // Info Complete
CreatedTS Char(13); // Date/time created
Reserved1 Char(34); // Reserved
End-Ds;
Dcl-S ListSize Int(10);
// Typically in the IBM Reference as RtvNSV

// Open List of Server Information (QZLSOLST) API
// http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/apis/qzlsolst.htm

// http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic
// /apis/qzlsolst.htm?resultof=%22QZLSOLST%22%20%22qzlsolst%22
Dcl-Pr QZLSOLST EXTPGM('QZLSOLST');
ListData likeds(List_ZLSL0201);
ListSize Int(10) CONST;
ListInfo Char(64);
Format Char(8) CONST;
InfoQualifier Char(15) CONST;
ErrorCode LIKE(APIERRORDS) OPTIONS(*VARSIZE); // API error info.
End-Pr;
// Currently, this parameter applies only to the ZLSL0300 (session information) and ZLSL0600
// SessionUser 10A CONST OPTIONS(*NOPASS)
// SessionId 20U 0 CONST OPTIONS(*NOPASS)

// ZLSL0100
Dcl-Ds Listdata;
DataLen Int(10); // Length of this en
ShareName Char(12); // Share name
DeviceType Int(10); // Device type
Permissions Int(10); // Permissions
MaxUsers Int(10); // Maximum users
CurrentUsers Int(10); // Current users
SpoolFileType Int(10); // Spooled file type
PathNameOffset Int(10); // Offset to path na
PathNameLen Int(10); // Length of path na
OutQueue Char(20); // Qualified output
PrintDriverTp Char(50); // Print driver type
TextDesc Char(50); // Text description
End-Ds;
// Pathname *

// Defined ZLSL0201, however I am only using format ZLSL0200 below because
// I don't actually need the extra fields in the result of ZLSL0201.
// ZLSL0201
Dcl-Ds List_ZLSL0201 QUALIFIED;
CCSID Int(10); // 0 0 BINARY(4) CCSID
PendingCCSID Int(10); // 4 4 BINARY(4) Pending CCSID
IdleTimeOut Int(10); // 8 8 BINARY(4) Idle time-out
PndIdleTimeOut Int(10); // 12 C BINARY(4) Pending idle time-out
OpportunLockTO Int(10); // 16 10 BINARY(4) Opportunistic lock time-out
PndOptunLockTO Int(10); // 20 14 BINARY(4) Pending opportunistic lock time-out
BrowsingInt Int(10); // 24 18 BINARY(4) Browsing interval
PndBrowsingInt Int(10); // 28 1C BINARY(4) Pending browsing interval
WINSenable Int(10); // 32 20 BINARY(4) WINS enablement
PndWINSenable Int(10); // 36 24 BINARY(4) Pending WINS enablement
GuestSupport Int(10); // 40 28 BINARY(4) Guest support
PndGuestSuport Int(10); // 44 2C BINARY(4) Pending guest support
GuestUsrPrf Char(10); // 48 30 CHAR(10) Guest user profile
PndGuestProfil Char(10); // 58 3A CHAR(10) Pending guest user profile
ServerName Char(15); // 68 44 CHAR(15) Server name
PndServerName Char(15); // 83 53 CHAR(15) Pending server name
DomainName Char(15); // 98 62 CHAR(15) Domain name
PndDomainName Char(15); // 113 71 CHAR(15) Pending domain name
TextDesc Char(50); // 128 80 CHAR(50) Text description
PndTextDesc Char(50); // 178 B2 CHAR(50) Pending text description
WINSprimary Char(15); // 228 E4 CHAR(15) WINS primary address
PndWINSprimary Char(15); // 243 F3 CHAR(15) Pending WINS primary address
WINSsecondary Char(15); // 258 102 CHAR(15) WINS secondary address
PndWINSsecond Char(15); // 273 111 CHAR(15) Pending WINS secondary address
ScopeId Char(224); // 288 120 CHAR(224) Scope ID
PndScopeId Char(224); // 512 200 CHAR(224) Pending scope ID
AllowSysName Char(1); // 736 2E0 CHAR(1) Allow system name
PndAlowSysName Char(1); // 737 2E1 CHAR(1) Pending allow system name
AuthentMethod Char(1); // 738 2E2 CHAR(1) Authentication method
PndAuthentMeth Char(1); // 739 2E3 CHAR(1) Pending authentication method
ServerRole Int(10); // 740 2E4 BINARY(4) Server role
PndServerRole Int(10); // 744 2E8 BINARY(4) Pending server role
MsgAuthent Int(10); // 748 2EC BINARY(4) Message authentication
PndMsgAuthent Int(10); // 752 2F0 BINARY(4) Pending message authentication
MinMsgSev Int(10); // 756 2F4 BINARY(4) Minimum message severity
PndMinMsgSev Int(10); // 760 2F8 BINARY(4) Pending minimum message severity
LanMgrAuthent Int(10); // 764 2FC BINARY(4) LAN Manager authentication
PndLanMgrAuth Int(10); // 768 300 BINARY(4) Pending LAN Manager authentication
End-Ds;

Dcl-Ds Errords LIKEDS(Apierrords) INZ(*LIKEDS);
Dcl-Ds SavedDS QUALIFIED STATIC;
ServerName Char(15);
DomainName Char(15);
WINSPrimary Char(15);
WINSSecondary Char(15);
End-Ds;
IF SavedDS.ServerName <> *BLANKS;
ServerName = SavedDS.ServerName;
IF %PARMS() >= 2;
DomainName = SavedDS.DomainName;
ENDIF;
IF %PARMS() >= 3;
WINSprimaryIp = SavedDS.WINSPrimary;
ENDIF;
IF %PARMS() >= 4;
WINSsecondaryIp = SavedDS.WINSSecondary;
ENDIF;
Return 0;
ENDIF;

RESET Errords;
ListSize = %size(List_ZLSL0201);
Clear ListInfo;
CALLP QZLSOLST( List_ZLSL0201 :ListSize :ListInfo :'ZLSL0200' :' ' :ErrorDS);
If Errords.Bytesavail > 0;
// 'Command failed'
ELSEIF ListInfo.RtnRecords <> 1;
// 'Command failed'
Else;
SavedDS.ServerName = List_ZLSL0201.ServerName;
SavedDS.DomainName = List_ZLSL0201.DomainName;
SavedDS.WINSPrimary = List_ZLSL0201.WINSprimary;
SavedDS.WINSSecondary= List_ZLSL0201.WINSsecondary;

ServerName = SavedDS.ServerName;
IF %PARMS() >= 2;
DomainName = SavedDS.DomainName;
ENDIF;
IF %PARMS() >= 3;
WINSprimaryIp = SavedDS.WINSPrimary;
ENDIF;
IF %PARMS() >= 4;
WINSsecondaryIp = SavedDS.WINSSecondary;
ENDIF;
Return 0;
Endif;

Return 1;

End-Proc Utl_RtvNetServer;

--
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.

From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of dfreinkel@xxxxxxxxxxxxxxxxx
Sent: Wednesday, January 24, 2024 12:38 PM
To: 'RPG programming on IBM i' <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Is there a system value that will give me the system name?


I need to retrieve the system name in a RPGLE program. I do not want to use

a CL program to do a RTVNETA.





I do not see an option using the program status data structure.





Is it available somewhere within the RPG code or is there an SQL statement I

can use to get it.





TIA





Darryl Freinkel



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.