• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Odds and Ends

    September 18, 2002 Timothy Prickett Morgan

    Dear Readers:

    Here are more miscellaneous short tips. I hope you enjoy them.

    — Ted

    Question:

    Our shop has a junior programmer who, by not using our change management system, messed up an RPG Source member, . He then tried to correct his own mistake, and he only proceeded to make things worse.

    Can I restore a specified member from tape from the QRPGSRC file?  I know how to restore the whole library, but I really only need one member from the QRPGSRC File.

    Answer:

    The Restore Object (RSTOBJ) command can restore a single file member. Here is an example.

    RSTOBJ OBJ(QRPGSRC)
       SAVLIB(library-name)
       DEV(TAP01)
       OBJTYPE(*FILE)
       FILEMBR((QRPGSRC (source-member-name)))
       RSTLIB(another-library)
    

    In the SAVLIB parameter, put the name of the library where the source member resides. In the RSTLIB parameter, put the name of a work library. Restore to the work library, make sure the restore was successful, and only then copy the RPG member from the work library to the regular library

    Question:

    We have an RPG II program that accesses an externally described file. The key in the F spec is ten bytes long, beginning at position 1. The key in the file is ten bytes long, but it really begins at position 2. This is a programming error, but when it is run, it appears the external key description is overriding the internal key description, as we are getting correct outcome. Does this sound right?

    Answer:

    If you were running your program on a System/36, you would get an error, but the iSeries is not so picky. When externally described files are described internally in RPG programs, the key location does not have to match. The system uses the external key, regardless of what you put in the F spec. If you read the file sequentially, key size does not have to match. The record length has to match if the program is compiled as RPG36, but not when compiled as RPG.

    Question:

    Before reading your tip, “Edit with Parentheses in Query/400,” I had never realized that Query/400 would let you put the minus sign (-) on the left side of a negative number. By also leaving the leading zeros in, the transfer to Excel worked so much better. I was impressed. Can the same edit features be used in RPG output?

    Answer:

    Look at edit codes N, O, P, and Q. These codes–especially P, which prints zero values but doesn’t insert thousands separators–may do what you want, .

    All four edit codes suppress leading zeros. If you want leading zeros, you’ll have to use an edit word to get a trailing minus sign and do a little finagling to move the minus sign around to the front.

    Here’s some code that might get you started.

    D NumValue        s              7p 2                                
    D Alpha           s             10                                   
                                                                         
    C                   eval      alpha = %editw(NumValue: '0     .  -') 
    C                   eval      alpha = %subst(alpha: %size(alpha): 1) 
    C                                   + '0'                            
    C                                   + %subst(alpha: 2)               
    

    The leading zero on the edit word keeps leading zeros on the edited value. The trailing minus sign puts either a space (for positive numbers) or minus (for edited numbers) on the end of the edited value. The second eval places the blank or minus sign on the front of the edit word. I defined Alpha as 10 bytes long to accommodate the seven digits in NumValue, the leading zero indicator, the decimal point, and the trailing minus sign.

    Question:

    Can the ILE debugger be used to view/debug a trigger program?

    Answer:

    Yes it can.

    • Specify DBGVIEW(*SOURCE) when you create the trigger program.
    • To debug, run the Start Debug (STRDBG) command, naming the trigger program in the PGM parameter.
    • Use F6 to set a breakpoint.
    • Start a program to update the file. (I used DFU.)

    When the trigger fires, the debugger will kick in.

    Question:

    With a System/36 menu, the command SEU ARMENU##,S,,,LIBRARY will get me a list of the commands behind the menu. Is there a quick way to see the commands behind a native menu without using PDM or SDA?

    Answer:

    For native menu ARMENU, try this command:

    DSPMSGD RANGE(*ALL) MSGF(ARMENU)
    

    Press Enter to page through the options.

    Sponsored By
    ADVANCED SYSTEMS CONCEPTS

    SEQUEL meets all your iSeries and AS/400 data access needs in a single, integrated solution:

    • Windows, Web or host user interfaces

    • Convert AS/400 data into PC file formats

    • E-mail or FTP query results, reports and spool files
    • Run-time prompted queries and reports for end users

    • IF-THEN-ELSE logic in queries and reports

    • Report, form and label formatting second to none

    • Easily convert date fields, character-to-numeric, numeric-to-character and other data manipulation

    • SORT or JOIN using a calculated field

    • Quick summarization of data with Tabling function

    • Run multiple SEQUEL requests as one with the SEQUEL Scripting function

    • OLAP Business Intelligence at a fraction of the cost of comparable solutions

    Take 6 minutes to view a SEQUEL ViewPoint ScreenCam movie to see how simple Windows-based AS/400 and iSeries data access can be! In just a few short minutes, you can find out ways to make your job easier and improve data access throughout your organization. Download the ViewPoint movie here .

    For more information or a FREE trial of SEQUEL, call 847/605-1311 or visit Advanced Systems Concepts.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: mgo_rc, Volume 2, Number 71 -- September 18, 2002

    Sponsored by
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Properly Sorting Numeric Arrays Reader Feedback and Insights: Thanks for the Tips

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 71

This Issue Sponsored By

    Table of Contents

    • Reader Feedback and Insights: More Binder Language
    • Odds and Ends
    • Is It a Different ‘Hello World’ in OS/400 V5R1?

    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