Test for a decimal error.

105 pts.
Tags:
data decimal error
Is there a way to test a numeric field in RPG V5R4 to see if it is about to cause a data decimal error. I'm moving a numeric field into a charatcer field and then the Decimal data error appears. When I do an f11 over the numeric field ..its blank.

Software/Hardware used:
as/400 i-series

Answer Wiki

Thanks. We'll let you know when a new response is added.

.

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

    I'm moving a numeric field into a charatcer field and then the Decimal data error appears

    Moving to a character field shouldn't cause a "decimal data error". Please copy/paste the data definitions and the statements surrounding the point of error. We can provide more help if we know more about the circumstances. It's likely that seeing some of your code will lead to more questions, but an answer might be immediately available.

    Tom

    125,585 pointsBadges:
    report
  • philpl1jb

    If the numeric field is blank (not zero) that's an error.

    In RPG IV (RPG ILE) the command with a potential problem can be placed in a monitor block to capture the error

    Monitor

    Move MyNum MyChar

    On-Error

    ...

    EndMon

     

    49,570 pointsBadges:
    report
  • UARTJ

    The MONITOR opcode is exactly what I needed thanks.

    105 pointsBadges:
    report
  • philpl1jb

    Thanks for the feedback.

    I worry that whatever is causing that field to be blank should be a concern.

    49,570 pointsBadges:
    report
  • ToddN2000

    Moving to a char field should not be an issue. It may just be that that is the line in error and your decimal field is failing. Where is this data coming from? Can you view it using another method, STRDFU, SQL ? You can check you decimal field using the following code

    C                   TESTN                   DIGITS               98        TEST NUMERIC
    C  N98              GOTO      TSTN01                                       ERROR......
    8,500 pointsBadges:
    report
  • philpl1jb

    Todd

    Isn't Testn used to test a character field to determine if it's numeric?

    This appears to be a failure because a numeric field is invalid.  The attempted move is " a numeric field into a charater field ".  What RPG does on a move from numeric might be more complicated then we would think.

    Phil

    49,570 pointsBadges:
    report
  • TomLiotta
    Both RPG/400 and ILE RPG can handle moving blank-filled numeric fields to character variables without decimal-data errors if compiled to do so. (See help for the IGNDECERR() and FIXNBR() parameters on the CRTxxx commands.) But they probably shouldn't be allowed to get that far. If we can look at definitions and the code that leads up to the error, it should be possible to eliminate it. MONITOR is worth it to catch problems as long as it's understood how the problems should be handled. -- 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