View previous topic :: View next topic
|
Author |
Message |
Anand78
New User
Joined: 06 Mar 2006 Posts: 50 Location: PUNE
|
|
|
|
Hi,
Pls tell me how to convert
s9(9) comp to 9(7)V99 format.
Thanks
Anand |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
Anand78
New User
Joined: 06 Mar 2006 Posts: 50 Location: PUNE
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Anand78
New User
Joined: 06 Mar 2006 Posts: 50 Location: PUNE
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Anand78
New User
Joined: 06 Mar 2006 Posts: 50 Location: PUNE
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|