|
|||||||||||||||||||||
| |||||||||||||||||||||
|
|||||||||||||||||||||
|
********** (ファイルをテーブルに展開してから使用する) ********** IDENTIFICATION DIVISION. PROGRAM-ID. TBL050. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT F1 ASSIGN TO "C:\DAT\TB03B.DAT" STATUS FST ACCESS MODE IS SEQUENTIAL. SELECT F2 ASSIGN TO "C:\DAT\TB03A.DAT" STATUS FST ACCESS MODE IS SEQUENTIAL. DATA DIVISION. FILE SECTION. ***** ( EKI - NAME - FILE ) ***** FD F1. 01 F1R. 03 F1CD PIC X(04). 03 F1NM PIC X(12). ***** ( KINGAKU - FILE ) ***** FD F2. 01 F2R. 03 F2CD PIC X(04). 03 F2KIN PIC 9(06). * WORKING-STORAGE SECTION. 01 F1FST PIC X(02). 01 F2FST PIC X(02). 01 I PIC 9(02) VALUE ZERO. ***** ( 駅名 テーブル領域 ) ***** 01 TB1 VALUE SPACE. 03 T1R OCCURS 25. 05 T1CD PIC X(04). 05 T1NM PIC X(12). ***** ( 表示用領域 ) ****** 01 D1R. 03 D1CD PIC X(04)B(02). 03 D1NM PIC X(12)B(02). 03 D1KIN PIC \\\\,\\9. * PROCEDURE DIVISION. * ***** ( テーブルのセット ) ***** DISPLAY "!!! TBL050 STARTED !!!" OPEN INPUT F1 INITIALIZE TB1 PERFORM UNTIL F1FST NOT = "00" READ F1 END CONTINUE NOT END ADD 1 TO I MOVE F1R TO T1R(I) END-READ END-PERFORM CLOSE F1 DISPLAY "!!! TABLE-SET-END !!!" * ***** ( 駅名の検索・表示処理 ) ***** OPEN INPUT F2 PERFORM UNTIL F2FST NOT = "00" READ F2 END CONTINUE NOT END * ***** ( テーブル検索 ) ***** PERFORM VARYING I FROM 1 BY 1 UNTIL I > 25 OR F2CD = T1CD(I) CONTINUE END-PERFORM ***** ( 駅名の表示 ) ***** IF I > 25 THEN DISPLAY F2CD " < CODE - ERR> " ELSE MOVE F2CD TO D1CD MOVE T1NM(I) TO D1NM MOVE F2KIN TO D1KIN DISPLAY D1R END-IF END-READ END-PERFORM DISPLAY "!!! TBL050 - ENDED !!!" CLOSE F2 STOP RUN.