RPG言語をCOBOLに変換します。
以下にRPG言語からCOBOL言語に変換した例を掲載します。
H Y/ 1
F*****************************************************************
F* フ ァ イ ル 仕 様 *
F*****************************************************************
FFIL01 IF E K DISK
C********************************************************************
C* パ ラ メ ー タ リ ス ト *
C********************************************************************
C *ENTRY PLIST
C PARM P@DATE 6
C PARM P@TIME 6
C PARM P@MAJC 2
C PARM P@MINC 2
C PARM P@ENDS 2
C*****************************************************************
C* メイン・パート *
C*****************************************************************
C *HIVAL SETLLFIL01
C READPFIL01 99
C*
C MOVE F1ENDD P@DATE
C MOVE F1ENDT P@TIME
C MOVELF1MJCD P@MAJC
C MOVELF1MNCD P@MINC
C MOVELF1ESTS P@ENDS
C*
C SETON LR
C RETRN
C****************************************************************
*H Y/ 1
IDENTIFICATION DIVISION.
PROGRAM-ID. 'SMPR01' INITIAL.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
*F*****************************************************************
*F* フ ァ イ ル 仕 様 *
*F*****************************************************************
SELECT FIL01 ASSIGN TO DATABASE-FIL01
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS
EXTERNALLY-DESCRIBED-KEY
FILE STATUS IS FS-FIL01 .
DATA DIVISION.
FILE SECTION.
FD FIL01.
01 FIL01-R.
COPY DDS-ALL-FORMATS OF FIL01.
WORKING-STORAGE SECTION.
COPY MIGCMN.
01 FS-FIL01 PIC X(02) VALUE SPACE.
LINKAGE SECTION.
*C********************************************************************
*C* パ ラ メ ー タ リ ス ト * *
*C********************************************************************
01 P_A_DATE PIC X(06).
01 P_A_TIME PIC X(06).
01 P_A_MAJC PIC X(02).
01 P_A_MINC PIC X(02).
01 P_A_ENDS PIC X(02).
PROCEDURE DIVISION USING P_A_DATE
P_A_TIME
P_A_MAJC
P_A_MINC
P_A_ENDS.
MAIN-RTN SECTION.
MAIN-RTN-START.
PERFORM INIT-RTN.
*C*****************************************************************
*C* メイン・パート *
*C*****************************************************************
MOVE HIGH-VALUE TO F1ENDD
MOVE HIGH-VALUE TO F1ENDT
START FIL01 KEY IS >= EXTERNALLY-DESCRIBED-KEY
INVALID KEY
CONTINUE
END-START
MOVE IN-OFF TO INDIC_99
READ FIL01 PRIOR
AT END
MOVE IN-ON TO INDIC_99
END-READ
*C*
MOVE F1ENDD TO P_A_DATE
MOVE F1ENDT TO P_A_TIME
MOVE F1MJCD TO P_A_MAJC
MOVE F1MNCD TO P_A_MINC
MOVE F1ESTS TO P_A_ENDS
*C*
MOVE IN-ON TO INDIC_LR
PERFORM FINAL-RTN
GOBACK
*C****************************************************************
PERFORM FINAL-RTN.
MAIN-RTN-EXIT. EXIT.
GOBACK.
*----------------------------------------
* 初期処理
*----------------------------------------
INIT-RTN SECTION.
INIT-RTN-START.
OPEN INPUT FIL01 .
IF FS-FIL01 NOT = ZERO
DISPLAY 'SMPR01 OPEN ERROR FIL01 :' FS-FIL01
CALL '@ABORT'
GOBACK
END-IF
INIT-RTN-EXIT. EXIT.
*----------------------------------------
* 終了処理
*----------------------------------------
FINAL-RTN SECTION.
FINAL-RTN-START.
CLOSE FIL01 .
FINAL-RTN-EXIT. EXIT.