View previous topic :: View next topic
|
Author |
Message |
YASHO
New User
Joined: 12 Oct 2006 Posts: 6
|
|
|
|
Hi,
The variable has the value 0001333, bt i want the output to displayed as 13.33.. in what way it is possible...
Thanks & Regards,
Yashodha. |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hi,
Do you manipulating the value you provided here or you want to convert directly the value to some otherform, what is your actual requirement?
Regard's
Vasanth......... |
|
Back to top |
|
|
madumahe
New User
Joined: 25 Oct 2007 Posts: 2 Location: hyderabad
|
|
|
|
hi,
i think you can use editing characters!! try once. |
|
Back to top |
|
|
VinayCM
New User
Joined: 06 Nov 2007 Posts: 36 Location: Bengaluru
|
|
|
|
What you are doing actually... generating report or just you want to display the value in that format.... you can divide it by 100 and display using variable of type zz.zz. |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hi,
If u want to implement in scientific notation, it might be possible in PL/1 programming technique, in cobol you can do as suggested above.
Regard's
Vasanth........ |
|
Back to top |
|
|
revel
Active User
Joined: 05 Apr 2005 Posts: 135 Location: Bangalore/Chennai-INDIA
|
|
|
|
Dear Vasanth,
Could you please explain, how can we implement using in PL/I,
This is just for to know tech, |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Vasanth,
Quote: |
If u want to implement in scientific notation, it might be possible in PL/1 programming technique, in cobol you can do as suggested above. |
Do you mean scientific notation (i.e., mantissa E exponent) is not possible in COBOL? |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Murli,
Not mantissa E exponent notation, while shifting the zeros from left to right side corresspondingly the period will also shift, this is my regard.
regard's
Vasanth...... |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
YASHO wrote: |
The variable has the value 0001333, bt i want the output to displayed as 13.33.. in what way it is possible... |
Helpful.....
Code: |
05 number1 pic 9(7).
05 number2 redefines
number1 pic 9(5)v99.
05 number3 pic z(4.99.
Move 0001333 to number1
move number2 to number3
display '*' number3 '*'
* 13.33* |
or
Code: |
05 number1 pic x(7).
05 number2 redefines
number1 pic 9(5)v99.
05 number3 pic z(4.99.
Move '0001333' to number1
move number2 to number3
display '*' number3 '*'
* 13.33* |
|
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
CICS Guy,
Did you type the code on fly OR copied from MF session?
Hint: Concentrate on NUMBER3 statements and O/P. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Good point....that's what compiler errors are for, catching such 'finger checks'.....
05 number3 pic z(4)9.99. |
|
Back to top |
|
|
revel
Active User
Joined: 05 Apr 2005 Posts: 135 Location: Bangalore/Chennai-INDIA
|
|
|
|
Hello CICS Guy,
Quote: |
05 number1 pic 9(7).
05 number2 redefines
number1 pic 9(5)v99.
05 number3 pic z(4).99.
Move 0001333 to number1
move number2 to number3
display '*' number3 '*'
* 13.33* |
Why you are using Redefining cluase to redefine number1 with number2, the actual requirement is to supress leading zeros from 0001333 number, for that u can push directly 0001333 number to 9(5).99 then to Z(4)9.99 editing item(Why we need one more variable). |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
revel wrote: |
u can push directly 0001333 number to 9(5).99 |
OK, how would you "push directly" the integer value into a decimal pic?
Code: |
05 number1.
10 number2 pic 9(5)v99.
05 number3 pic z(4)9.99.
Move '0001333' to number1
move number2 to number3
display '*' number3 '*'
* 13.33* |
|
|
Back to top |
|
|
revel
Active User
Joined: 05 Apr 2005 Posts: 135 Location: Bangalore/Chennai-INDIA
|
|
|
|
Hello CICS Guy,
Sorry, It is 9(5)V99 <not 9(5).99>
Ok. Tell me what is the output for below then?
in JCL
-------
Code: |
//SYSIN DD *
0001333
/* |
In COBOL
------------
Code: |
WORKING-STOARAGE SECTION.
01 WS-A PIC 9(5)V99.
01 WS-B PIC Z(4)9.99.
PROCEDURE DIVISION
0000-MAIN.
ACCEPT WS-A.
MOVE WS-A TO WS-B
DISPLAY WS-A
DISPLAY WS-B
STOP RUN. |
-----------------------------------------------------------
For WS-A
00013^33
where ^ represent assumed decimal point
For WS-B
BBB13.33 Where B represent Blank space |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Yes, that would "push directly"..........
Did you try to accept ws-b?
Never the less, the OP had a case of "The variable has the value 0001333".... |
|
Back to top |
|
|
revel
Active User
Joined: 05 Apr 2005 Posts: 135 Location: Bangalore/Chennai-INDIA
|
|
|
|
Hi CICS Guy,
I didn't get you, could you clear it out. |
|
Back to top |
|
|
Nsuma
New User
Joined: 10 Dec 2007 Posts: 13 Location: Hyd
|
|
|
|
Hi All,
i am also facing same problem...in case of me the value 00001333 im getting from input,but in output i have to send as 1333 ...means eliminating leading zerores and spaces.any one clears this |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hi,
As already suggested u can go for LEADING ZERO SUPPRESSION but in case of spaces no on use space leading spaces, also charecters are right justified
or
in case of leading zeros u can go for as CICS GUY explained. |
|
Back to top |
|
|
|