WORKING-STORAGE SECTION.

01 VAR1 COMP-2 VALUE 0.

PROCEDURE DIVISION.

MOVE 10.2115 TO VAR1.

DISPLAY 'VAR1 =' VAR1.

GOBACK.



10.2115 is stored as .10211499999999996E 02 in OS VS Cobol

10.2115 is stored as .10211500000000000E 02 in ecobol.

Any reason why?

Answers were Sorted based on User's Feedback



WORKING-STORAGE SECTION. 01 VAR1 COMP-2 VALUE 0. PROCEDURE DIVISION. MOVE 10.2115 TO VAR..

Answer / islam

Ans is : 10.2115 is stored as .10211500000000000E 02 in
ecobol.

Is This Answer Correct ?    3 Yes 1 No

WORKING-STORAGE SECTION. 01 VAR1 COMP-2 VALUE 0. PROCEDURE DIVISION. MOVE 10.2115 TO VAR..

Answer / jennifer victor

comp-2 is pre defined that it stores all the data values in hexadecimal format, using 8 bytes, hence its displayed in hexa format.

Is This Answer Correct ?    2 Yes 0 No

WORKING-STORAGE SECTION. 01 VAR1 COMP-2 VALUE 0. PROCEDURE DIVISION. MOVE 10.2115 TO VAR..

Answer / mani

comp-1 and comp-2 values can not be handled as above.

they are meant to be used for simple incrementation and i
think we can not move values like the above.

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More COBOL Interview Questions

I have a PS file and I would like to manually insert the binary values (like a COMP format) into the file. How can i do that? the way do in COMP-3 format.. suppose i want to insert -12345 in to file in comp-3 format. simply we can open a file in edit mode and do HEX-ON and insert the value . SEE BELOW-- 135 24D in 3 bytes - this will be COMP-3 presenatation of -12345.

1 Answers  


If I want to increase the Limit in GDG. What should I do?

1 Answers   IBM,


01 var1 pic s9(9)v99. 01 var2 pic x(30). procedure division. move 12345.99 to var1. move12345.99 to var2. display var1. display var2. what is the output?

2 Answers   IBM,


whn do i get soc7 abend while moving alphanumeric to numeric or while moving numeric to aplhanumeric please reply ASAP?

9 Answers  


How to define variable 9(20) in COBOL, because compiler does not allow us to declare variables with Pic 9(18). Can anyone please let me know the answer... I know one answer to this question which is to use Compiler option Arith (Extend) during Compilation. It extends the maximum limit to 9(32)..Just wanted to know if there is any other way to extend this?

4 Answers   CSC, TCS,






What is 66 level number and where it is used in real time by software developers?

2 Answers   ITC Indian Tobacco Company, TCS,


What is the difference between Perform para and perform asaection in cobol?

3 Answers   TCS,


What is the utilization of copybook in cobol?

0 Answers  


In a program, there are 2 sections defined say SECTION-A and SECTION-B. There is a paragraph say CALC-INT in both the sections. If this para has to be called directly for SECTION-A, then PERFORM CALC-INT will not work as it is present in both sections. How the PERFORM statement has to be coded here?

5 Answers  


What is the difference between a binary search and a sequential search?

10 Answers  


how to transfer the file from pc to mainframe??

3 Answers  


hi friends,can any one post the ibm mainframe inteqview questions for 1year exp candidate,for itc infotech interview?. have any body attended for this in the past?...

1 Answers   ITC Infotech,


Categories