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 Pic 9v99 Indicates?
can internal sort be applied to sort ksds files?
level number 77 is used to define a)group data b)elementary data c)redefine d)none
What are the different rules of SORT operation?
What are the cobol coding sheets?
can we use the two 01 level in file discription ?
TO abend the data sholud open in which mode? 1.new 2.old 3.mod 4.shr
What are the situations u have used in ur project for Subcript and Index ? 1.if u use Subscript why not Index,why u choose Subscript only? 2.if u use Index why not Subscript,what abt Displacement?
How to define variable 9(20) in COBOL, because compiler does not allow us to declare variables with Pic 9(18). Can anyone please let me know the answer... I know one answer to this question which is to use Compiler option Arith (Extend) during Compilation. It extends the maximum limit to 9(32)..Just wanted to know if there is any other way to extend this?
In COBOL "BEFORE" advancing is there or not ?
i Want All cobol ERROR codes?
I have a file it contain 10 records.i got abend at 8th record because of soc7.how do you know that perticular record got abend?