What is the output generated by the following code?
01 GRP-I.
05 SUBFLD1 PIC XX VALUE "AB".
05 FILTER PIC X(6) VALUE SPACES.
01 GRP-2 REDEFINED GRP-1.
05 SUB-FLD2 PIC XX.
05 SUB-FLD3 PIC XX.
05 FILTER PIC X(4).
IF SUB-FLD1 NOT = SPACES
DISPLAY "SUBFLD1"
MOVE "ABBCCD" TO GRP-1
IF SUB-FLD3 = SPACES
DISPLAY "SPACES"
ELSE
DISPLAY "SUBFLD3"
DISPLAY "END"
ELSE
DISPLAY "SPACES"
DISPLAY "END".
(a) SUBFLD1
SUBFLD3
END
(b) SPACES
END
(c) SUBFLD1
END
(d) SUBFLD1
SPACES
Answer Posted / vish
Uttam, I guess you missed to see the REDEFINES part of the
code given. It's moving 'ABBCCD' to GRP-1 and since GRP-2
REDEFINES GRP-1, the variables in GRP-2 also will be
populated and then naturally SUB-FLD3 is not SPACES and
contain 'BC'. So the correct answer is (a).
I request - please don't be in hurry to answer the
questions. A lot many people build their concepts based on
the questions & queswers provided in such groups.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Write the code implementing the perform … varying.
What is amode(24)?
What happens when we move a comp-3 field to an edited (say z (9). Zz-)?
Which Search verb is equivalent to PERFORM…VARYING?
Are you comfortable in cobol or jcl?
what happens if parmparameter passes zero bytes to the program
What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?
how do you define single dimensional array and multidimensional array in your cobol?
What is the use of intialize verb?
What is perform what is varying?
What is rmode(any) ?
how can i see junk values in dclgen or in hostvariable of comp ?
how we sort two input files based on a common column and giving one o/p file please send me the coding logic?
What is a scope terminator give example?
When is inspect verb is used in cobol?