Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- identification division.
- program-id. Program1.
- environment division.
- input-output section.
- select reg-table assign to "C:\temp\registration-table.txt"
- organization is line sequential.
- select reg-trans assign to "C:\temp\registration-trans.txt"
- organization is line sequential.
- select reg-report assign to "C:\temp\registration-report.txt"
- organization is line sequential.
- configuration section.
- data division.
- file section.
- fd reg-table.
- 01 in-table.
- 05 in-vehicle-class pic xx.
- 05 in-rate pic v999.
- fd reg-trans.
- 01 in-trans.
- 05 reg-vehicle-class pic xx.
- 05 vehicle-name pic x(20).
- 05 vehicle-weight pic 99999.
- 05 vehicle-desrip pic x(12).
- fd reg-report.
- 01 out-record.
- 05 pic x(7).
- 05 out-vehicle-class pic xx.
- 05 pic x(7).
- 05 out-vehicle-name pic x(20).
- 05 pic x(4).
- 05 out-vehicle-weight pic z9999.
- 05 pic x(5).
- 05 out-fee pic $zz,zzz.99.
- 05 pic x(20).
- working-storage section.
- 01 top-heading.
- 05 pic x(20) value spaces.
- 05 pic x(19) value
- "REGISTRATION REPORT".
- 05 pic xx value spaces.
- 05 c-day pic xx/.
- 05 c-month pic xx/.
- 05 c-year pic xxxx.
- 05 pic xxx value spaces.
- 05 pic x(5) value "PAGE ".
- 05 page-num pic 99 value zero.
- 05 pic x(19) value spaces.
- 01 temp-date.
- 05 t-year pic xxxx.
- 05 t-month pic xx.
- 05 t-day pic xx.
- 01 rec-heading.
- 05 pic xx value spaces.
- 05 pic x(13) value "VEHICLE CLASS".
- 05 pic xx value spaces.
- 05 pic x(4) value "NAME".
- 05 pic x(19) value spaces.
- 05 pic x(6) value "WEIGHT".
- 05 pic x(5) value spaces.
- 05 pic x(3) value "FEE".
- 05 pic x(26) value spaces.
- 01 rate-table.
- 05 rt-tbl occurs 10 times indexed by ind.
- 10 tbl-class pic xx.
- 10 tbl-rate pic v999.
- 01 x pic 99 value zero.
- 01 eof pic x value "N".
- procedure division.
- 100-main.
- open input reg-table reg-trans
- output reg-report
- perform 200-write-heading
- perform varying x from 1 by 1 until x > 10
- read reg-table
- perform 250-fill-table
- end-perform
- perform until eof = "Y"
- read reg-trans
- at end move "Y" to eof
- not at end
- perform 300-write-record
- end-read
- end-perform
- close reg-table reg-trans reg-report
- goback.
- 150-get-date.
- move function current-date to temp-date
- move t-year to c-year
- move t-month to c-month
- move t-day to c-day.
- 200-write-heading.
- perform 150-get-date
- move top-heading to out-record
- write out-record
- move rec-heading to out-record
- write out-record after advancing 2 lines
- move spaces to out-record
- write out-record after advancing 1 line.
- 250-fill-table.
- move in-vehicle-class to tbl-class(x)
- move in-rate to tbl-rate(x).
- 300-write-record.
- move spaces to out-record
- set ind to 1
- search rt-tbl
- at end display "vehicle class not found"
- when tbl-class(ind) = reg-vehicle-class
- compute out-fee = tbl-rate(ind) * vehicle-weight
- move reg-vehicle-class to out-vehicle-class
- move vehicle-name to out-vehicle-name
- move vehicle-weight to out-vehicle-weight
- write out-record
- end-search.
- end program Program1.
Advertisement
Add Comment
Please, Sign In to add comment