• 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
    Manta Technologies

    The Leader in IBM i Education!
    Need training on anything i?
    Manta is all you need.

    130 courses and competency exams on:
    · IBM i operations
    · System Management and Security
    · IBM i Programming Tools
    · Programming in RPG, COBOL, CL, Java
    · Web Development

    SQL, DB2, QueryProduct features:
    · Runs in every popular browser
    · Available 24/7/365
    · Free Student Reference Guides
    · Free Student Administration
    · Concurrent User License
    · Built-In IBM i Simulator

    You can download our 200-page catalog and take sample sessions at MantaTech.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

    • With Power11, Power Systems “Go To Eleven”
    • With Subscription Price, IBM i P20 And P30 Tiers Get Bigger Bundles
    • Izzi Buys CNX, Eyes Valence Port To System Z
    • IBM i Shops “Attacking” Security Concerns, Study Shows
    • IBM i PTF Guide, Volume 27, Number 26
    • Liam Allan Shares What’s Coming Next With Code For IBM i
    • From Stable To Scalable: Visual LANSA 16 Powers IBM i Growth – Launching July 8
    • VS Code Will Be The Heart Of The Modern IBM i Platform
    • The AS/400: A 37-Year-Old Dog That Loves To Learn New Tricks
    • IBM i PTF Guide, Volume 27, Number 25

    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