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

What are the different rules for performing sort operation?

0 Answers  


how many divisions are there in cobol

3 Answers   ADP,


what is a load module ?

3 Answers   TCS,


where do we use dyanamic call ? and where do we use static call pls give any example pls ?

3 Answers   Patni,


01 a pic s9(5) value '-12345' how it will be stored

7 Answers   ACS,






What should be the sorting order for SEARCH ALL?

5 Answers  


If i got a job on mainframe technology, will i have a bright future?. Some people are discouraging me. Let me know, is it true? Please bring back me from the confusion.

2 Answers  


Will the variable POS in the following code have a value of 2 or not? 01 POS PIC S9(4) COMP VALUE 2. 01 FIRST-NAME PIC X(10) VALUE 'ABC'. 01 LAST-NAME PIC X(10) VALUE 'XYZ'. 01 NAME PIC X(20) VALUE SPACES. STRING FIRST-NAME DELIMITED BY SPACES ' ' DELIMITED BY SIZE LAST-NAME DELIMITED BY SPACES INTO NAME WITH POINTER POS

2 Answers  


In an EVALUTE statement is the order of the WHEN clauses significant?

4 Answers  


if one main program ,n -subprograms are then which call you follow ?why reasonuhg

4 Answers   UHG,


What is difference between comp & comp-4?

6 Answers  


What is the point of the REPLACING option of a copy statement?

3 Answers  


Categories