EASYPLUS/EASYTRIEVE言語(日本CA株式会社。以前はアシスト社が販売)をCOBOLに変換します。
以下にEASYPLUS言語をCOBOL言語に変換した例を掲載します。
FILE FILEA FB(159 9540)
IN001 1 1 A
IN002 2 6 A
INAREA 1 80 A
INWORK 1 159 A
*
FILE FILEB FB(159 9540)
* WORK
WSAVE W 159 A
WFLAG W 2 A VALUE 'ON'
* MAIN PROC *
JOB
IF WFLAG = 'ON'
WSAVE = INWORK
INAREA = ' *XXXX* END;'
PUT FILEB FROM FILEA
INAREA = '1ダミーページ'
PUT FILEB FROM FILEA
INWORK = WSAVE
WFLAG = 'OF'
END-IF
IF IN002 = '*XXXX*'
IN001 = ' '
PRINT REP1
END-IF
PUT FILEB FROM FILEA
REPORT REP1
LINE 1 INAREA
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLEEA.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
中略
*---------------------------------------------------------------
* ユーザー定義作業域
*---------------------------------------------------------------
01 FILEA-FS PIC X(02) .
01 FILEB-FS PIC X(02) .
01 WSAVE PIC X(159) .
01 WFLAG PIC X(02) VALUE 'ON'.
01 LINE-01-REP1 .
02 INAREA PIC X(80) .
EJECT
PROCEDURE DIVISION.
******************************************************************
* MAIN
******************************************************************
MAIN SECTION.
MAIN-START.
中略
PERFORM JOB-1.
中略
GOBACK.
MAIN-END. EXIT.
SKIP3
******************************************************************
* JOB-1
******************************************************************
JOB-1 SECTION.
JOB-1-START.
中略
PERFORM JOB-1-INPUT UNTIL FILEA-FS NOT = ZERO.
MOVE 9 TO FIRST-SW.
中略
JOB-1-END. EXIT.
******************************************************************
* JOB-1-INPUT
******************************************************************
JOB-1-INPUT SECTION.
JOB-1-INPUT-START.
READ FILEA.
IF FILEA-FS NOT = ZERO GO TO JOB-1-INPUT-END.
IF WFLAG = 'ON'
MOVE INWORK TO WSAVE
MOVE ' *XXXX* END;' TO INAREA OF INAREA--R
WRITE FILEB-REC FROM FILEA-REC
MOVE '1ダミーページ' TO INAREA OF INAREA--R
WRITE FILEB-REC FROM FILEA-REC
MOVE WSAVE TO INWORK
MOVE 'OF' TO WFLAG
END-IF.
IF IN002 OF IN002--R = '*XXXX*'
MOVE ' ' TO IN001 OF IN001--R
PERFORM REP1
END-IF.
WRITE FILEB-REC FROM FILEA-REC.
JOB-1-INPUT-END. EXIT.
*****************************************************************
* REPORT REP1
*****************************************************************
REP1 SECTION.
REP1-START.
MOVE INAREA OF INAREA--R TO INAREA OF LINE-01-REP1.
WRITE SYSPRINT-REC FROM LINE-01-REP1.
REP1-END. EXIT.