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: 8200
Location: East Dubuque, Illinois, 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 Can EDCICONV convert EBCDIC to ASCII... natt.sut IBM Tools 3 Fri Nov 17, 2017 8:46 pm CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm

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