Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 000001 IDENTIFICATION DIVISION.
- 000002 PROGRAM-ID. BABEL.
- 000003 ENVIRONMENT DIVISION.
- 000004 INPUT-OUTPUT SECTION.
- 000005 FILE-CONTROL.
- 000006 SELECT INP ASSIGN TO BABELIN.
- 000007 DATA DIVISION.
- 000008 FILE SECTION.
- 000009 FD INP.
- 000010 01 FILERECORD PIC X(80).
- 000011 WORKING-STORAGE SECTION.
- 000012 01 DICTREC.
- 000013 02 BAB PIC X(20) OCCURS 1000 TIMES.
- 000014 02 NL PIC X(20) OCCURS 1000 TIMES.
- 000015 01 FC.
- 000016 02 NDICT PIC 9(4).
- 000017 02 NTRANS PIC 9(4).
- 000018 02 POINT PIC 9(4) VALUE 1.
- 000019 02 ITER PIC 9(4) VALUE 1.
- 000020 02 NEDR PIC X(20).
- 000021 02 BABR PIC X(20).
- 000022
- 000023 PROCEDURE DIVISION.
- 000024 MAIN.
- 000025 OPEN INPUT INP
- 000026 READ INP END-READ
- 000027 UNSTRING FILERECORD DELIMITED BY SPACES INTO NDICT NTRANS
- 000028 DISPLAY "READING " NDICT " ENTRIES FROM FILE"
- 000029 DISPLAY "TRANSLATING " NTRANS " ENTRIES FROM FILE"
- 000030 PERFORM FILLDICT VARYING POINT FROM 1 BY 1 UNTIL
- 000031 POINT > NDICT
- 000032 MOVE 1 TO POINT
- 000033 PERFORM TRANSWRD VARYING POINT FROM 1 BY 1 UNTIL
- 000034 POINT > NTRANS
- 000035 CLOSE INP
- 000036 STOP RUN
- 000037 .
- 000038 FILLDICT.
- 000039 READ INP END-READ
- 000040 UNSTRING FILERECORD DELIMITED BY SPACES INTO BAB(POINT)
- 000041 NL(POINT)
- 000042 DISPLAY "RECORD: " NL(POINT) " IS IN BABELS " BAB(POINT)
- 000043 .
- 000044 TRANSWRD.
- 000045 MOVE 1 TO ITER
- 000046 MOVE "NULL" TO NEDR
- 000047 READ INP END-READ
- 000048 MOVE FILERECORD TO BABR
- 000049 DISPLAY "LOOKING UP " BABR
- 000050
- 000051 PERFORM UNTIL ITER > NDICT
- 000052 DISPLAY "ITER= " ITER " POINTER " BAB(ITER) "?=" BABR
- 000053 IF BAB(ITER) EQUAL TO BABR THEN
- 000054 MOVE NL(ITER) TO NEDR
- 000055 EXIT
- 000056 END-IF
- 000057 ADD 1 TO ITER
- 000058 END-PERFORM
- 000059
- 000060 IF NEDR EQUAL TO "NULL" THEN
- 000061 DISPLAY "???"
- 000062 ELSE
- 000063 DISPLAY BABR
- 000064 END-IF
- 000065 .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement