IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Sep 15, 2010 4:54 pm
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: 577
Location: USA

PostPosted: Wed Sep 15, 2010 7:41 pm
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 Developer


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

PostPosted: Wed Sep 15, 2010 10:47 pm
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:

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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
Search our Forums:

Back to Top