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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Wed Sep 15, 2010 3:40 pm    Post subject: How to convert 9(3) to 9(3) comp-3
Reply with quote

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
Back to top
View user's profile Send private message

Bill O'Boyle

CICS Moderator


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

PostPosted: Wed Sep 15, 2010 4:54 pm    Post subject: Reply to: How to convert 9(3) to 9(3) comp-3
Reply with quote

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
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

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

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,
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Sep 15, 2010 10:47 pm    Post subject:
Reply with quote

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
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts convert PD to ZD ram_vizag DFSORT/ICETOOL 5 Sat Nov 05, 2016 3:06 am


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