I/O operations are the slowest part of a program, because disk drives are not nearly as fast as memory. You can speed up a program by replacing disk operations with operations to memory or by eliminating unnecessary disk operations.
Suppose you have an employee master file that has a department number field telling which department an employee works in; a department master file keyed on department number, which also identifies the department; and a payroll program that reads the employee master file sequentially and chains to the department master file to get the department description (see 4).
Suppose you have an employee master file that has a department number field telling which department an employee works in; a department master file keyed on department number, which also identifies the department; and a payroll program that reads the employee master file sequentially and chains to the department master file to get the department description (see Figure 4).
To speed up this application, use a memory operation instead of a disk operation. Replace the random reads (RPG CHAIN) with array lookups. Read the entire department master file into an array at program initialization. Then, instead of chaining to the department master file to determine the department, look up the department in the array as shown in 5.
To speed up this application, use a memory operation instead of a disk operation. Replace the random reads (RPG CHAIN) with array lookups. Read the entire department master file into an array at program initialization. Then, instead of chaining to the department master file to determine the department, look up the department in the array as shown in Figure 5.
Another technique is to eliminate any unnecessary file I/O. If your file is too big to fit in a table or array, or you usually only access a few records, chain only if necessary. Save the department number in a variable, and chain only if the department number in an employee master record is different from the one saved in the variable, as shown in 6.
Another technique is to eliminate any unnecessary file I/O. If your file is too big to fit in a table or array, or you usually only access a few records, chain only if necessary. Save the department number in a variable, and chain only if the department number in an employee master record is different from the one saved in the variable, as shown in Figure 6.
I/O Speed Demons
Figure 4 Sample Application
*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 FEMPMAST IF E K DISK FDPTMAST IF E K DISK * C READ EMPREC LR C *INLR DOWEQ*OFF * C EM#DPT CHAINDPTREC 99 C *IN99 IFEQ *OFF . . . C ENDIF * C READ EMPREC LR C ENDDO
I/O Speed Demons
Figure 5 Reducing I/O with Array Lookups
*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 C EM#DPT LOKUPDPT,X 99 C *IN99 IFEQ *OFF . . . C ENDIF
I/O Speed Demons
Figure 6 Reducing I/O with a Save Field
*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 C EM#DPT IFNE SAVDPT C EM#DPT CHAINDPTREC 99 C *IN99 IFEQ *OFF . . . C ENDIF C MOVE EM#DPT SAVDPT C ENDIF





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.
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:
LATEST COMMENTS
MC Press Online