24
Wed, Apr
0 New Articles

Turbocharge Remote Applications

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

Brief: Remote access to the AS/400 can be painfully slow. This article describes a simple programming technique that can significantly improve response time.

Applications running on remote workstations generally have much slower response times than those running on locally attached workstations. If you've ever worked on a remotely attached workstation, you know what I'm talking about. You can actually watch the screen "paint," several lines at a time, from the top of the screen to the bottom. Even with today's faster modem speeds and data- compression algorithms, running an application on a remote workstation can be a frustrating experience.

Fortunately, there are a few DDS keywords which can help improve the response time of applications running under these conditions. I'll show you how you can code your display files to reduce the amount of data being sent to a workstation. The application screens will look the same to the end user, but they will refresh much more quickly. To prove this, I ran a test by dialing in to MC's AS/400 at 9600bps. I ran a typical application program twice. The first time, the display file did not contain any of the keywords discussed in this article. My response time was around 3 seconds per transaction. By adding these keywords to the display file, my response time improved to almost 1 second per transaction!

Even if you currently do not have any remote users accessing your applications, you may still want to use this technique. Response time for local users would improve slightly, though probably not noticeably. However, you would be better prepared to meet the growing demand for remote access to AS/400 applications in the future.

The Problem

Most applications are not written with the remote user in mind. It's not too difficult to understand why this happens. Programmers usually have an office located near the computer room. They develop applications on locally attached workstations; when they test the applications, they find that the response time is very good. When a remote user runs this same application, the response time is unacceptably slow. If the user complains, the programmer usually blames the communications hardware for the poor response time. After all, everyone knows that remote connections through modems are slower than local connections. A simple display file programming technique can improve re-sponse time for applications run by remote users. I've developed a sample application that shows how to accomplish this.

A Typical Example

A typical application screen consists of a number of fields and constants. Often, the same screen needs to be presented to a user more than once. For example, consider the customer inquiry screen shown in 1. When the user selects a customer number, he is presented with the customer name and address. He selects another customer number and obtains a different name and address in the same screen format. Each time the user makes a selection, he sees the same screen with different names and addresses.

A typical application screen consists of a number of fields and constants. Often, the same screen needs to be presented to a user more than once. For example, consider the customer inquiry screen shown in Figure 1. When the user selects a customer number, he is presented with the customer name and address. He selects another customer number and obtains a different name and address in the same screen format. Each time the user makes a selection, he sees the same screen with different names and addresses.

Now think about what happens internally when this application is run. Every time the user selects a new customer number, OS/400 sends all of the fields and constants to the user's workstation. The fields containing customer information need to be sent each time, since they're changing for each customer. But what about the constants? They don't change from one customer to the next. Even though the constants are already on the screen, OS/400 sends them anyway. This causes more data to be sent than necessary. With a remote workstation, this unnecessary transmission of data can degrade response time noticeably.

To make matters worse, an attribute byte precedes every field and constant on the screen. These bytes control screen attributes such as normal, high intensity and reverse image. These bytes are also sent to the workstation, adding to the traffic on the line.

DDS to the Rescue

DDS gives you an effective way to deal with this situation. By adding a few keywords to your display file, you can control which fields, constants and attributes OS/400 sends to the workstation. Instead of sending the whole screen, you can send only the portions of the screen which have changed since the last time the screen was sent.

To make this technique work, place the Put with Explicit Override (PUTOVR) keyword at the record level of your display file. This prevents the transmission of constants, fields and attributes after the first write of the display file record. On all subsequent writes of this record, OS/400 will send the fields or attributes only if they are explicitly overridden.

To override a field, specify the Override Data (OVRDTA) keyword on the field you want to override. This keyword causes OS/400 to send both the field and its attribute to the workstation. Specify the Override Attribute (OVRATR) keyword on a field or constant to override an attribute. This causes only the attribute byte to be sent. 2 provides an overview of the data sent to the workstation when these keywords are applied.

To override a field, specify the Override Data (OVRDTA) keyword on the field you want to override. This keyword causes OS/400 to send both the field and its attribute to the workstation. Specify the Override Attribute (OVRATR) keyword on a field or constant to override an attribute. This causes only the attribute byte to be sent. Figure 2 provides an overview of the data sent to the workstation when these keywords are applied.

As with most DDS keywords, there are a few restrictions. First, you can't use the PUTOVR keyword in a subfile record, or in a record format which contains the PUTRETAIN keyword (a similar but less effective keyword than PUTOVR). One final restriction: you can't specify OVRDTA on a constant. Now that you know when not to use these keywords, let's look at an example which shows how you can use them.

3 shows the DDS for the display file used in the customer inquiry application discussed earlier. To keep this example simple, I've used only the PUTOVR and OVRDTA keywords. (OVRATR appears in a later example.)

Figure 3 shows the DDS for the display file used in the customer inquiry application discussed earlier. To keep this example simple, I've used only the PUTOVR and OVRDTA keywords. (OVRATR appears in a later example.)

