Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program-id. Program1 as "assignmen_8.Program1".
- environment division.
- input-output section.
- select model-master assign to "C:\temp\model-master.txt" organization is line sequential.
- select model-report assign to "C:\temp\model-report.txt" organization is line sequential.
- data division.
- file section.
- fd model-master.
- 01 model-file.
- 05 name-in pic x(20).
- 05 weight-in pic 999.
- 05 height-in pic 99.
- 05 eyes-in pic 9.
- 05 hair-in pic 9.
- 05 sex-in pic x.
- fd model-report.
- 01 model-record.
- 05 pic x(9).
- 05 name-out pic x(20).
- 05 pic x(4).
- 05 sex-out pic x.
- 05 pic x(6).
- 05 weight-out pic x(3).
- 05 pic x(6).
- 05 height-out pic x(3).
- 05 pic x(6).
- 05 eyes-out pic x(5).
- 05 pic x(6).
- 05 hair-out pic x(6).
- 05 pic x(5).
- working-storage section.
- 01 page-heading.
- 05 pic x(29) value spaces.
- 05 pic x(22) value "M O D E L R E P O R T".
- 05 pic x(8) value spaces.
- 05 pic x(5) value "PAGE ".
- 05 page-num pic 99 value zero.
- 05 pic x(3) value spaces.
- 05 the-date.
- 10 c-day pic xx/.
- 10 c-month pic xx/.
- 10 c-year pic xxxx.
- 01 temp-date.
- 05 temp-year pic xxxx.
- 05 temp-month pic xx.
- 05 temp-day pic xx.
- 01 field-heading.
- 05 pic x(9) value spaces.
- 05 pic x(4) value "NAME".
- 05 pic x(19) value spaces.
- 05 pic x(3) value "SEX".
- 05 pic x(4) value spaces.
- 05 pic x(6) value "WEIGHT".
- 05 pic x(2) value spaces.
- 05 pic x(6) value "HEIGHT".
- 05 pic x(2) value spaces.
- 05 pic x(9) value "EYE COLOR".
- 05 pic x(2) value spaces.
- 05 pic x(10) value "HAIR COLOR".
- 05 pic x(3) value spaces.
- 01 end-flag pic x(3) value "YES".
- 01 line-num pic 99 value zero.
- procedure division.
- 100-main.
- open input model-master
- output model-report
- move function current-date to temp-date
- perform 150-print-heading
- perform until end-flag = "NO"
- read model-master
- at end move "NO" to end-flag
- not at end
- perform 200-write-record
- end-read
- end-perform
- close model-master
- model-report
- goback.
- 150-print-heading.
- add 1 to page-num
- move temp-year to c-year
- move temp-month to c-month
- move temp-day to c-day
- move page-heading to model-record
- write model-record after advancing page
- move field-heading to model-record
- write model-record after advancing 3 line
- move zero to line-num
- move spaces to model-record
- write model-record after advancing 1 line.
- 200-write-record.
- move spaces to model-record
- if line-num = 10
- perform 150-print-heading
- end-if
- if sex-in = "M"
- if hair-in = 1 and eyes-in = 1
- if height-in >= 72
- if weight-in >= 185 and weight-in <= 200
- add 1 to line-num
- move name-in to name-out
- move sex-in to sex-out
- move weight-in to weight-out
- move height-in to height-out
- move "BLUE" to eyes-out
- move "BLONDE" to hair-out
- write model-record
- end-if
- end-if
- end-if
- end-if
- if sex-in = "F"
- if hair-in = 2 and eyes-in = 2
- if height-in >= 62 and height-in <= 66
- if weight-in >= 110 and weight-in <= 125
- move name-in to name-out
- move sex-in to sex-out
- move weight-in to weight-out
- move height-in to height-out
- move "BROWN" to eyes-out
- move "BROWN" to hair-out
- write model-record
- add 1 to line-num
- end-if
- end-if
- end-if
- end-if.
- end program Program1.
Advertisement
Add Comment
Please, Sign In to add comment