View previous topic :: View next topic
|
Author |
Message |
spriya
New User
Joined: 06 Oct 2005 Posts: 42
|
|
|
|
what is the output of the following
01 grp-1.
05 sub-ft1 pic xx value'ab'.
05 sub-ft2 pic x(6) value spaces.
05 grp-2 redefine grp1.
02 sub-ft2 pic xx.
02 sub-ft3 pic xx.
02 filler picx(4).
if sub-ft1 not=space
display'sub-ft1'.
move "abdefc" to grp-1.
if sub-ft2 =space
display'sub-ft2'
else
display'sub-ft3'
display'end'
else
display'space,
display'end'. |
|
Back to top |
|
|
narenndra_tallapireddy
New User
Joined: 12 Jul 2005 Posts: 5
|
|
|
|
please make sure that the level nos which you mentioned are correct if it is the answer will abcdef of group-1.
i think the level nos must be identical when we are redifing the data elements of one group to another.other wise it will not redefine. simply it will move abcdef to group-1 .
if iam mistaken please correct me.
narendra. |
|
Back to top |
|
|
bonniem
New User
Joined: 09 Aug 2005 Posts: 67
|
|
|
|
I guess this code will not compile. REDEFINES should be at the same level only. |
|
Back to top |
|
|
spriya
New User
Joined: 06 Oct 2005 Posts: 42
|
|
|
|
yes i did wrong the level number should b same |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi priya,
You've also got 2 else following the last if. That's a compile error too. |
|
Back to top |
|
|
spriya
New User
Joined: 06 Oct 2005 Posts: 42
|
|
|
|
hi mmwife,
bt they asked like this in my interview.can u tell me the ans... |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Priya,
If what you posted is what they gave you, your only answer has to be:
Your ques has 2 syntactical errors. The 05 levels must be subsumed under one or more of the three 02 levels. You have them BEFORE the 02 levels.
The last IF stmt is followed by two ELSE stmts. Only one is permissable.
The code will not compile successfully.
I don't know why they did this. Maybe they made a mistake. Maybe it's a trick question. |
|
Back to top |
|
|
Vinodc
New User
Joined: 01 Dec 2005 Posts: 33 Location: Prague
|
|
|
|
Hi spriya,
The answer to this is that you cant actually get any output. Thats because you cant successfully compile this peice of code. While compilation you will get IGYPS2011 error saying an else doesnt have a matching if. Maybe this was the answer your interviewer was expecting.
Vinod Chawda |
|
Back to top |
|
|
|