I have a variable x(20), but i need the out as in two ways One is 1.12300000000000000000, other one is 2.123-----------------?

Showing Answers 1 - 7 of 7 Answers

Prasanth J

  • Oct 6th, 2005
 

for displaying 1230000000000000000001 a pic x(20).01 b redefines a pic x(3)0(17) in procedure division move a to b then display b

  Was this answer useful?  Yes

Prasanth J(Escube technologies,Trivandrum,Kerala,

  • Oct 6th, 2005
 

2nd option for 12300000000000000000

01 a pic x(20) value '123'.

procedure division.

 inspect a replacing all space by zero.

 display a.

2nd question for 123-----------------

01 a pic x(20) value '123'.

procedure division.

 inspect a replacing all space by '-'.

 display a.

  Was this answer useful?  Yes

kapilvharande

  • May 30th, 2006
 

only by giving Delimeted by . in procedure division.

  Was this answer useful?  Yes

Umesh K Jha

  • Jul 28th, 2006
 

Hi All,

      Use this code.......

WORKING-STORAGE SECTION.

01 WS-VAR3  PIC X(20) VALUE ALL '-'.                        
                                                             
PROCEDURE DIVISION.                                          
000-MAIN-PARA.                                               
     MOVE '123' TO WS-VAR3(1:3).                             
     DISPLAY 'VALUE IS ' WS-VAR3.                            
     INITIALIZE WS-VAR3(4:17) REPLACING ALPHANUMERIC BY ZEROS.
     DISPLAY 'VALUE IS ' WS-VAR3.                            
     STOP RUN.                                               

V

  • Dec 13th, 2006
 

01 WS-VAR  PIC X(20) VALUE '123'.                          
                                                             
PROCEDURE DIVISION.                                          
000-MAIN-PARA.                                               
     MOVE all zeroes to WS-VAR(4:17).                             
     DISPLAY 'VALUE IS ' WS-VAR.    

     MOVE all '-' to WS-VAR(4:17).                                 

     DISPLAY 'VALUE IS ' WS-VAR.                            
     STOP RUN.                                               

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions