Results 1 to 6 of 6

Thread: How can you move only "kumar" to ws-data2

  1. #1
    Geek_Guest
    Guest

    How can you move only "kumar" to ws-data2

    01 ws-data1 pic x(12) value "satish kumar'
    01 ws-data2 pic x(5)
    How can u move only "kumar" to ws-data2

    Question asked by visitor satish kumar


  2. #2
    Junior Member
    Join Date
    Feb 2007
    Answers
    4

    Re: How can you move only "kumar" to ws-data2

    Quote Originally Posted by Geek_Guest View Post
    01 ws-data1 pic x(12) value "satish kumar'
    01 ws-data2 pic x(5)
    How can u move only "kumar" to ws-data2

    Question asked by visitor satish kumar
    Use String function of cobol.


  3. #3

    Re: How can you move only "kumar" to ws-data2

    Quote Originally Posted by Geek_Guest View Post
    01 ws-data1 pic x(12) value "satish kumar'
    01 ws-data2 pic x(5)
    How can u move only "kumar" to ws-data2

    Question asked by visitor satish kumar
    Hi,
    this can be done in many ways:
    (1)Declare another variable as:
    ->01 ws-data-group
    03 ws-filler pic x(07).
    03 ws-data2 pic x(05).
    ->move ws-data1 to ws-data-group.
    your required value will be in ws-data.

    (2)The second logic uses a counter which will search for a space after satish and move the remaining to data2.

    ->declare:
    01 count pic 9(02).
    01 remain pic 9(02) value 0.

    ->perform varying count from 1 by 1 until ws-data1(count) equal space.
    ->subtract count from length of ws-data1 giving remain.
    ->add 1 to count.
    ->move ws-data1(count:remain) to ws-data2


    Hope this helps......


  4. #4
    Junior Member
    Join Date
    Mar 2006
    Answers
    1

    Re: How can you move only "kumar" to ws-data2

    Also, if you are coding the program and you want to always MOVE the last five characters of WS-DATA1 to WS-DATA2, you'd simply do:

    MOVE WS-DATA1 (8:5) TO WS-DATA2.


  5. #5

    Re: How can you move only "kumar" to ws-data2

    Quote Originally Posted by rlsantucijr View Post
    Also, if you are coding the program and you want to always MOVE the last five characters of WS-DATA1 to WS-DATA2, you'd simply do:

    MOVE WS-DATA1 (8:5) TO WS-DATA2.
    True.....


  6. #6

    Re: How can you move only "kumar" to ws-data2

    [True.............


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact