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

How to get the first 4 chars form a var ?

Hi guys,

How to get the first 4 chars form a var ?

i.e temp type num20 value '00000000000012345678'.

how to move the first 4 chars to another var?

thx in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 06:15 AM

    <b>var111 = var+0(4</b>)

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 06:16 AM

    hi

    use OFFESTS..

    example:

    var1 = '12345678'.
    var2 = var1+0(4).
    

    now var2 conatins '1234'.

    thx

    pavan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 06:16 AM

    val1(20) type n.

    val2(4) type c. "take another variable

    move val1+0(4) to val2.

    regards,

    vijay.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 06:19 AM

    use variable+0(4) and fetch this value into another vbariable.

    a = variable+0(4) .

    amit

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 09, 2007 at 06:19 AM

    data :var(20) type n.

    data:var1(4) type n.

    var1 = var+0(4).

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 09, 2007 at 06:25 AM

    Hi Vincent,

    YOu can do like this

    DATA variable(20) TYPE n VALUE '00000000000000125365'.

    SHIFT variable LEFT DELETING LEADING '0'.

    WRITE variable+0(4).

    Regards

    Ashutosh

    Reward points if helpful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 06:27 AM

    Thanks a lot guys.

    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.