Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
Satheeshkumar

New User

Joined: 20 Feb 2009
Posts: 51
Location: Chennai

 Posted: Tue Jan 05, 2010 6:46 pm    Post subject: Convert comp-2 to zoned decimal Hi, My requirement is that My input file contains the COMP-2 field. Is it possible to convert the COMP-2 to ZONED decimal?

Robert Sample

Global Moderator

Joined: 06 Jun 2008
Posts: 8344
Location: Dubuque, Iowa, USA

 Posted: Tue Jan 05, 2010 6:59 pm    Post subject: Maybe. If the value in the COMP-2 field is over 10 to the 30th power, then 31 digits is not enough to hold the value and therefore the move cannot be done. But as long as the COMP-2 field value is appropriate for the zoned decimal value, a simple MOVE should do the trick.
Satheeshkumar

New User

Joined: 20 Feb 2009
Posts: 51
Location: Chennai

 Posted: Tue Jan 05, 2010 7:07 pm    Post subject: Can any one provide the sample code using SORT
Frank Yaeger

DFSORT Moderator

Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

Posted: Tue Jan 05, 2010 11:06 pm    Post subject:

COMP-2 is an 8-byte FL value. You can convert it to a ZD integer (but the decimal part will be lost) using:

 Code: INREC BUILD=(...,p,8,FL,TO=ZD,...)

where p is the starting position of the COMP-2 field.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics How to convert 2 bytes into single by... pkmurali DB2 6 Fri May 25, 2018 1:41 pm How can I convert charactor to fixed ... liying DFSORT/ICETOOL 7 Tue May 22, 2018 3:35 pm How to group and sum the decimal value sakrat DFSORT/ICETOOL 2 Tue Mar 06, 2018 9:13 pm COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us