• 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
    New Generation Software

    On Demand Video

    Data Visualization and Analytics
    with NGS-IQ and Microsoft Power BI

    Power BI is a popular visualization and analytics solution, but it’s only as good as the data your analysts can draw from your IBM i database.

    NGS-IQ simplifies and automates the cleansing, transformation, and delivery of IBM i data to Power BI reports and insights. Watch our new video to learn and see how NGS-IQ supports Power BI users while enabling you to maintain control and security.

    www.ngsi.com – 800-824-1220

    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

    • Power10 Boosts NVM-Express Flash Performance
    • Fortra Completes Postmortem Of GoAnywhere Vulnerability
    • Guru: Binding Directory Entries
    • How Does Your Infrastructure Spending Stack Up To The World?
    • IBM i PTF Guide, Volume 25, Number 22
    • Fortra Issues 20th State of IBM i Security Report
    • FNTS Launches Managed Services for Power Servers in IBM Cloud
    • Total LTO Shipped Capacity Up Slightly in 2022
    • Four Hundred Monitor, May 24
    • Update On Critical Security Vulnerability In PowerVM

    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 © 2023 IT Jungle