• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Easy Subfile Windowing

    June 28, 2002 Timothy Prickett Morgan

    Hey, Ted:

    I have a subfile application that requires more than 80 columns to display all the necessary information.

    I don’t want the information folded to a second line but would like to window left and right, as the Display Physical File Member (DSPPFM) command does.

    It would be better if I could lock into place the far-left side of a screen to allow a selection field, even when panning left or right.

    Can this be done easily with a subfile?

    — David

    Yes, David. You only need to think of building subfiles in a way that you’re probably not accustomed to doing. Instead of defining each individual field in the subfile record, define one long text field. Load pieces of this long text field with values from your database.

    Let’s assume you have a file called CUSTOMER with the following description:

         A                                      UNIQUE 
         A          R CUSTREC                          
         A            COMPANY        3P 0              
         A            CUSTNBR        5P 0              
         A            CUSTNAME      20                 
         A            CADDRESS1     18                 
         A            CADDRESS2     18                 
         A            CCITY         16                 
         A            CSTATE         2                 
         A            CZIP          10                 
         A            CREDITLIM      7S 2              
         A          K COMPANY                          
         A          K CUSTNBR                          
    

    You want to display records from the customer file in a subfile and you want to be able to window the customer data right and left. Here’s the display file. Notice the VISIBLE and HIDDEN fields in the subfile record:

         A                                      DSPSIZ(24 80 *DS3) 
         A          R SFL                       SFL                
         A            OPTION         1   I  5  2                   
         A            VISIBLE       76A  O  5  4                   
         A            HIDDEN       256A  H                         
         A          R CTL                       SFLCTL(SFL)        
         A                                      SFLSIZ(0011)       
         A                                      SFLPAG(0010)       
         A                                      SFLDSPCTL          
         A                                      SFLDSP             
         A                                      CA03(03)           
         A                                  3  2'Window:'          
         A            WINDOW         3  0B  3 10                
    

    Here’s the RPG program that drives the subfile:

         Fbigdta02d cf   e             workstn sfile(sfl:rrn)
         Fcustomer  if   e           k disk
    
         D rrn             s             10u 0
         D sflsize         s             10u 0
         D windowsave      s             10u 0 inz(0)
         D len             s             10u 0
    
          ** one-time only calcs
    
         C                   eval      len = %size(visible)
         C                   eval      window = 1
    
          ** load the subfile
    
         C                   read      custrec
         C                   dow       not %eof(customer)
         C                   eval      rrn = rrn + 1
         C                   eval      hidden = %editc(company:'4') + ' ' +
         C                                      %editc(custnbr:'4') + ' ' +
         C                                      caddress1 + ' ' +
         C                                      caddress2 + ' ' +
         C                                      ccity + ' ' +
         C                                      cstate + ' ' +
         C                                      czip + ' ' +
         C                                      %editc(creditlim:'J')
         C                   write     sfl
         C                   read      custrec
         C                   enddo
         C                   eval      sflsize = rrn
    
          * display the subfile until F3 pressed
    
         C                   dou       *in03
         C                   if        window <> windowsave
         C                   exsr      adjust
         C                   endif
         C                   exfmt     ctl
         C                   enddo
         C
         C                   eval      *inlr = *on
         C*****
         C     adjust        begsr
         C
         C                   for       rrn = 1 to sflsize
         C     rrn           chain     sfl
         C                   eval      visible = %subst(hidden: window: len)
         C                   update    sfl
         C                   endfor
         C
         C                   eval      windowsave = window
         C
         C                   endsr
    

    The HIDDEN field is loaded with the fields from the CUSTOMER file. I used the %editc built-in function to place the numeric fields into HIDDEN. The ADJUST subroutine copies a portion of HIDDEN into VISIBLE–the field the user sees–beginning at the position the user specified by keying in a value for the WINDOW field.

    The following screen shots show the data windowed to positions 1 and 25 respectively.


    Figure One


    Figure Two

    — Ted

    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 50 -- June 28, 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

    Service Program Catch-22 Reader Feedback and Insights: Avoiding Object Locks

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 50

This Issue Sponsored By

    Table of Contents

    • Determining Whether a User Is Already Signed On, Take Three
    • Easy Subfile Windowing
    • Distinct File and Record Names with SQL

    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