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

Author Message
vicharapusrinu
Warnings : 1

New User

Joined: 04 Dec 2006
Posts: 63

Posted: Wed Sep 15, 2010 3:40 pm    Post subject: How to convert 9(3) to 9(3) comp-3

How to convert 9(3) to 9(3) comp-3?

 Code: 01  IP1                PIC 9(3) 01  OP1                PIC 9(3) COMP-3

Input
111

Expected output
Equalent of 111 in comp-3 format

Bill O'Boyle

CICS Moderator

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

 Posted: Wed Sep 15, 2010 4:54 pm    Post subject: Reply to: How to convert 9(3) to 9(3) comp-3 Are you sure you want SORT to convert to packed-decimal (neutral), which has a sign-nibble of 'F' or to packed-decimal (signed), which has a sign-nibble of 'C'? Based upon the COMP-3 picture-clause you've posted, you want packed-decimal neutral. Are you sure about this? If for whatever reason, a program later down the line, whose picture-clause is S9(03) COMP-3 issues (for whatever reason) a NUMERIC check against this data, it will fail, due to the 'F' sign-nibble. This is also vice-versa. Bill
sqlcode1

Active Member

Joined: 08 Apr 2010
Posts: 578
Location: USA

Posted: Wed Sep 15, 2010 7:41 pm    Post subject: Re: How to convert 9(3) to 9(3) comp-3

 vicharapusrinu wrote: Expected output Equalent of 111 in comp-3 format

Do you want 2 byte PD or 3 byte PD after conversion? Since you have asked this in DFSort forum, one way of achieving the results would be to code OUTREC BUILD=(p,m,f,to=f,length=n).

Thanks,
Frank Yaeger

DFSORT Moderator

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

Posted: Wed Sep 15, 2010 10:47 pm    Post subject:

 Code: How to convert 9(3) to 9(3) comp-3? 01  IP1                PIC 9(3) 01  OP1                PIC 9(3) COMP-3 Input 111 Expected output Equivalent  of 111 in comp-3 format

PIC 9(3) is a 3-byte ZD value. PIC 9(3) COMP-3 is a 2-byte PD value. Assuming the field starts in position 1, you could use these DFSORT control statements to do the conversion:

 Code: OPTION COPY    INREC BUILD=(1,3,ZD,TO=PD,LENGTH=2)

That will give you a C for the positive PD sign. If you want an F for the positive PD sign, use TO=PDF. If you want a length of 3 for the output field, use LENGTH=3.

If you want something else, be more specific about what you want.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics 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 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

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