Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Double to Packed decimal conversion in Mainframe 'C'

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests
View previous topic :: :: View next topic  
Author Message
sampaul4u

New User


Joined: 27 Mar 2010
Posts: 19
Location: folirida

PostPosted: Fri Sep 17, 2010 4:16 pm    Post subject: Double to Packed decimal conversion in Mainframe 'C'
Reply with quote

Hi,
Could anyone assist me to write a function in IBM "C" to convert Double value to Packed Decimal format?

Please advise me.

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

Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Fri Sep 17, 2010 4:30 pm    Post subject: Reply to: Double to Packed decimal conversion in Mainframe '
Reply with quote

What do you mean by "Double" value? Is this a doubleword (8-bytes)? Are the field contents binary? Are the field contents display-numeric?

What language is the program that needs to invoke this Function?

More information is needed....

Bill
Back to top
View user's profile Send private message
sampaul4u

New User


Joined: 27 Mar 2010
Posts: 19
Location: folirida

PostPosted: Fri Sep 17, 2010 4:45 pm    Post subject: Re: Reply to: Double to Packed decimal conversion in Mainfra
Reply with quote

I need this in C laguage. Double precision value (Ex 1000.11) needs to be converted to Packed decimal format (that is eaqualent to COBOL COMP-3)


Thanks.

Bill O'Boyle wrote:
What do you mean by "Double" value? Is this a doubleword (8-bytes)? Are the field contents binary? Are the field contents display-numeric?

What language is the program that needs to invoke this Function?

More information is needed....

Bill
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10326
Location: italy

PostPosted: Fri Sep 17, 2010 4:53 pm    Post subject: Reply to: Double to Packed decimal conversion in Mainframe '
Reply with quote

why should we icon_question.gif icon_evil.gif
You did not even care to look at the manuals

start from
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/CBCBS180 ( for example )
and search for DECIMAL and PACKED

after having read the manuals, if there is something not clear, somebody will be glad to help
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Fri Sep 17, 2010 4:57 pm    Post subject: Reply to: Double to Packed decimal conversion in Mainframe '
Reply with quote

Is this a management directive or is this your suggestion to management?

This can be done easily in a "Called" Assembler sub-program, using the "grande" instructions or in COBOL or PL/I for that matter.

Why must it be "C"?

Have you tried "Googling" this?

Bill
Back to top
View user's profile Send private message
Ian McIntosh

New User


Joined: 01 Sep 2011
Posts: 1
Location: Canada

PostPosted: Fri Sep 02, 2011 3:02 am    Post subject: Double to Packed Decimal Conversion in Mainframe C
Reply with quote

IBM mainframe C has a family of builtin packed decimal types, equivalent to COBOL COMP-3. The declaration syntax is
_Decimal (total_digits) varname;
or
_Decimal (total_digits, digits_after_decimal_point) varname;
and if you include <decimal.h> you can use decimal instead of _Decimal.

The operations on the decimal types are mostly the same as for other numeric types. Literals end with the suffix "D". Use "%D(total_digits, digits_after_decimal_point)" in printf and scanf.

To convert a double to decimal, just use an assignment statement or a cast.

double d = 123.456;
_Decimal (6,3) dd;
dd = d;
or
dd = (_Decimal(6,3)) d;

For more information, see
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CBCLR170/3.3.4?SHELF=CBCBS180&DT=20070601155844

edited to fix a wrong URL
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 Sep 02, 2011 10:47 am    Post subject: Reply to: Double to Packed decimal conversion in Mainframe '
Reply with quote

Hello and welcome to the forum,

Thanks for posting this info.

Enjoy your time here and hopefully we will have things you find useful as well icon_smile.gif

d
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 -> HomeWorks & Requests All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Identifying Interfaces in CICS/mainframe Ashishpanpaliya CICS 5 Fri Oct 13, 2017 3:21 pm
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Mainframe scheduling tool ddhar Compuware & Other Tools 2 Wed Sep 27, 2017 12:48 am
No new posts How do I create a mainframe monitorin... anjali.bisht All Other Mainframe Topics 4 Fri Sep 01, 2017 2:20 pm
No new posts Mainframe dataset split purushottam DFSORT/ICETOOL 13 Tue Aug 29, 2017 12:28 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us