Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

to get the numeric value in alphanumeric pic

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: to get the numeric value in alphanumeric pic
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: 3158
Location: Tucson AZ

PostPosted: Wed Jan 10, 2007 7:29 pm    Post subject: Re: to get the numeric value in alphanumeric pic
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    Post subject: to get the numeric value in alphanumeric pic
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    Post subject: Re: to get the numeric value in alphanumeric pic
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: 3158
Location: Tucson AZ

PostPosted: Thu Jan 11, 2007 7:37 pm    Post subject: Re: to get the numeric value in alphanumeric pic
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    Post subject:
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

Site Director


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

PostPosted: Fri Jan 12, 2007 7:36 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm
No new posts alphanumeric sequence generation sivaprasad.gadhi COBOL Programming 6 Wed Mar 30, 2016 3:03 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us