Decimal data error – AS/400 question

440 pts.
Tags:
AS/400
AS/400 error messages
AS/400 question: Why do we get a decimal data error at first place? As per my understanding, When there are incorrect attributes (i.e, character being moved to numeric or numeric being moved to character or data lengths not matching), that could cause this error. But, when you can actually do a move operation and it doesn’t throw any error, and you have %char built in functions and all to covert numeric to character, why should a decimal data error come? Can anyone please help me with this question? Thanks.
ASKED: February 6, 2013  8:18 AM
UPDATED: February 7, 2013  2:49 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 7  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    The question doesn't make much sense. A MOVE generally doesn't cause decimal data errors at all, and conversion to character generally has little relationship to decimal data errors. The errors always have the same cause: Memory has bytes that the program defines as decimal data, but the bytes don't contain decimal data values. When the program attempts an arithmetic operation, the operation fails. -- Tom
    125,585 pointsBadges:
    report
  • ToddN2000
    Another reason is your arithmetic operation may produce a result that will not fit in your result filed. Take a dump and check the values of the fields being used in you calculation. See if the resulting data valid. Another culprit can be when working with packed fields defined in a program.
    6,360 pointsBadges:
    report
  • ToddN2000
    Just another though is this data being used as a parameter ?
    6,360 pointsBadges:
    report
  • TomLiotta
    ...arithmetic operation may produce a result that will not fit in your result filed.   That should cause overflow rather than a decimal data error.   Tom
    125,585 pointsBadges:
    report
  • bvining
    Most decimal data errors I have found are not caused by MOVE operations or similiar explicit actions, rather they are due to zoned or packed decimal fields being defined as sub-fields within a data structure and the user not realizing that a data structure is generally initialized to blanks (x'40's). If the application does not assign a valid numeric value to such a numeric sub-field, but does write the field to a database record, then what's stored are those blanks. One of those blank bytes is going to be trying to represent the sign of the zoned/packed field, and a x'40' does not represent a valid sign for either data type. The result -- a decimal data error when "someone" later tries to use the numeric field.
    6,240 pointsBadges:
    report
  • juslikdat1
    Thanks for the replies. I have a query wrt the below code:I am trying a simple code:PAR 1 Program:C                   CALL      'PAR2'                              C                   PARM      10            FLD1              2 0 C                   PARM      10            FLD2              2 0 C                   PARM      10            FLD3              2 0 C                   EVAL      *INLR = *ON                         In the PAR 2 program:DRES              S              3  0                              C     *ENTRY        PLIST                                          C                   PARM                    A                 2 0  C                   PARM                    B                 2 0  C                   PARM                    C                 2    C*                  EVAL      RES = A+B+C                          C     RES           DSPLY                                          C                   EVAL      *INLR = *ON                          Now when the parameters are being received, though FLD 3 has been declared as numeric in PAR 1 program but character in PAR 2 program (C) it didnt throw any decimal data error. As far as I know, when other than numeric data (char, special characters) is moved into Numeric field then decimal data error occurs. But that doesnt happen above.
    440 pointsBadges:
    report
  • TomLiotta
    ...when the parameters are being received, though FLD 3 has been declared as numeric in PAR 1 program but character in PAR 2 program (C) it didnt throw any decimal data error.   And it should not throw a decimal data error. The programs do not perform any operation that can fail from a decimal data error.   As far as I know, when other than numeric data (char, special characters) is moved into Numeric field then decimal data error occurs.   There might be some "move" operations that can throw a decimal data error. I can't think of any right now. In general, your statement is false.   But that doesnt happen above.   Good. It's not supposed to happen.   Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following