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 the difference between occurs and occurs depending on? i dont think so there is the difference in storage..then why we should use occurs depending on?
Suppose i want to declare a binary comp fild of 7 byte .how to write?
How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?
how do u list the abended jobs?
how to refer the data field?
How can you get the ksds file records into your cobol program?
how can we apply for HSBC exam(Mainframe) in India??? i went to their site and was told to submit my CV ,. etc..( totally confusing...)
What is the difference between external and global variables in COBOL?
I have a Flat file in which certain records are present in a tabular format. I need to extract some of the records on some basis from it and copy them into a flat file...how it can be done ??
How to read a record from bottom of a file which is indexed by 'A'.
How do define dynamic array in cobol. how do you define single dimensional array and multidimensional array in your cobol?
)If there are 10 steps in GDG, if I want to refer the step2 after step5 . what should I do?