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



What will happen if a variable is declared as below.. Explain with an example? Working storage sec..

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

What will happen if a variable is declared as below.. Explain with an example? Working storage sec..

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

What will happen if a variable is declared as below.. Explain with an example? Working storage sec..

Answer / sandy

Mallikarjun is 100% correct

Is This Answer Correct ?    5 Yes 2 No

What will happen if a variable is declared as below.. Explain with an example? Working storage sec..

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

What will happen if a variable is declared as below.. Explain with an example? Working storage sec..

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 will happen if a variable is declared as below.. Explain with an example? Working storage sec..

Answer / siva

WS-VARX = 12345FGHIJ
WS-VARN = 12345

Is This Answer Correct ?    1 Yes 14 No

Post New Answer

More COBOL Interview Questions

plz any one tell clearly the justify right clause?

1 Answers  


What is the difference between working storage copybook and linkage section copybook?

5 Answers   TCS,


i need a program by giving input as a abcd in any randem order but i need a output as 1234 related to abcd. i.e,. a for 1,b=2,c.....etc..

5 Answers   IBM,


I want ALL jcl ERROR cods

1 Answers  


where will we code call by content and call by reference dude pls reply soon ?

2 Answers  






What is amode(24)?

0 Answers  


What are the various section in data division and briefly explain them.

0 Answers  


What is 88 level used for ?

2 Answers  


) How do you access the migrate the data from production region to development region

1 Answers   IBM,


I hav vari declaration like..... 77 a pic s9(9).99. 77 b pic s9(9).99 comp. 77 c pic s9(9).99 comp-3. if i use MOVE 123456789.99 to a,b,c what happen every one working fine ?

1 Answers   Mphasis,


Can we move X(9) to 9(9). If yes what are the ways for doing this?

3 Answers  


Consider the below example call a-test1. -- -- -- a-test1. if a=b perform a-test through a-exit next sentence else if b=c perform c-test through c-exit. if a=d perform d-test through d-exit. a-test. -- -- a-exit. exit. can u tell me what will happen if a=b after looping into a-exit will the control go back to a- test1. will the condition a=d be checked???

5 Answers   IBM,


Categories