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 |
how to code in cobol while using variable block file?
consider the following FD FILE-1 01 REC-1 PIC X(80) ...... WORKING-STORAGE SECTION 01 W-REC PIC X(90) ........ PROCEDURE DIVISION FIRST-PARA ....... READ FILE-1 INTO W-REC AT END MOVE 1 TO EOF-FLAG which of the following is true with respect to the above? a.REC-1 will contain nothing and W-REC will contain the contains of the record read b.REC-1 and W-REC contain the same data c.syntex is invalid and error will occur d.REC-1 and W-REC must be of same size
What will happen if we generate GDG (+2) version without generating (+1) version?
What is Static and Dynamic linking ?
How we copy a program from production region to development region.What is the process & syntax ?
How To Separate The Numerics From An Alphanumric Data Item Which Contains Both Alphabates And Numerics ?
What R 2 of the common forms of the EVALUATE STATEMENT ?
Explain the configuration section of a cobol program with examples of syntax.
What will happen if you code GO BACK instead of STOP RUN in a stand alone COBOL program ?
8 Answers Arigo Infotech, IBM,
how do u list the abended jobs?
How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?
The below is the declaration for a variable ws 01 ws pic 9(3). if you want to insert space how will you do that. in which level u should do it