Can you please tell me what a Decimal Data error is, and what is the scenario in which it is received?
Fields declared as numeric in files and in programs will be checked to see if they contain valid numbers when the data in them is used in a program. If they are NOT valid numbers, this is a Decimal Data Error, and unless the error is trapped in the program the program will fall over.
For example, if you receive data from another computer into a file on your system, that data might be wrong. It could contain blanks where the field defined on your machine expects a number. When the file is opened by a program and the record containing the invalid data is read, you will not get an error. But if the field containing the invalid data is read in the program, by being the Factor1 of a MOVEx operation, or either factor in an ADD, SUB, DIV, MULT etc., or on the right-hand side of an EVAL, or if it is involved in a WRITE or UPDATE operation -- then it will be checked, and then the program will fail.
If you regularly receive files that contain invalid data, and you need to correct that data, you will have to declare the fields as character and use TESTN or CHECK (or some other method) to check that the field contains valid numbers and correct the data if it does not.
Sometimes the problem occurs when a numeric field is overlaid with a different numeric definition in a data structure. For example, if you have a PACKED numeric field in the record, and the programmer defines the field as ZONED in a data structure, the zoned field will contain data in a form which is invalid for a zoned field, even though it IS valid for a packed field. In such cases, it's just a matter of taking care.
Dig Deeper on DB2 UDB (universal databases)
Related Q&A from John Blenkinsop
When an error occurs on an IBM command, the diagnostic messages are sent first, then an escape message, which you can monitor. On AS/400 you see the ... Continue Reading
Learn how to 'append data to the file' with the FTP DIR command, and eliminate the hassle of having to end the FTP session and restart to view ... Continue Reading
RPGIV will 'think of' incoming integer fields as binary, and then will redefine them in the program structures as PACKED. So, when you chain a record... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.