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
 

 

Assign the values of char to fixdec

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
donateeye
Warnings : 2

New User


Joined: 01 Jun 2007
Posts: 62
Location: chennai

PostPosted: Mon May 17, 2010 12:37 pm    Post subject: Assign the values of char to fixdec
Reply with quote

If I want to assign the values of char to fixdec, what is the best way to do it.

example :

DCL A FIX DEC (5,0) INIT (234);
DCL B CHAR (5) INIT ' ';

what is the best way to move B to A?
Back to top
View user's profile Send private message

Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 964
Location: Richmond, Virginia

PostPosted: Mon May 17, 2010 4:59 pm    Post subject:
Reply with quote

What are you trying to do? I.e., what is your final goal?

Can spaces be represented numerically?
Back to top
View user's profile Send private message
donateeye
Warnings : 2

New User


Joined: 01 Jun 2007
Posts: 62
Location: chennai

PostPosted: Wed May 19, 2010 11:36 am    Post subject:
Reply with quote

Sorry.... trying to move from A to B
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 995
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed May 19, 2010 12:50 pm    Post subject:
Reply with quote

Code:
DCL A FIX DEC (5,0) INIT (234);
DCL B CHAR (5) INIT ' ';
DCL B_PIC PIC'(5)9' BASED ADDR(B);

B_PIC = A;


Since B_PIC occupies the same storage as B, the decimal to picture assignment achieves what you want.

Garry.
Back to top
View user's profile Send private message
donateeye
Warnings : 2

New User


Joined: 01 Jun 2007
Posts: 62
Location: chennai

PostPosted: Wed May 19, 2010 2:27 pm    Post subject:
Reply with quote

Thanks Garry
Back to top
View user's profile Send private message
sudhaaa

New User


Joined: 24 Mar 2005
Posts: 51

PostPosted: Thu Aug 05, 2010 11:00 pm    Post subject: Re:Assign the values of char to fixdec
Reply with quote

Hi,

I have a CHAR field which can have values as below
DCL Amount CHAR(18);
Amount can be
123,420.05

Now I have a field which is FOXED DEC as below
DCL Amount_to_use_on_search FIXED DEC(15,2);

As you aware I can't directly move value in Amount to Amount_to_use_on_search field

I tried with intermediate variable declaring with PIC 'zzz,zz9.V99' clause
But still I was not able to move the values

Please suggest

(Note - Please let me know if this query is already answered in the forum. I referred the books for above, but not find any exact answer)
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1027
Location: Oostende, Belgium

PostPosted: Fri Aug 06, 2010 1:03 am    Post subject: Re:Assign the values of char to fixdec
Reply with quote

sudhaaa wrote:
I have a CHAR field which can have values as below
DCL Amount CHAR(18);
Amount can be
123,420.05

Now I have a field which is FOXED DEC as below
DCL Amount_to_use_on_search FIXED DEC(15,2);

As you aware I can't directly move value in Amount to Amount_to_use_on_search field

I tried with intermediate variable declaring with PIC 'zzz,zz9.V99' clause
But still I was not able to move the values

Please suggest


Suggest what? using the PIC it is possible, but you will have to make sure that the decimal point in the char field and that in the PIC field are in the same position, so some use of SUBSTR and STRING might be required...
Back to top
View user's profile Send private message
sudhaaa

New User


Joined: 24 Mar 2005
Posts: 51

PostPosted: Fri Aug 06, 2010 1:41 am    Post subject:
Reply with quote

Thank Prino.. But I can use SUBSTR to store only partial value to the PIC variable

I belive you are saying about TRIm, which will remove spaces from the Amount CHAR variable. Please correct if I understood it correctly

For example, I wil consider a maximum value
834,547,123,456.00 CHAR(18)
zzz,zzz,zzz,zz9.v99 PIC variable

Now when I debug my module, I can see that it is failing when I try to move CHAR value to PIC
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1027
Location: Oostende, Belgium

PostPosted: Fri Aug 06, 2010 1:56 am    Post subject:
Reply with quote

The "RIGHT" builtin might also be useful, but I suggest you RTFM to see why. icon_idea.gif
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 995
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri Aug 06, 2010 12:37 pm    Post subject:
Reply with quote

You should NOT tag your query onto an existing one. You should open a new thread.

In any case, the comma in the PIC declaration is for OUTPUT.

Garry.
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 Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm


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