The January 1986 issue of DataNetwork (now Midrange Computing) included the article, "Indicator Integrity Through Subroutines." The idea was that you can save the current settings of selected or all indicators when calling subroutines that might alter the indicators.
Two techniques were presented in that article, one using bit fields to store the settings (see also the August 1990 issue of Midrange Computing, "Using Bit Fields as Data"), the other using a character array of up to 99 elements to store the settings.
By making use of the RPG/400 predefined *IN array, the technique can be greatly simplified. The RPG/400 Reference (SC09-1089) gives an example of this technique on page 3/36; see 1. The idea here is that all of the numeric indicators, 01 - 99, are mapped into the *IN array. The settings of a contiguous group of indicators can be saved by moving the *IN array to a save field, then restoring the save field into the *IN array. Using the same technique, you can also save all 99 indicators, simply by using a larger save field and applying the MOVEA to the entire *IN array, as in 2.
By making use of the RPG/400 predefined *IN array, the technique can be greatly simplified. The RPG/400 Reference (SC09-1089) gives an example of this technique on page 3/36; see Figure 1. The idea here is that all of the numeric indicators, 01 - 99, are mapped into the *IN array. The settings of a contiguous group of indicators can be saved by moving the *IN array to a save field, then restoring the save field into the *IN array. Using the same technique, you can also save all 99 indicators, simply by using a larger save field and applying the MOVEA to the entire *IN array, as in Figure 2.
This technique can also be used for nested subroutines, if you use a separate save field for each subroutine.
Craig Pelkie San Mateo, California
TechTalk: "Local" Indicators
Figure 1 Saving selected contiguous indicators 61 - 68
Figure 1: Saving Selected Contiguous Indicators 61 - 68 .30....+...40....+...50....+ MOVEA*IN,61 SAV8 8 EXSR SUB1 MOVEASAV8 *IN,61
TechTalk: "Local" Indicators
Figure 2 Saving all numeric indicators
Figure 2: Saving All Numeric Indicators .30....+...40....+...50....+ MOVEA*IN SAV99 99 EXSR SUB1 MOVEASAV99 *IN
LATEST COMMENTS
MC Press Online