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

I doubt if we can code like IF ELSE ELSE....since no scope
terminatior (END-IF) has been given for the nested IF ELSE
so it should throw a compilation error. It can display the
output as (a) ONLY if the code is something like below:

01 GRP-1.
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"
END-IF
ELSE
DISPLAY "SPACES"
DISPLAY "END".

Please correct me if I am wrong.

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between structured cobol programming and object alternativelyiented cobol?

757


In which area will you utilize 88 level items in cobol?

724


Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?

827


What is the difference between perform … with test after and perform … with test before?

885


What happens when we move a comp-3 field to an edited (say z (9). Zz-)?

780






write a cobol logic. i have file that has 10 records .1 record go to first output file and second record goes to 2 output and etc

714


What is a report item?

741


How did the release of cobol/370 version 1.3 improve the performance of release 1.1?

645


What is the difference between a binary search and a sequential search what are the pertinent cobol?

737


What is report-item in COBOL?

713


Differentiate between structured cobol programming and object-oriented cobol programming.

671


There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.

934


What are the pertinent COBOL commands?

2629


I have a File that has duplicate records. I need only those records that occur more than thrice.?

8670


EXPLAIN MAIN FRAME TESTING PROCESS...HOW TO FIX THE MAINFRAME BUGS?

2060