Without using move verb how to move one variable to another.

Answers were Sorted based on User's Feedback



Without using move verb how to move one variable to another...

Answer / sudha

01 A PIC 9.
01 B PIC 9.

Compute A = B.

Is This Answer Correct ?    25 Yes 2 No

Without using move verb how to move one variable to another...

Answer / bala

We can do this in multiple ways.
1) Using UNSTRING
2) COMPUTE
3) Also, REFERENCE MODIFICATION i.e, if XYZ is a variable with value 'all interview' then
A = XYZ(1:3) moves the first 3 characters of XYZ variable to A.
i.e, A value will be 'all'

Is This Answer Correct ?    8 Yes 2 No

Without using move verb how to move one variable to another...

Answer / monick

SET A TO B

Is This Answer Correct ?    11 Yes 6 No

Without using move verb how to move one variable to another...

Answer / manikandesvaran

1)Using REDEFINES you can acheive this.

For ex.
10 WS-OLD-START-DATE PIC 9(8).

10 WS-NEW-START-DATE REDEFINES WS-OLD-START-DATE.
15 WS-START-YEAR PIC 9(4).
15 WS-START-MONTH PIC 9(2).
15 WS-START-DAY PIC 9(2).

Now WS-NEW-START-DATE will hold the value of WS-OLD-START-
DATE.

2)Using UNSTRING operator.

UNSTRING WS-NEW INTO WS-OLD

3)Using COMPUTE verb.

COMPUTE WS-NEW = WS-OLD.

4)Using SET statement.

SET OLD to NEW.

Is This Answer Correct ?    5 Yes 1 No

Without using move verb how to move one variable to another...

Answer / raju

Let the variables and their values be A = 20 and B = 30
and we need to swap them as A = 30 and B = 20 without MOVE statement
BEFORE AFTER
A B A B
Way 1: COMPUTE A = A+B 20 30 50 30
COMPUTE B = A-B 50 30 50 20
COMPUTE A = A-B 50 20 30 20

Way 2: COMPUTE A = A*B 20 30 600 30
COMPUTE B = A/B 600 30 600 20
COMPUTE A = A/B 600 20 30 20

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More COBOL Interview Questions

Difference between cobol and cobol-ii?

0 Answers  


have in 100 records in a flat file i want to move records like 1,3,5,7,9,11,.. to Output file1 and 2,4,6,8,10,12,14 .. records moved to Output file2..Pls Provide real time answer..

5 Answers   TCS,


What kind of error is trapped by on size error option?

0 Answers  


Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning

0 Answers  


what is Reentrancy and Quasi-reentrancy?

1 Answers  






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,


What will happen if you code GO BACK instead of STOP RUN in a stand-alone COBOL program i.e. a program which is not calling any other program ?

3 Answers  


level number 77 is used to define a)group data b)elementary data c)redefine d)none

8 Answers   TCS,


What is EIBCALEN? Why it is used?

9 Answers   ADP,


example for sub strings ? and refernce modifications whit output pls

0 Answers   College School Exams Tests, IBM,


how to convert vsam table into DB2 table?

1 Answers   IBM, Wipro,


How to print 10 to 1 if the input have only 10 digit number?

0 Answers  


Categories