View previous topic :: View next topic
|
Author |
Message |
vicharapusrinu Warnings : 1 New User
Joined: 04 Dec 2006 Posts: 63 Location: Hyderabad
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|