Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Character to Arithemtic conversion in PL/I

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & ASSEMBLER
Author Message
hsbawari

New User


Joined: 16 Sep 2008
Posts: 8
Location: chennai

PostPosted: Tue Sep 23, 2008 1:16 pm    Post subject: Character to Arithemtic conversion in PL/I
Reply with quote

I have one character variable defined as

DCL X char(100);

However the current value in X is numeric with 4 digits say '0120'

Now I need to get this numeric value. how should my numeric variable declared in which I will hav the value extracted from the text?
Can any one help me??

Its a PL/I code.
Back to top
View user's profile Send private message
References
murugan_mf

New User


Joined: 31 Jan 2008
Posts: 38
Location: Chennai, India

PostPosted: Tue Sep 23, 2008 2:09 pm    Post subject:
Reply with quote

This May Solve your problem
Code:
DCL X FIXED BINARY(31,0);
DCL Y CHAR(04) INIT('0123');
X=BINARY(Y);
Back to top
View user's profile Send private message
hsbawari

New User


Joined: 16 Sep 2008
Posts: 8
Location: chennai

PostPosted: Tue Sep 23, 2008 3:10 pm    Post subject: Reply to: Character to Arithemtic conversion in PL/I
Reply with quote

yeah thanks

I got another one without using built in function

DCL TIME_CHAR CHAR(4) INIT('');
DCL TIME_VALID PIC'(4)9' BASED(ADDR(TIME_CHAR));

TIME_VALID=string_char

/* this would work fine now string_char can be any character string*/
Back to top
View user's profile Send private message
Cary

New User


Joined: 23 Sep 2008
Posts: 3
Location: China

PostPosted: Wed Sep 24, 2008 7:26 am    Post subject:
Reply with quote

can not we move char to pic?

DCL TIME_CHAR CHAR(04);
DCL TIME_V PIC '9999'
TIME_V = TIME_CHAR
when time_char is numeric,
it is ok?
Back to top
View user's profile Send private message
cheryala

New User


Joined: 20 Mar 2006
Posts: 49

PostPosted: Thu Oct 02, 2008 3:03 am    Post subject: Re:Character to Arithemtic conversion in PL/I
Reply with quote

1) dcl xchar char(04) init('1234');
dcl xpic pic'(9)4' based(addr(xchar));

now you can use XPIC variable in any arithmetic expressions instead of XCHAR variable..


2) what Cary has proposed is also correct..you can directly assign character string to pic variable ..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & ASSEMBLER All times are GMT + 6 Hours
Page 1 of 1