• 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
    DRV Tech

    Get More Out of Your IBM i

    With soaring costs, operational data is more critical than ever. IBM shops need faster, easier ways to distribute IBM applications-based data to users more efficiently, no matter where they are.

    The Problem:

    For Users, IBM Data Can Be Difficult to Get To

    IBM Applications generate reports as spooled files, originally designed to be printed. Often those reports are packed together with so much data it makes them difficult to read. Add to that hardcopy is a pain to distribute. User-friendly formats like Excel and PDF are better, offering sorting, searching, and easy portability but getting IBM reports into these formats can be tricky without the right tools.

    The Solution:

    IBM i Reports can easily be converted to easy to read and share formats like Excel and PDF and Delivered by Email

    Converting IBM i, iSeries, and AS400 reports into Excel and PDF is now a lot easier with SpoolFlex software by DRV Tech.  If you or your users are still doing this manually, think how much time is wasted dragging and reformatting to make a report readable. How much time would be saved if they were automatically formatted correctly and delivered to one or multiple recipients.

    SpoolFlex converts spooled files to Excel and PDF, automatically emailing them, and saving copies to network shared folders. SpoolFlex converts complex reports to Excel, removing unwanted headers, splitting large reports out for individual recipients, and delivering to users whether they are at the office or working from home.

    Watch our 2-minute video and see DRV’s powerful SpoolFlex software can solve your file conversion challenges.

    Watch Video

    DRV Tech

    www.drvtech.com

    866.378.3366

    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

    • 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