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

Comp to comp-3 Conversion


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Anand78

New User


Joined: 06 Mar 2006
Posts: 50
Location: PUNE

PostPosted: Thu Sep 13, 2007 1:56 pm
Reply with quote

Hi,

Pls tell me how to convert

s9(9) comp to 9(7)V99 format.

Thanks
Anand
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 2:22 pm
Reply with quote

Anand78 wrote:
Pls tell me how to convert
s9(9) comp to 9(7)V99 format.
Comp to COMP-3 or Display?
With a decimal point shift? The 'V' is implied, it's not really there....
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Sep 13, 2007 2:56 pm
Reply with quote

redefine s9(09) with s9(07)v99
MOVE S9(9) comp variable to a s9(09).

maybe I haven't got your requirement correctly, let us know if anything else is needed.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Sep 13, 2007 3:03 pm
Reply with quote

Abhijit, I kind of made the assumption that the OP was looking for a sort solution since that is the forum he posted his question in.....
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: Thu Sep 13, 2007 8:44 pm
Reply with quote

Anand,

If you look at:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/C.3?DT=20060615185603

you'll see that s9(9) comp is a 4-byte FI value and 9(7)V99 comp-3 is a 5-byte PD value.

You could use DFSORT control statements like the following to do the conversion:

Code:

   OPTION COPY
   INREC BUILD=(...,p,4,FI,TO=PD,LENGTH=5,...)


For more information on this type of conversion, see:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG20/2.4.7?DT=20060615173822
Back to top
View user's profile Send private message
Anand78

New User


Joined: 06 Mar 2006
Posts: 50
Location: PUNE

PostPosted: Mon Sep 17, 2007 12:18 pm
Reply with quote

Hi Abhijit,

I want to achieve the conversion thru jcl, I got it thru below format.

input field is S9(9) comp.
output field is 9(7)V99.

outrec fields=(1:1,4,bi,zd,length=7,
8:2x'F0')

Thanks your time and response to this question.

Anand.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Mon Sep 17, 2007 12:24 pm
Reply with quote

I posted COBOL solution because you mentioned COBOL variable declarations in your question.
Happy to know that you got the solution. And thanks for letting us know about that. icon_smile.gif
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: Mon Sep 17, 2007 8:55 pm
Reply with quote

Anand,

Your Subject line says COMP to COMP-3, but you apparently don't really want a COMP-3 output field since you're using ZD rather than PD. In the future, please try to have your Subject line match what you really want so as not to confuse people.

And I don't know why you're inserting '00' for the two decimal places but hopefully you know what you're doing.
Back to top
View user's profile Send private message
Anand78

New User


Joined: 06 Mar 2006
Posts: 50
Location: PUNE

PostPosted: Thu Sep 20, 2007 6:23 pm
Reply with quote

Hi Frank,

The following control statements u asked to use to convert comp to
comp-3 conversion, I had one doubt in that.

Assume the following data.
Eg: 01 ws-qty pic s9(9) comp, holds value 123456789

When u execute the below control stmnts,
OPTION COPY
INREC BUILD=(...,p,4,FI,TO=PD,LENGTH=5,...)

the output for the variable ws-qty-out pic s9(7)v99 comp-3 will be
1234567.89, but decimal portion should be zero.

Thanks
Anand[/b]
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: Thu Sep 20, 2007 9:25 pm
Reply with quote

A PD value does NOT have a decimal portion. The value would be P'123456789'. You can convert it to displayable format of '1234567.89'. It's not clear if you want the output to be a PD value with P'123456700' or a displayable value with '1234567.00' or what. Please clarify what you want.
Back to top
View user's profile Send private message
Anand78

New User


Joined: 06 Mar 2006
Posts: 50
Location: PUNE

PostPosted: Fri Sep 21, 2007 11:43 am
Reply with quote

Frank,

I have a variable with pic clause s9(9) comp , it will hold value of
123456789, when it is converted to variale s9(7)v99 comp-3.

o/p variable should hold value P'3456789.00', values should be
moved from right to left also decimal portion should be zero.

Thanks,
Anand
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: Fri Sep 21, 2007 8:57 pm
Reply with quote

As I said, a PD value does not store the decimal point. It appears that you want to convert 123456789 = X'075BCD15' to P'345678900' = X'345678900C'. A DFSORT INREC statement like this will do it:

Code:

  INREC BUILD=(...,p,4,FI,MUL,+100,TO=PD,LENGTH=5,..)
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 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts file manager is doing string conversion IBM Tools 3
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
Search our Forums:

Back to Top