Problem while using SSCANF funtion in RPGLE!

435 pts.
Tags:
AS/400
RPGLE
Hi, I am trying to check whether a string is numeric or not so for that I'm using SSCANF but every time its giving me return a 0 . Not sure what I'm doing wrong! Below is my code: [code] D sscanf pr 10i 0 extproc('sscanf') D source * value options(*string) D format * value options(*string) D Variable1 * value options(*nopass) D Variable2 * value options(*nopass) D number s 100a varying inz(*blanks) D i s 10i 0 number='1234'; sscanf(%trim(number):'%[0-9]':%addr(i)); *inlr='1'; [/code] I am always getting i=0 ideally it should be 1234 ... Please suggest!

Software/Hardware used:
as400

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: 1  Reply

 
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
    Given your format string, I'd expect that the argument-list variable would have to be an array of chars (including room for a null-terminator). I can't see how it would ever predictably map to an RPG signed integer. -- 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