Without using move verb how to move one variable to another.
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Difference between cobol and cobol-ii?
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..
What kind of error is trapped by on size error option?
Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning
what is Reentrancy and Quasi-reentrancy?
What is the difference beetween Arrays and Tables in Cobol? please dont give the answer that arrays in cobol terminology is called tables......
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 ?
level number 77 is used to define a)group data b)elementary data c)redefine d)none
What is EIBCALEN? Why it is used?
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?
How to print 10 to 1 if the input have only 10 digit number?