24
Sun, Nov
1 New Articles

Subfile Scroll Bars

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

If some of your workstations support pointer devices (i.e., a mouse), you may want to consider adding scroll bars to your subfile programs. This nifty new feature can give some of your tired, old subfile programs a new look, and it can add a little glitz and glamour to your software programs.

The scroll bar has been a mainstay of graphical operating environments such as OS/2 and Windows for a long time. If you have ever run an application under any of these operating systems, you already know what the scroll bar is all about.

The AS/400 scroll bar works much as it would with the other graphical interfaces, in that it has a scroll box to indicate how big the subfile is and where you are within it. The mouse pointer can be positioned on the scroll bar's up or down arrows, and the subfile will move forward and back one record at a time when the mouse button is pressed. (Shifting the subfile one record at a time wasn't something you could do very easily until now.) The mouse can also be used to drag the scroll box to the desired position within the subfile.

The new scroll bar feature was made available as part of V3R1. You will get three different results depending on the type of workstation you use.

1. The best results are with intelligent workstations using certain emulation software such as RUMBA/400 and PC400 or InfoWindow II terminal displays (3486, 3487, or 3488) attached to an enhanced interface controller. With these types of workstations, the scroll bar will be displayed graphically and the mouse can be used to position the scroll bar.

2. Some terminals attached to the enhanced interface controller or intelligent workstations using certain emulation software (e.g., PC Support WSF) will display the scroll bar in character mode. In this environment, mouse support is unavailable; paging is accomplished through use of the roll keys or page keys.

3. Some terminals attached to the enhanced controller, all terminals attached to the non-enhanced controller, and intelligent terminals attached through certain emulation software (e.g., OS/2 Communication Manager) won't display the scroll bar. The display file acts as if the scroll bar function wasn't specified.

In this article, we'll show you how to implement scroll bars into your subfile programs. We're going to be discussing some specific subfile techniques, so we'll assume that you have at least a basic understanding of subfile concepts. The techniques we'll be showing you will enable you to enhance both the appearance and the functionality of your subfile programs.

What Has to Be Done to Start?

To activate the graphical scroll bar, simply specify the new *SCRBAR output option parameter for the DDS Subfile End (SFLEND) keyword. Before you change all of your subfiles, there are a few things you should consider.

If you use the *SCRBAR parameter in the SFLEND keyword, the three rightmost characters of your subfile record must not be used to leave room for the scroll bar to appear on the screen. This restriction is similar to the extra blank line that must be left below your subfile when using the *MORE parameter of the SFLEND keyword.

By the very nature of the page-at-a-time and load-all styles of subfiles, the scroll bar option is a lot more functional with the latter than it is with the former. If you use a page-at-a-time subfile, the scroll box within the scroll bar could be somewhat misleading because it represents the number of records that are currently in the subfile and not those that could ultimately end up there. When utilized in a load-all subfile, the scroll box is a much fairer representation of the relative position your display is at within the file. The reason for this is because all of the records are written to the subfile before it is ever displayed.

1 shows what the subfile scroll bar looks like for a sample subfile program that displays a list of state codes. The display file (SCR002DF) can be found in 2, and the RPG program (SCR002RG) can be found in 3. This example was run on a PC using IBM's PC400 emulation connectivity product. It would also work on a PC using RUMBA/400 or Client Access PC5250 emulation.

Figure 1 shows what the subfile scroll bar looks like for a sample subfile program that displays a list of state codes. The display file (SCR002DF) can be found in Figure 2, and the RPG program (SCR002RG) can be found in Figure 3. This example was run on a PC using IBM's PC400 emulation connectivity product. It would also work on a PC using RUMBA/400 or Client Access PC5250 emulation.

The look and feel of the scroll bar you see may vary depending upon the user interface and workstation controller you employ. The AS/400 Application Display Programming manual has a section on hardware configuration which lays out all of the possible workstation and controller combinations and how scroll bars will work with each.

A Few Words About the Code

While there is nothing remarkable about any of the code in this article, a few of the new DDS keywords should be explained.

When using the *SCRBAR parameter of the SFLEND keyword, you can also specify the *MORE or *PLUS parameter. The additional parameter is available so the system will know which option to exercise when the application is run from a non-graphical workstation. We used the *MORE parameter in this example.

The SFLSCROLL keyword used is unique to subfiles that have the scroll bar. When employed, it will return the value of the relative record number of the subfile record that happens to be at the top of the screen when control is returned to the RPG program. Because the subfile paging is handled at the controller level and not within the RPG program, this keyword is valuable when you need to redisplay the subfile at the same page that was displayed before you displayed some other screen.

Take the record number returned from the SFLSCROLL keyword and load it into the hidden field associated with the SFLRCDNBR before you redisplay the subfile. We illustrate this technique in SCR002RG by redisplaying the subfile when the Enter key is pressed. Before we redisplay it, we load the value from the current position (CURPOS) field returned from the SFLSCROLL keyword to the set position (SETPOS) field. Since SETPOS is linked to the SFLRCDNBR keyword, the subfile is forced to display the same page. To see the technique in action, call SCR002RG, page forward at least one page, and press Enter. The same page will be redisplayed.

