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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is inspect in cobol ?

1022


What is the compute verb? How is it used?

854


Which is not true about evaluate statement

2105


example for sub strings ? and refernce modifications whit output pls

2078


explain sorting techniques in cobol program?

900


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

2145


Describe the cobol database components?

900


Explain how to differentiate call by context by comparing it to other calls?

914


What is the difference between external and global variables in COBOL?

1052


How to use the same COBOL program in Batch and CICS on lines? explain with an example

2113


What rules are to be followed while using the corresponding options?

841


What is the problem of ordered sequential files access?

915


What are the different data types in cobol?

1060


What are the various section in data division and briefly explain them.

922


can you please let me know if there is any walkins for COBOL/PLI/DB2/IMS/JCL in pune other than IBM and ITC infotech

2185