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

input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.

0 Answers  


Syntax for JCLLIB & JOBLIB???

1 Answers  


HOW WE WILL SORT THE ARRAY WHICH IS GOING TO USE FOR SEARCH ALL?

2 Answers   Cap Gemini,


what is the difference between perform varying and perform until

4 Answers   TCS,


I have a program with an Array of 5000 occurences which is being passed from 5 sub levels to the front end screen. Thess 5 programs using each 5*2 = 10 different arrays with size as 5000. This is causing the transaction to utilize more storage consupmtion. I am looking to reduce the storage consumption. As part of that initially i thought Dynamic array may solve my problem. After viewing the comments given i see its same as normal array. IS there any other way we can resolve this issue?

0 Answers   HCL,






What are the ways you can generate a copybook?

2 Answers  


When the working storage variables get allocated? a.At Compile time b.At starting of the run time c.At end of the run time. d.None of these

6 Answers   Wipro,


What is the difference beetween Arrays and Tables in Cobol? please dont give the answer that arrays in cobol terminology is called tables......

3 Answers   BirlaSoft,


IDENTIFICATION DIVISION. PROGRAM-ID. MOVEPGM. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-I PIC 9(2). PROCEDURE DIVISION. A1000-MAIN-PARA. PERFORM PARA-X WITH TEST BEFORE UNTIL WS-I= 5 STOP RUN. PARA-X. DISPLAY "BEST2". I m getting error s722,while executing the program, seems getting in loop, can anybody tell me why

3 Answers  


What is the figurative constant in cobol?

1 Answers  


I encountered an error when I move spaces to a numeric field?What should I do to move spaces on that field?help please.

9 Answers  


hi. This is Ram.i have one doubt.why can't we display comp-3 variables directly? let me answer quickly plez........

1 Answers  


Categories