>>40939
*fortune
IDENTIFICATION DIVISION.
PROGRAM-ID. fortune.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT fortune ASSIGN TO "fortune.dat"
ORGANIZATION IS RELATIVE
ACCESS IS RANDOM
RELATIVE KEY IS fortune-pos.
DATA DIVISION.
FILE SECTION.
FD fortune RECORD CONTAINS 80 CHARACTERS.
01 fortune-rec PIC X(80).
WORKING-STORAGE SECTION.
01 fortune-pos PIC 9(6).
01 fortune-size PIC 9(6).
01 seed.
02 seed-date PIC 9(8).
02 seed-time PIC 9(8).
01 seed-2 PIC 9(16).
01 rand COMP-2.
PROCEDURE DIVISION.
OPEN INPUT fortune.
MOVE 1 TO fortune-pos.
READ fortune.
MOVE fortune-rec TO fortune-size.
*ACCEPT seed-date FROM DATE YYYYMMDD.
ACCEPT seed-time FROM TIME.
*MOVE seed TO seed-2.
*DISPLAY seed-2.
MOVE FUNCTION RANDOM(seed-time) TO rand.
MULTIPLY fortune-size BY rand GIVING fortune-pos.
READ fortune.
DISPLAY fortune-rec.
CLOSE fortune.
STOP RUN.