WORKING-STORAGE SECTION.
01 A PIC X(3) VALUE 'ABC'
01 B PIC 9(3).
PROCEDURE DIVISION.
MOVE A TO B.
STOP RUN.

OUTPUT IS: AB3
WHY AND HOW THIS IS HAPPENING.

Answers were Sorted based on User's Feedback



WORKING-STORAGE SECTION. 01 A PIC X(3) VALUE 'ABC' 01 B PIC 9(3). PROCEDURE DIVISION. MOVE..

Answer / mahe

You won't get AB3 as Output,Job will abend with SOC7 as you
r moving Character to Numeric variable

Is This Answer Correct ?    22 Yes 4 No

WORKING-STORAGE SECTION. 01 A PIC X(3) VALUE 'ABC' 01 B PIC 9(3). PROCEDURE DIVISION. MOVE..

Answer / kamaldeep

I got AB3 as out put, when ever we are moving X(3) to 9(3) then 1st 2 bytes will be moved right(i.e. AB) but last byte will have '3' as C=+3

Is This Answer Correct ?    1 Yes 0 No

WORKING-STORAGE SECTION. 01 A PIC X(3) VALUE 'ABC' 01 B PIC 9(3). PROCEDURE DIVISION. MOVE..

Answer / chandrababu

We will get 123 not AB3..why because

A = +1 J = -1
B = +2 K = -2
C = +3 L = -3
D = +4 M = -4
E = +5 N = -5
F = +6 O = -6
G = +7 P = -7
H = +8 Q = -8
I = +9 R = -9

So will get 123 for ABC..

Is This Answer Correct ?    0 Yes 1 No

WORKING-STORAGE SECTION. 01 A PIC X(3) VALUE 'ABC' 01 B PIC 9(3). PROCEDURE DIVISION. MOVE..

Answer / velu

Exactly maha!!!!......actually we won't move the pic x(3)
to pic 9(3)(that's we can't move the alphabet to numeric
data type).....it should shows the abed...

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More COBOL Interview Questions

I've one string with spaces ( I N D I A ). My question is I want remove the spaces & combine in to single string without space (INDIA).How we can write the cobol program & wich options we need to use. Please let me know.

10 Answers   Mascon,


i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?

0 Answers  


how we rectify soc4 and soc7 error in project(need real time answer)? please reply

3 Answers   HCL, Wipro,


What is the default value of DISP parameter?

3 Answers   IBM,


What guidelines should be followed to write a structured cobol prgm?

0 Answers  






88 class is used for

5 Answers   CTS, EDS,


how do you define single dimensional array and multidimensional array in your cobol?

0 Answers  


Difference between cobol and cobol-ii?

0 Answers  


In an EVALUATE statement, can I give a complex condition on a when clause?

2 Answers  


01 MOVE 10 TO N 05 PERFOM PARA1 TIMES STOP RUN WAT WILL HAPPEN?? WILL IT RUN INFINITELY OR AN ERROR WIL BE THER BECAUSE NO OF TIMES IS NOT GIVEN??

1 Answers  


What is the meaning of 'TALLING' verb in cobol?

5 Answers  


Why we should use cursor ?

3 Answers  


Categories