If a programme is written in a language which ‘knows about’ the record structure, it won't be necessary to modify the code when the record structure changes.
TOTAL_WEIGHT = 0; NUMBER = 0 REPEAT [ READ_NEXT_RECORD IF(END_OF_FILE) BREAK IF("AGE" >= 18. AND "SEX" = 'F') [ TOTAL_WEIGHT = TOTAL_WEIGHT + "WEIGHT" NUMBER = NUMBER + 1 ] ] AVERAGE_WEIGHT = TOTAL_WEIGHT / NUMBER PRINT 'Average weight = ', AVERAGE_WEIGHT END
Slide show generated from sw.html by Weasel 2007 Mar 15