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 |
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 to write to a outfile where the number of records in that file should be the header of that file using IMS.. can anyone help me in this issue
What is the difference beetween Arrays and Tables in Cobol? please dont give the answer that arrays in cobol terminology is called tables......
What is Redefines clause?
Hai friends why we need to read a file before re-write a record?
maximum of how many screens we can open in emulator
hie everyone.i just completed my b.tech in electronics and joined mainframes course.am i doing right course for my better future?please help me with your suggestions.ill be very thankful to you guys.
What is the compute verb? How is it used?
what is label record is standard or omitted in file description of data division?
diffrence between renames and redifnes with examples
In EBCDIC, how would the number 1234 be stored?
have in 100 records in a file i want to move only matched records to one output_file1 and nonmathed records are moved to another output_file2 ... any one can provide logic code