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 |
A paragraph PARA-X is to be executed when none of the data names A, B and C have value of 1. Which of the following will achieve this ? (a) IF A NOT = 1 OR B NOT = 1 OR C NOT = 1 PERFORM PARA-X (B) IF NOT A= 1 AND B= 1 AND C = 1 PERFORM PARA-X (C) IF A NOT =1 IF NOT B = 1 OR C= 1 PERFORM PARA-X (C) IF A NOT = 1 AND B NOT = 1 AND C NOT = 1 PERFORM PARA-X
What is the difference between PIC 9.99 and 9v99 in COBOL?
0 Answers SwanSoft Technologies,
When would you use in-line perform?
How to read the last 100 records from a COBOL file. The file contains N number of records.
what happens when a copybook variables are declared using include statement ?
there is a file whose ORGANISATION is INDEXED.you want to read the records from the file in RANDOM fashion as well as sequentially.then which of the access mode would you specify? a.SEQUENTIAL b.RANDOM c.DYNAMIC D.ACCESS MODE has nothing to do with it
Suppose i want to declare a binary comp fild of 7 byte .how to write?
What is diff betn PS and ESDS file? What is the diffrent compiler options in cobol and there discription? What is retrive nth maximum salary from salary DB2 table. Can we redefine COM-3 variable with varchar variable?
i have a requrement in A as viswa!@#$%&^**reddy i need to move viswareddy in B without junk values pls say how to do ths reply fast
2)Where the Plan is located in CICS-DB2?
How can you declare the file ?
How to use the same COBOL program in Batch and CICS on lines? explain with an example