The RPG program has been coded as a load-all subfile, meaning that the entire subfile is loaded prior to presenting it to the screen. All paging activities will occur at the controller level, so there is no need to code the page or roll keywords into the subfile DDS.

There is one thing we feel we should warn you about. IBM is still working out bugs on V3R1 (as any of us who have it installed are keenly aware). We experienced several quirks in the operation of this program depending upon which PTF level we were at that day. The bugs we experienced seemed to be centered around trying to display the subfile within a DDS window. At one point, the system treated an input field on the first subfile record as a protected field (even though subsequent subfile records were fine). At another point, the subfile would paint the screen, but an I/O error would then occur. Removing the window always seemed to take care of the problems, though.

Hooray for Hollywood!

We are confident that IBM will get the glitches worked out. Bugs aside, the scroll bar is a significant addition to our beloved subfile. While the evolution to an AS/400 graphical user environment has at times seemed painstakingly slow, IBM is on the right track.

It is unrealistic to think that all AS/400 shops will be able to afford wonderful client/server tools such as VisualAge or Visual RPG. While the cost of the tools has dropped significantly, the overall cost of redevelopment has not. Personnel cost has and will continue to be the principal cost in redesigning our legacy systems.

Kudos to IBM for continuing to give us tools that allow us to produce better software. Powerful DDS functions such as windows, menu bars, and now scroll bars are very positive steps toward extending the life of AS/400 software (and tired old RPG programmers like us).

Doug Pence is the founder and Ron Hawkins is the research and development manager of Computer Processing Unlimited, Inc. in San Diego, California.

REFERENCE

AS/400 Application Display Programming (SC41-3715, CD-ROM QBKAUK00).

Subfile Scroll Bars

Figure 1: The Subfile Scroll Bar



Subfile Scroll Bars

Figure 2: SCR002DF Display File Utilizing the Subfile Scroll Bar

 *=============================================================== * To compile: * * CRTDSPF FILE(XXX/SCR002DF) SRCFILE(XXX/QDDSSRC) * *=============================================================== *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 A DSPSIZ(24 80 *DS3) A CA03(03) A R SFLRCD SFL A SFDESC 30A O 5 2 A SFLCOD 2A O 5 35 A R SFLCTL SFLCTL(SFLRCD) A OVERLAY A SFLDSP A SFLDSPCTL A N03 SFLEND(*SCRBAR *MORE) A SFLSIZ(0050) A SFLPAG(0017) A SETPOS 4S 0H SFLRCDNBR A CURPOS 5S 0H SFLSCROLL A 2 35'State Codes' A DSPATR(HI) A 4 2'Description' A DSPATR(HI) A 4 34'Code' A DSPATR(HI) A R FOOTER A 23 2'F3-Exit' A COLOR(BLU) *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 
Subfile Scroll Bars

Figure 3: SCR002RG RPG Program Utilizing the Subfile Scroll Bar

 *=============================================================== * To compile: * * CRTRPGPGM PGM(XXX/SCR002RG) SRCFILE(XXX/QRPGSRC) * *=============================================================== *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 FSCR002DFCF E WORKSTN F X KSFILE SFLRCD E ST 1 50 2 STD 30 * C Z-ADD1 SETPOS C DO 50 X 30 C MOVELST,X SFLCOD C MOVELSTD,X SFDESC C WRITESFLRCD C ENDDO * C WRITEFOOTER C EXFMTSFLCTL * * Redisplay subfile at current page * to demonstrate SFLSCROLL keyword C *IN03 IFEQ *OFF C Z-ADDCURPOS SETPOS C WRITEFOOTER C EXFMTSFLCTL C ENDIF * C MOVE *ON *INLR *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ** AKALASKA ALALABAMA ARARKANSAS AZARIZONA CACALIFORNIA COCOLORADO CTCONNECTICUT DEDELAWARE FLFLORIDA GAGEORGIA HIHAWAII IAIOWA IDIDAHO ILILLINOIS ININDIANA KSKANSAS KYKENTUCKY LALOUISIANA MAMASSACHUSETTS MDMARYLAND MEMAINE MIMICHIGAN MNMINNESOTA MOMISSOURI MSMISSISSIPPI MTMONTANA NCNORTH CAROLINA NDNORTH DAKOTA NENEBRASKA NHNEW HAMPSHIRE NJNEW JERSEY NMNEW MEXICO NVNEVADA NYNEW YORK OHOHIO OKOKLAHOMA OROREGON PAPENNSYLVANIA RIRHODE ISLAND SCSOUTH CAROLINA SDSOUTH DAKOTA TNTENNESSEE TXTEXAS UTUTAH VAVIRGINIA VTVERMONT WAWASHINGTON WIWISCONSON WVWEST VIRGINIA WYWYOMING 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: