Remove comma in Numeric field in RPGLE

480 pts.
Tags:
AS400 RPGLE
Hi, Please explain how to remove comma in Numeric field in RPGLE. Value in field1(10s,0) - 1,234,567,890 Thanks Dev

Software/Hardware used:
AS400

Answer Wiki

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

Are you saying the data is stored in an alpha field with the commas in it?

If so, use use ScanRpl      

New_Field=%ScanRpl(‘,’:”Your_Field);      

Discuss This Question: 2  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
  • philpl1jb

    There is no commas in the field .. it's a matter of how you display it. 

    You mention RPGLE but perhaps that has nothing to do with your issue.

    But if you need to display this numeric field in RPGLE in a print or display file you will want to change the Edit Code. That would be error codes 3 or 4.  Or perhapds C or D or L or M or P or Q.

    50,205 pointsBadges:
    report
  • TomLiotta

    A numeric field should never have commas. If it has a comma, it is not "numeric" by definition.

    Any comma would be seen only when the numeric value is transferred to a display screen or printed page for viewing by a human. There are no functions designed for removing characters like commas from numeric fields because numeric fields can't have commas.

    With that said, it is possible to have a numeric field and a character field defined over the same memory addresses. Data can be copied into the character field and can include a comma. That would make the numeric value be invalid.

    It would also make it very difficult to remove the comma without leaving a value that would still be invalid as a numeric value. Removing the comma would cause byte values to shift and would begin padding with blanks.

    The point of all of that is to try to find out exactly what the question is asking. It doesn't make much sense. We need to see the data definitions and the current code that handles the data. And we need to understand what the goal is.

    Please explain what the actual problem is.

    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