• 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
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

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

    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

    • Progress And Frustration With IBM i Security, Fortra Finds
    • In The Trenches With: JAMS Software
    • Guru: Where’s The Table?
    • Lightedge To Start Selling IBM PowerVS to IBM i Customers
    • IBM i PTF Guide, Volume 28, Number 20
    • Big Blue Unveils Bob Premium Pack For IBM i
    • Midrange Dynamics Sees Solid Git Adoption On IBM i
    • Guru: SQL Sequences In RPG Let Db2 Handle The Counting
    • From Green Screens To Smart Factories: Explaining DevOps To The Next Gen IBM i Developers
    • IBM i PTF Guide, Volume 28, Numbers 18 And 19

    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