The PUTOVR keyword is only in effect if the record is already on the display. The first time the RMTDSP record is written, the system automatically ignores the PUTOVR keyword-all fields and constants are sent to the workstation. When the user enters a customer number, the program loads the screen fields with customer information and resends the RMTDSP record. This time, the record is already displayed on the screen, so the PUTOVR keyword is active. PUTOVR keeps OS/400 from sending constants, such as the heading and field prompts. Instead, the screen simply retains the constants from the first write of the record format. OS/400 resends to the workstation only those fields which have the OVRDTA keyword specified (in this example, the customer address information). Sending only those fields decreases the amount of data transmitted which substantially improves response time.

Sending Attributes

The sample display file in 1 contains no special attributes, but most display files are more complex than this. For example, you may need to change a display attribute to high intensity or reverse image to alert the user to an error condition. You can use the OVRATR keyword to accomplish this.

The sample display file in Figure 1 contains no special attributes, but most display files are more complex than this. For example, you may need to change a display attribute to high intensity or reverse image to alert the user to an error condition. You can use the OVRATR keyword to accomplish this.

4 shows some partial DDS for another display file. This example contains one constant and one field. The constant, 'Status code', is displayed as either normal or high intensity, depending on the condition of indicator 30. The STSCDE field is displayed as normal or reverse image, depending on the condition of indicator 40. I've coded the OVRATR keyword in both cases, to point out the effect it has on display file efficiency.

Figure 4 shows some partial DDS for another display file. This example contains one constant and one field. The constant, 'Status code', is displayed as either normal or high intensity, depending on the condition of indicator 30. The STSCDE field is displayed as normal or reverse image, depending on the condition of indicator 40. I've coded the OVRATR keyword in both cases, to point out the effect it has on display file efficiency.

Assume that both indicators are off when the program is called. The program ignores the PUTOVR keyword the first time the record format is written to the screen. The constants, fields, and attributes are all sent to the workstation. Since OVRATR is specified on the 'Status code' constant, OS/400 resends the constant's attribute byte to the workstation for every subsequent write of the record format. When indicator 30 is off, the normal attribute is sent. When indicator 30 is on, the high-intensity attribute is sent. In either case, the constant itself is not resent to the workstation.

The STSCDE field behaves in a similar fashion. Since the OVRATR keyword is specified, the attribute byte for the field is always sent to the workstation. In this case, when indicator 40 is off, the normal attribute is sent. When indicator 40 is on, the reverse-image attribute is sent. STSCDE is an input- capable field, making it unnecessary to resend the contents of the field to the workstation. (Since the user supplies the value for this field, the program can simply leave the value on the screen unmodified.) Therefore, I used the OVRATR keyword instead of the OVRDTA keyword.

Changing screen attributes with this technique can be extremely efficient. A screen containing 24 rows and 80 columns could contain as many as 1920 bytes of data. If you need to change one attribute on a crowded screen, the difference in response times with and without this technique can be substantial.

Remember Your Remote Users

The technique described in this article can give remote users much better response time with very little effort on your part. DDS gives you the ability to decide how much data to send to a workstation. It's up to you to take advantage of this capability. If you keep these techniques in mind when you code your applications, you will reduce not only the amount of traffic on the communication line but also the frustration level of your remote users.

Robin Klima is a senior technical editor at Midrange Computing.

REFERENCES DDS Reference (SC41-9620, CD-ROM QBKA7402). Guide to Programming Displays (SC41-0011, CD-ROM QBKA7902).


Turbocharge Remote Applications

Figure 1 Customer Inquiry Screen

 Customer Inquiry Customer number . . . 53157 Customer name . . . . GEORGE HENDERSON Address . . . . . . . 938 PALM DR City . . . . . . . . LOS ANGELES State . . . . . . . . CA Zip code . . . . . . 90846 F3=Exit 
Turbocharge Remote Applications

Figure 2 Data Sent on Subsequent Writes

 UNABLE TO REPRODUCE GRAPHICS 
Turbocharge Remote Applications

Figure 3 Example Using OVRDTA Keyword

 *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 A R RMTDSP A PUTOVR A 1 33'Customer Inquiry' A DSPATR(HI) A 5 2'Customer number . . .' A CSNUM 5 B 5 25 A 7 2'Customer name . . . .' A CSNAME 25 O 7 25 A OVRDTA A 9 2'Address . . . . . . .' A CSADDR 25 O 9 25 A OVRDTA A 11 2'City . . . . . . . .' A CSCITY 15 O 11 25 A OVRDTA A 13 2'State . . . . . . . .' A CSSTAT 2 O 13 25 A OVRDTA A 15 2'Zip code . . . . . .' A CSZIP 5 O 15 25 A OVRDTA A 23 2'F3=Exit' A COLOR(BLU) *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 
Turbocharge Remote Applications

Figure 4 Example Using OVRATR Keyword

 *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 A R RMTDSP A PUTOVR A 5 2'Status code' A OVRATR A 30 DSPATR(HI) A STSCDE 1 B 5 15 A OVRATR A 40 DSPATR(RI) *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

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: