What will happen if a variable is declared as below..
Explain with an example? Working storage section:-
01 WS-VARX PIC X(10) VALUE 'ABCDEFGHIJ'.
01 WS-VARN REDEFINES WS-VARX PIC 9(5) VALUE '12345'.
What will happen I am going to Display the WS-VARX and WS-
VARN?
Answers were Sorted based on User's Feedback
Answer / mallikarjun
WE CANNOT GIVE VALUE CLAUSE IN THE SECOND STATEMENT I.E.
WS-VARN REDEFINES WS-VARX PIC 9(5) VALUE '12345' . IF YOU
SPECIFY VALUE CLAUSE SYSTEM WILL SHOW AN ERROR, IF YOU
SPECIFY WITH OUT VALUE CLAUSE I.E.
WS-VARN REDEFINES WS-VARX PIC 9(5).
THEN IF YOU GIVE DISPLAY STATEMENT THEN ABCDEFGHIJ AND
ABCDE WILL BE DISPLAYED
| Is This Answer Correct ? | 26 Yes | 3 No |
Answer / mallikarjun
if you use redefines in your statement the numeric
declaration will be over rided and stored as charechter, i
have testing this practically
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / neela
Hi KHB Naidhu,
pic x means it should be alphanumeric
pic 9 means it should be Numeric
so we have to move numeric values also to the pic x
for this qtion is correct what was explained my
mallikarjuna.
regards
Neela
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / khbnaidu
Mallikarjun Ur answer is wrong because of WS-VARN is Numric
field & how will display the ABCDE result?
| Is This Answer Correct ? | 2 Yes | 13 No |
For rewrite, why is it mandatory that file needs to be opened?
what is the purpose of linkage section?
Please let me know at which Scenarios we will go for STATIC call or DYNAMIC
) what is the difference between AID and HANDLE AID?
what are the limitations of Inline Perform?
OCCURS clause is used in the DATA DIVISION on data names at (a) 01 level (b) 77 level (c) 88 level (d) any level from 02 to 49
i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?
What is SQL Code -904 and -903 in DB2 And how to handle it?
how can we fetch 3 records in cobol pgm any coding pls ?
how do you reference the fixed unblock file formats from cobol programs
Whats the difference between search & search ALL?
Hi All, Can anyone tell me how we can MOVE value of a X(19) variable to a S9(17) COMP-3 variable? Answer with an Example will be of great help.