• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Properly Sorting Numeric Arrays

    September 13, 2002 Timothy Prickett Morgan

    Hey, Ted:

    In a program, data could be stored in arrays related to each other. Arrays could be filled from different files, but they could have the same index.

    To sort the arrays, we would have to combine the arrays into one alphanumeric array and sort it. However, if the sort field is numeric, and there are negative numbers in the sort field, this is not going to work.

    I have a technique that allows proper sorting of numeric values in cases like this one. Would you like to publish it in Midrange Guru?

    — A Devoted Reader

    I have good news for you. RPG knows how to handle this type of sorting.

    The short program that follows illustrates this technique. Notice that the array called MyArray is defined within a data structure. Two other subfields–Alpha and Numeric–overlay MyArray. All three subfields–MyArray, Alpha, and Numeric–are arrays. Sorting one keeps the others in sync.

    The >EVAL lines between the C specs were cut and pasted from the debugger to show what the values of the arrays were at that point.

    — Ted

    D                 ds                                          
    D   MyArray                     15    dim(5)                  
    D   Alpha                       10    overlay(MyArray:1)      
    D   Numeric                      5s 0 overlay(MYArray:11)     
    
    C                   eval      MyArray (1) = 'A.........00000' 
    C                   eval      MyArray (2) = 'C.........50005' 
    C                   eval      MyArray (3) = 'E.........2000K' 
    C                   eval      MyArray (4) = 'D.........7000P' 
    C                   eval      MyArray (5) = 'B.........40004' 
                                                                  
    >EVAL myarray                      
        MYARRAY OF (1) = 'A.........00000'
        MYARRAY OF (2) = 'C.........50005'
        MYARRAY OF (3) = 'E.........2000K'
        MYARRAY OF (4) = 'D.........7000P'
        MYARRAY OF (5) = 'B.........40004'
    
    C                   sorta     Alpha
    
    >EVAL myarray                      
        MYARRAY OF (1) = 'A.........00000'
        MYARRAY OF (2) = 'B.........40004'
        MYARRAY OF (3) = 'C.........50005'
        MYARRAY OF (4) = 'D.........7000P' 
        MYARRAY OF (5) = 'E.........2000K'
    >EVAL numeric                       
        NUMERIC OF (1) = 00000.            
        NUMERIC OF (2) = 40004.            
        NUMERIC OF (3) = 50005.            
        NUMERIC OF (4) = -70007.           
        NUMERIC OF (5) = -20002.           
    
    C                   sorta     Numeric
    
    >EVAL myarray                       
       MYARRAY OF (1) = 'D.........7000P' 
       MYARRAY OF (2) = 'E.........2000K' 
       MYARRAY OF (3) = 'A.........00000' 
       MYARRAY OF (4) = 'B.........40004' 
       MYARRAY OF (5) = 'C.........50005'
    >EVAL numeric            
       NUMERIC OF (1) = -70007.
       NUMERIC OF (2) = -20002.
       NUMERIC OF (3) = 00000. 
       NUMERIC OF (4) = 40004. 
       NUMERIC OF (5) = 50005. 
       
    C                   eval      *inlr = *on
    

    Sponsored By
    WORTH CONSULTING

    Improve Legacy Programs with Super/Windows

    Summary:

    This newly released tool for the iSeries is used to improve user and programmer productivity and efficiency.

    Pop-up windows (or selection windows) are what users want to make their jobs easier and more accurate. They have been exposed to “list boxes” when on the Internet or when using a typical windows-based program. This feature makes it so that the user does not need those sticky notes and reference material at their grasp to know what value to key in entry fields.

    Programmers have been reluctant to put the selection window feature in entry programs because it takes substantial programming efforts to build the information and display it on the screen. It also requires major additions to the display files.

    Super/Windows easily enables pop-up selection windows to your application programs in an affordable manner. Very few changes are required to be made to your existing RPG, COBOL, and CL programs. Changes to your display files are not needed! Your existing code or table files are used to populate the information in the windows from which your users make selection. You can also use the codes file (and maintenance program) that is included with Super/Windows. One of Super/Windows’ functions generates the program source for each file ID using a simple entry program where the file and descriptive information is recorded. The source can be modified to return additional fields.

    You do not have to make wholesale changes to your application software, can optimize your staff’s existing skills, and little user training is needed. They will welcome Super/Windows with open arms!

    Business Owner Benefits:

    • Low Investment / High ROI as compared to leading high investment solutions that generate application software.
    • Immediate observable results.
    • Efficiency in workforce.
    • Faster training of users and programmers by using existing skill sets.
    • Gradual implementation with control of the degree of application.
    • its your budget: no increase in personnel and no major software expense.
    • License fee is $1,500 for first system and $750 for each subsequent system, no matter how many users or system size!
    • Annual maintenance is $300, regardless of the number of installations.

    Programmer Benefits:

    • Installs in 5 minutes. Free 30-day trial.
    • Values in windows are built from your existing code and table file…nothing is “hard-coded.”
    • The programs that retrieve the data for display are automatically generated after entry of file and key information.
    • Easily implemented. Only two copybook lines and 8 lines for each field to be enabled are added to each program.
    • No changes to display files are needed, so programs can be promoted when currently active.
    • Code validation routines and file definitions for the enabled codes are no longer needed in your programs.
    • New programs to allow users to input criteria for reports and extracts are a snap!
    • Examples in RPG, RPGLE, COBOL, and CLP are provided.
    • The system can also be used in batch environment to retrieve descriptive values to be included in reports and extract files.

    User Benefits:

    • Improved accuracy. Invalid keyed entry causes window to pop up allowing the user to select a valid entry.
    • Reliance on printed code lists and manuals is reduced.
    • Improved efficiency. Eyes remain on the screen and keyboard with no need to access the mouse to cause a list box to appear.
    • Selected values are always up to date from the code or table files.
    • Improved customer service as entries can be selected with customer consent when in phone contact.

    Click here to learn more about Super/Windows.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: mgo_rc, Volume 2, Number 70 -- September 13, 2002

    Sponsored by
    PERFSCAN

    Revolutionary Performance Management Software

    At Greymine, we recognize there is a void in the IT world for a dedicated performance management company and also for a performance management tool that’s modern, easy to use, and doesn’t cost an arm and a leg. That’s why we created PERFSCAN.

    PERFSCAN is designed to make your job easier. With revolutionary technology, an easy-to-read report and graphics engine, and real time monitoring, tasks that used to take days can now take minutes. This means you will know your system better and will be able to provide better service to your customers.

    OUR FEATURES

    PERFSCAN is full of robust features that don’t require you to take a three-day class in order to use the product effectively.

    Customizable Performance Reporting

    Whether you are troubleshooting a major system problem or simply creating a monthly report, PERFSCAN lets you select any combination of desired performance metrics (CPU, Disk, and Memory).

    User Defined Performance Guidelines

    No matter if you are a managed service provider managing complex systems in the cloud or a customer analyzing your on-premises solution, PERFSCAN gives you the flexibility to define all mission critical guidelines how they need to be.

    Understanding The Impact Of Change

    Tired of all the finger pointing when performance is suffering? PERFSCAN’s innovative What’s Changed and Period vs. Period analysis creates a culture of proof by correlating known environmental changes with system performance metrics.

    Comprehensive Executive Summary

    Creating performance graphs is easy. Understanding what they mean is another thing. With one mouse click, PERFSCAN includes an easy-to-understand executive summary for each core metric analyzed.

    Combined Real-Time Monitor And Performance Analysis Tool

    With PERFSCAN’s combined built in enterprise real-time monitor and historical performance analysis capability, you will always know how your mission-critical systems are performing.

    Cloud Performance Reporting Is Easy

    Managing performance for production systems in the cloud can be a black hole to many system administrators. The good news is PERFSCAN analyzes all core metrics regardless of the location. That’s why MSPs and customers love PERFSCAN.

    Detailed Job Analysis

    PERFSCAN shows detailed top job analysis for any desired period. All metrics are displayed in two ways: Traditional Report and Percentage Breakdown Pie Chart. This toggle capability instantly shows the jobs using the most system resources.

    Save Report Capability

    Your boss lost the report you gave to him on Friday. Now what do you do? With PERFSCAN’s save report capability, any report can be retrieved in a matter of seconds.

    Professional PDF Reporting With Branding

    Creating professional looking reports for your customers has never been easier with PERFSCAN. Branding for our partners and service provider customers is easy with PERFSCAN.

    Check it out at perfscan.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Adding Subprocedures to a Service Program, Revisited Reader Feedback and Insights: More Binder Language

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 70

This Issue Sponsored By

    Table of Contents

    • Reader Feedback and Insights: Binder Language
    • Put Users On the Fast Track
    • Properly Sorting Numeric Arrays

    Content archive

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

    Recent Posts

    • 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
    • Critical Security Vulnerability In PowerVM Hypervisor
    • IBM Power: Hosted On-Premises Or In The Cloud?
    • Guru: Watch Out For This Pitfall When Working With Integer Columns
    • As I See It: Bob-the-Bot
    • IBM i PTF Guide, Volume 25, Number 21

    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