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
 

 

Character to Arithemtic conversion in PL/I

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
hsbawari
Currently Banned

New User


Joined: 16 Sep 2008
Posts: 9
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

murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
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
Currently Banned

New User


Joined: 16 Sep 2008
Posts: 9
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: 46

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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts the use of 'B3'x character in a panel Pedro TSO/ISPF 1 Thu Feb 16, 2017 3:09 am
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Conversion of a VB file to FB. isssal DFSORT/ICETOOL 1 Mon Oct 31, 2016 10:23 pm
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm
No new posts EBCDIC to ASCII conversion using OCOPY mistah kurtz All Other Mainframe Topics 5 Tue Sep 06, 2016 2:26 pm


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