CONDITIONS FOR DECIMAL DATA ERRORS


Depending on the conditions where a decimal data error occurs, results vary. In most situations, however, the result can be predicted. There are two primary conditions under which decimal data errors occur. They are:

  • On a read to a database file (externally described or program described).

  • On an operation code that attempts to copy invalid decimal data to a numeric field.

Decimal Data Error upon an Input Operation to a Database File

When a record is read from a database file, its data is copied to an "input buffer." This buffer is separate from the file's input specifications. After the data from the file is copied to the input buffer, it is copied, on a field-by-field basis, to the input area of the program. The input area is the file's input specifications.

At the point at which data is copied from the input buffer to the input area, decimal data errors do not occur. If the database record contains invalid data, it is copied to the input buffer as is. Decimal data errors can occur when one of the numeric input fields (for example, a packed decimal field) is copied to another packed decimal field. Another time a decimal data error occurs is when a field containing invalid decimal data is written to the database.

Unlike previous versions of RPG, RPG IV always returns the data from an input operation even when a decimal data error could be detected. This means the data in the input area of the program always represents the actual data in the database file.

Data is returned regardless of the FIXNBR option. In previous versions of RPG, when a decimal data error occurred during an input operation, the data from the previous input operation was retained—causing some interesting side effects. The RPG IV method of handling decimal data, while not as complete as it could be, is certainly a major step in correcting data problems.




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net