View previous topic :: View next topic
|
Author |
Message |
arulraj-ponnusamy
New User
Joined: 09 Jan 2007 Posts: 2 Location: Chennai
|
|
|
|
a pic x(10) value '255 555'
b pic x(3)
note size of and b is different
now i want to get only the 1st value in a.
i done it by using unstring
e.g.
unstring b delimited by space into a,c
is there any other methods |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
arulraj-ponnusamy wrote: |
a pic x(10) value '255 555'
b pic x(3)
note size of and b is different
now i want to get only the 1st value in a.
i done it by using unstring
e.g.
unstring b delimited by space into a,c
is there any other methods |
I'm not clear as to what you are trying to do?? Move the first three bytes of a to b? O move b into the first three bytes of a? Where is c? |
|
Back to top |
|
|
arulraj-ponnusamy
New User
Joined: 09 Jan 2007 Posts: 2 Location: Chennai
|
|
|
|
a pic x(10) value '255 555 '
a1 pic x(3)
a2 pic x(3)
b pic 9(3)
c pic 9(3)
note that the size of and b is different
now i want to get only the 1st three numeric positions to b.
i done it by using unstring
e.g.
unstring b delimited by space into a1,a2
then i move a1 to b
move a2 to c
if the size of a1= size of b
then it works
if b pic 9(4)
then it shows spaces
how to solve it?
is there any other methods |
|
Back to top |
|
|
kgumraj
Active User
Joined: 01 May 2006 Posts: 151 Location: Hyderabad
|
|
|
|
Hi,
Quote: |
a pic x(10) value '255 555'
b pic x(3)
note size of and b is different
now i want to get only the 1st value in a.
i done it by using unstring
e.g.
unstring b delimited by space into a,c
is there any other methods
|
I assume your question to be like this,
Moving first bit of A to B..
correct me if I am wrong
For this you can use Partical Move
Note that B contains "<first byte is A><Blank><Blank>"
Correct me is it other way round |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
arulraj-ponnusamy wrote: |
a pic x(10) value '255 555 '
a1 pic x(3)
a2 pic x(3)
b pic 9(3)
c pic 9(3)
note that the size of and b is different
now i want to get only the 1st three numeric positions to b.
i done it by using unstring
e.g.
unstring b delimited by space into a1,a2
then i move a1 to b
move a2 to c
if the size of a1= size of b
then it works
if b pic 9(4)
then it shows spaces
how to solve it?
is there any other methods |
move zero to b
move a(1:3) to b(length of b - length of a + 1:length of b)
should work.... |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
What's wrong w/"MOVE A TO B"? Or can A contain "12 1234" at another time? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Methinks there is not a clear definition of what is desired.
Why would we unstring b into a1 and a2? Is that a typo or am i just not getting it. . . .
I don't believe i've seen a pic 9(3) or pic 9(4) display as spaces. Where do the spaces come in?
Field a is pic x(10) but the value(s) in it come up short.
Please repost and show examples of different possible input values and what you want the result to be when "the code" works properly. If it could occur in the input data, the '12 1234' example would be good to include. |
|
Back to top |
|
|
|