Newsletters   Subscriptions  Forums  Store  Media Kit  About Us  Contact  Search   Home 
fhg
Volume 4, Number 2 -- January 28, 2004

Retrieve the System Name


Hey, Ted:

At the end of reports, I print a special line that indicates that the report is complete. In addition to the message "end of report," I print the qualified job name, qualified program name, and in the case of SQL programs, the last value of the SQL status variable. These values help me to debug and troubleshoot problems. I'd like to add one more bit of information.

We recently got a new machine with logical partitioning, and we have set up a partition to use as a test environment. I would like to add the system name to the end-of-report line to help me distinguish between reports generated on the two systems.

--Andrew


There are several ways to retrieve the system name.

One method is to create a small CL program that runs the Retrieve Network Attributes (RTVNETA) command and passes the system back to the caller through a parameter.

pgm       parm(&SysName)         

dcl       &SysName    *char     8

rtvneta   sysname(&SysName)  

endpgm                       

Assuming the CL program has the name GETSYSNAME, an RPG caller would look something like this:

Fqsysprt   o    f  132        printer oflind(*inof)             
                                                                
D PrtLine         ds           132                              
D SysName         s              8                              
                                                                
D GetSysName      pr                  extpgm('GETSYSNAME')      
D  SysName                       8a                             
                                                                
D psds           sds                                            
D  psdsProcName           1     10                              
D  psdsLibName           81     90                              
D  psdsJobName          244    253                              
D  psdsUserName         254    263                              
D  psdsJobNbr           264    269                              
                                                                
C                   callp     GetSysName (SysName)              
C                   eval      PrtLine = '* End of report *  ' 
C                             + 'Job(' + psdsJobNbr + '/'       
C                             + %trim(psdsUserName) + '/'    
C                             + %trim(psdsJobName)           
C                             + ')  Program('                
C                             + %trim(psdsLibName) + '/'     
C                             + %trim(psdsProcName)          
C                             + ')  System(' + %trim(SysName)
C                             + ')'                          
C                   write     qsysprt       PrtLine          
C                   eval      *inlr = *on                    

The output of the program shows the system name, as you requested:

* End of report * Job(877501/THOLT/S9) Program(THOLT/E1) System(TS400)

A second method is to use a SQL special register. You may spell the special register CURRENT SERVER or CURRENT_SERVER.

C/exec sql                  
C+     values current server
C+       into :SysName      
C/end-exec                  

--Ted

Sponsored By
TWIN DATA

Full system console control for multiple AS/400s and LPARs from anywhere on your LAN, WAN, VPN, even over the Internet!

Perform certain System Maintenance and Configuration Procedures while in "Restricted State." Execute certain types of System Backups (SAVYSYS) and respond to "System Console Only" messages.

Call for details about this IP Console Solution: 800-597-2525
www.twindata.com


Editors: Howard Arner, Joe Hertvik, Ted Holt,
Shannon O'Donnell, Kevin Vandever
Managing Editor: Shannon Pastore
Contributing Editors: Raymond Everhart, G. Wayne Hawks,
Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

THIS ISSUE
SPONSORED BY:

T.L. Ashford
Profound Logic Software
WorksRight Software
Twin Data
SuSE Linux


BACK ISSUES

TABLE OF
CONTENTS
Application and Data Integration Between Linux and OS/400

To Commit or not to Commit

Simplify Complex Conditions

Retrieve the System Name

OS/400 Alert: Trials and Betas



Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, 50 Park Terrace East, Suite 8F, New York, NY 10034
Privacy Statement