View previous topic :: View next topic |
Author |
Message |
kseenu Beginner
Joined: 08 Jun 2004 Posts: 11 Topics: 5
|
Posted: Wed Jun 09, 2004 1:04 am Post subject: UNSTRING based on the Length of characters in a String |
|
|
I have a String ws-a pic x(200) and ws-ab x(200). I have to check the total length of character in the string and if it less than 250 characters (inclusive of space in between) then i should store that in a variable ws-c pic x(250) and if it above 250 then it should store the rest in another variable ws-d.
when i check for the condition IF WS-A (Length of WS-A : 1) NOT = SPACE
but it throws an error stating that i should use occurs clause.
I dont know where actually i had erred. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Jun 09, 2004 5:26 am Post subject: |
|
|
kseenu,
You need to Post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.
So far from your post, this is what I have grasped.
Code: |
01 WS-STRING.
05 WS-A PIC X(200).
05 WS-AB PIC X(200).
|
Now you have to check the actual length of Ws-string. If it is less than 250 then you need to store that in WS-C and if it exceeds 250 you should still store the first 250 bytes in WS-C and the rest in WS-D. Is that right?
If that is the case then it is very simple. Define a variable WS-Final-string as follows
Code: |
01 WS-Final-STRING.
05 WS-C PIC X(250).
05 WS-D PIC X(150).
|
and simply
Code: |
Move WS-STRING TO WS-FINAL-STRING
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Wed Jun 09, 2004 7:00 pm Post subject: |
|
|
Well, now you have two solutions. Will you be going to another site for a third?
Regards, Jack. |
|
Back to top |
|
 |
|
|