• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Retrieve the System Name

    January 28, 2004 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

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    DRV Tech

    Get More Out of Your IBM i

    With soaring costs, operational data is more critical than ever. IBM shops need faster, easier ways to distribute IBM applications-based data to users more efficiently, no matter where they are.

    The Problem:

    For Users, IBM Data Can Be Difficult to Get To

    IBM Applications generate reports as spooled files, originally designed to be printed. Often those reports are packed together with so much data it makes them difficult to read. Add to that hardcopy is a pain to distribute. User-friendly formats like Excel and PDF are better, offering sorting, searching, and easy portability but getting IBM reports into these formats can be tricky without the right tools.

    The Solution:

    IBM i Reports can easily be converted to easy to read and share formats like Excel and PDF and Delivered by Email

    Converting IBM i, iSeries, and AS400 reports into Excel and PDF is now a lot easier with SpoolFlex software by DRV Tech.  If you or your users are still doing this manually, think how much time is wasted dragging and reformatting to make a report readable. How much time would be saved if they were automatically formatted correctly and delivered to one or multiple recipients.

    SpoolFlex converts spooled files to Excel and PDF, automatically emailing them, and saving copies to network shared folders. SpoolFlex converts complex reports to Excel, removing unwanted headers, splitting large reports out for individual recipients, and delivering to users whether they are at the office or working from home.

    Watch our 2-minute video and see DRV’s powerful SpoolFlex software can solve your file conversion challenges.

    Watch Video

    DRV Tech

    www.drvtech.com

    866.378.3366

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Bsafe Bolsters OS/400 Security Software with New Logging, Alerts New Domino and Blue Domino: A Little of Both At Lotusphere

    One thought on “Retrieve the System Name”

    • Chejo QR says:
      October 24, 2019 at 1:41 pm

      MUCHAS GRACIAS, THANK YOU VERY MUCH !!! you saved me !!! me salvaste !!!, The SQL Solution was the easiest and simply !

      Reply

    Leave a Reply Cancel reply

Volume 4, Number 2 -- January 28, 2004
THIS ISSUE
SPONSORED BY:

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

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

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Meet The Next Gen Of IBMers Helping To Build IBM i
  • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
  • Will Independent IBM i Clouds Survive PowerVS?
  • Now, IBM Is Jacking Up Hardware Maintenance Prices
  • IBM i PTF Guide, Volume 27, Number 24
  • Big Blue Raises IBM i License Transfer Fees, Other Prices
  • Keep The IBM i Youth Movement Going With More Training, Better Tools
  • Remain Begins Migrating DevOps Tools To VS Code
  • IBM Readies LTO-10 Tape Drives And Libraries
  • IBM i PTF Guide, Volume 27, Number 23

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle