When the RPGCLEAR operation is applied to a record-format name, only output fields in the record format are cleared; input-only fields are not affected by the CLEAR operation. If you need to use the CLEAR operation on input-only fields, try this simple technique.
1. Define a data structure with an external description. Use the name of the input file as the external file.
2. Give the data structure a name (positions 7-12).
3. Use the CLEAR operation code with the data structure name in Factor 2.
All numeric fields will be set to zero, and all character fields will be set to blanks. For an example of this technique, see 6. If you are currently using a series of statements to move blanks or zeros to each field in the file, this technique can ensure that all the fields will be clear should the record format change.
All numeric fields will be set to zero, and all character fields will be set to blanks. For an example of this technique, see Figure 6. If you are currently using a series of statements to move blanks or zeros to each field in the file, this technique can ensure that all the fields will be clear should the record format change.
? Paul Jackson
TechTalk: CLEAR Op Code on Input-only Fields
Figure 6: Using CLEAR on Input-only Fields
*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 FCUSTMASTIF E K DISK ICSTDTA E DSCUSTMAST * C CUSTNO CHAINCUSTMAST 99 C *IN99 IFEQ *OFF * . * . * . C ELSE C CLEARCSTDTA C ENDIF * C MOVE *ON *INLR *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
LATEST COMMENTS
MC Press Online