IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

to get the numeric value in alphanumeric pic


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arulraj-ponnusamy

New User


Joined: 09 Jan 2007
Posts: 2
Location: Chennai

PostPosted: Wed Jan 10, 2007 6:37 pm
Reply with 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
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Jan 10, 2007 7:29 pm
Reply with quote

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
View user's profile Send private message
arulraj-ponnusamy

New User


Joined: 09 Jan 2007
Posts: 2
Location: Chennai

PostPosted: Thu Jan 11, 2007 7:19 pm
Reply with quote

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
View user's profile Send private message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Thu Jan 11, 2007 7:20 pm
Reply with quote

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
Quote:
MOVE A(1:1) TO B


Note that B contains "<first byte is A><Blank><Blank>"

Correct me is it other way round
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jan 11, 2007 7:37 pm
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Jan 12, 2007 6:02 am
Reply with quote

What's wrong w/"MOVE A TO B"? Or can A contain "12 1234" at another time?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jan 12, 2007 7:36 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Convert HEX to Numeric DB2 3
No new posts Find a record count/numeric is multip... COBOL Programming 1
No new posts Handling the numeric data in unstring... COBOL Programming 18
No new posts convert alphanumeric PIC X(02) to hex... COBOL Programming 3
Search our Forums:

Back to Top