Skip to Content
author's profile photo Former Member
Former Member

Checking for chars or numbers in i string

Hi,

I need to convert a varibale of type char10 to integer. Exampple: ZCHAR: '0000144210' to ZINT: 144210; for instance with following statement: ZINT=ZCHAR

However, if ZCHAR contains a character like 'a'=> '000014a4210' the program shortdumps at the assignment.

My question is then if there is a function or such to check number of characters in a variable or anything to ensure that the short dump wont occur.

Best Regards

/Daniel

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2005 at 01:33 PM

    Hi Dan,

    Try this:

    IF ZCHAR CO '0123456789 '.

    ZINT = ZCHAR.

    ELSE.

    • Error

    ENDIF.

    Regards,

    Arjan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2005 at 01:36 PM

    Hi Dan,

    you can use this:

    if variable cn '0123456789'.

    regards

    Siggi

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.