View previous topic :: View next topic
|
Author |
Message |
sungang77
New User
Joined: 03 Nov 2005 Posts: 46 Location: Shanghai, China
|
|
|
|
Code: |
MAINLINE.
SET S-NOT-END-OF-FILE TO TRUE
PERFORM A0100-PROCESS-RECS
UNTIL S-END-OF-FILE
END-PERFORM.
A0100-PROCES-RECS.
READ I-PLAYER-FILE
AT END
ADD +1 TO A-FILES-PROCESSED
NOT AT END
PERFORM A0200-INC-TOTALS
END-READ. |
Question:The sample code above should handle a process of reading an input file and using an amount from the file to increment totals. The calculation section is NOT shown. What error in the sample code will prevent this process from working correctly?
Choice 1
A priming read should be done before the PERFORM.
Choice 2
S-END-OF-FILE is never set to true.
Choice 3
S-NOT-END-OF-FILE should not be set before the first read.
Choice 4
A mathematical statement cannot be used with an AT END clause.
Choice 5
The PERFORM?UNTIL should be based on a counter not end-of-file switch. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Choice 2. No eof indication to stop the loop = infinit loop. |
|
Back to top |
|
|
sungang77
New User
Joined: 03 Nov 2005 Posts: 46 Location: Shanghai, China
|
|
|
|
mmwife wrote: |
Choice 2. No eof indication to stop the loop = infinit loop. |
Yeah, I think you are right Jack. |
|
Back to top |
|
|
Santoshhn
New User
Joined: 18 May 2005 Posts: 5
|
|
|
|
Program will be in Loop.. |
|
Back to top |
|
|
|