NATURAL言語コンバージョン・サービス(COBOL版)

NATURAL言語をCOBOLに変換します。

以下にNATURAL言語からCOBOL言語に変換した例を掲載します。

プログラム例

変換前 NATURALソース

      
V0190**-----< DEFINE DATA  >-----**
V0200DEFINE DATA
V0210 GLOBAL    USING  RGDA
V0220 LOCAL     USING  SRF020V0
V0230 LOCAL     USING  SRF030V0
V0240 LOCAL     USING  ZO02A
V0250 LOCAL     USING  ZO07L
V0260 LOCAL     USING  ZO08L
V0270 LOCAL     USING  ZO10L
V0280 LOCAL
V0290  01  #M-AREA
V0300    02  #M-PRCNBR(A01)
V0310    02  #M-MSGCTT(A66)
V0320    02  #M-PFKGUD(A72)
V0330  01  #W-RDSRF030
VLIB1    RCDAO220
V0340    02  #W-MSGNBR(A04)
V0350    02  #W-MSGCTT(A66)
V0360  01  #W-CUR   (N02)  INIT  <1>
V0370  01  #W-ENDFLG(A01)
V0380  01  #W-OUTPGM(A08)
V0390*
V0430END-DEFINE
V0450** (1.0) M A I N
V0470 INCLUDE ZO10C
V0480 PERFORM P2000-M-INIT
V0490 PERFORM P3000-M-MAIN
V0500 PERFORM P4000-M-END
V0520** (2.0) INIT  PROC
V0540DEFINE SUBROUTINE P2000-M-INIT
V0550 SET KEY ALL
V0600 MOVE #C-PFKGUD        TO  #M-PFKGUD
V0610 RESET #W-ENDFLG  #W-OUTPGM  #CV-AREA
V0620END-SUBROUTINE
V0640** (3.0) MAIN  PROC
V0660DEFINE SUBROUTINE P3000-M-MAIN
V0670 REPEAT
V0680  PERFORM  P3100-M-INPMAP
V0690    DECIDE ON FIRST VALUE OF *PF-KEY
V0700      VALUE  'ENTR'
V0710        PERFORM  P3200-M-INPCHK
V0720      NONE VALUE
V0730        PERFORM  P3300-M-PFKCTL
V0740    END-DECIDE
V0750    IF  #W-ENDFLG  =  '1'
V0760      ESCAPE BOTTOM
V0770    END-IF
V0780  PERFORM  C100-M-MSG
V0790 END-REPEAT
V0800END-SUBROUTINE
V1220** (4.0) END  PROC
V1240DEFINE SUBROUTINE P4000-M-END
V1250 MOVE *PROGRAM    TO  #G-EXEPGM
V1260 IF #W-OUTPGM  =  ' '
V1270  MOVE  *PROGRAM  TO  #W-OUTPGM
V1280 END-IF
V1290 FETCH #W-OUTPGM
V1300END-SUBROUTINE
V1320** (C1.0) MSG SET  PROC
V1340DEFINE SUBROUTINE C100-M-MSG
V1350 IF #W-MSGNBR  NE  ' '
V1360  MOVE  #W-MSGNBR      TO  #ZO080-MSGNBR
V1370  INCLUDE  ZO08C
V1380  MOVE  #ZO080-MSGCTT  TO  #W-MSGCTT
V1390 END-IF
V1400END-SUBROUTINE
V1410**-----< PROGRAM END >-----**
V1420END
























































      
    

このページのトップへ戻る

変換後 COBOLソース(一部割愛)

      
      **-----< DEFINE DATA  >-----**
       IDENTIFICATION      DIVISION.
       PROGRAM-ID.         SMPN01.
       ENVIRONMENT         DIVISION.
       INPUT-OUTPUT        SECTION.
       DATA                DIVISION.
       WORKING-STORAGE     SECTION.
      *
       01 WORKAREA.
      * MAP AREA
             03 S-M-AREA.
                 05 S-M-PRCNBR                     PIC X(01).
                 05 S-M-MSGCTT                     PIC X(66).
                 05 S-M-PFKGUD                     PIC X(72).
             03 S-W-RDSRF030.
                 05 S-W-MSGNBR                     PIC X(04).
                 05 S-W-MSGCTT                     PIC X(66).
             03 S-W-CUR                            PIC S9(02) VALUE 1.
             03 S-W-ENDFLG                         PIC X(01).
             03 S-W-OUTPGM                         PIC X(08).
      *
             03 S-C-PFKGUD                         PIC X(78) VALUE
             'PF3:メイン'.
             EXEC SQL INCLUDE  SRF020V0.CPY END-EXEC.
             EXEC SQL INCLUDE  SRF030V0.CPY END-EXEC.
      * PF-KEY GUIDE PARM
             EXEC SQL INCLUDE  ZO02A.CPY END-EXEC.
      * PF-KEY   PARM
             EXEC SQL INCLUDE  ZO07L.CPY END-EXEC.
      * MESSAGE  PARM
             EXEC SQL INCLUDE  ZO08L.CPY END-EXEC.
      * ON ERROR PARM
             EXEC SQL INCLUDE  ZO10L.CPY END-EXEC.
             EXEC SQL INCLUDE  AO22.CPY  END-EXEC.
             EXEC SQL INCLUDE  SYSAREA.CPY  END-EXEC.
             EXEC SQL INCLUDE  SQLCA END-EXEC.
             COPY CONSTANTS.
      *
       LINKAGE             SECTION.
           COPY ONLCTLA.
           COPY MAPIOA.
      * GDA
           EXEC SQL INCLUDE  RGDA.CPY END-EXEC.
           COPY WORKSAVEA.
           COPY FETCHPRMA.
      *
       PROCEDURE DIVISION USING
           ONLCTL-AREA
           MAPIO-AREA
           S-G-GDA1
           WORKSAVE-AREA
           FETCH-PARAMETER-AREA
      *
       MAIN-RTN SECTION.
       MAIN-RTN-START.
           PERFORM INIT-RTN
      ** (1.0) M A I N
      * ON ERROR
           COPY ZO10C.
      * INIT PROC
           PERFORM P2000-M-INIT
      * MAIN PROC
           PERFORM P3000-M-MAIN
      * END PROC
           PERFORM P4000-M-END
           PERFORM FINAL-RTN
           GOBACK.
       MAIN-RTN-EXIT. EXIT.
      ** (2.0) INIT  PROC
      *
       P2000-M-INIT SECTION.
       P2000-M-INIT-START.
      * SET KEY ALL
           MOVE S-C-PFKGUD TO S-M-PFKGUD
           INITIALIZE  S-W-ENDFLG
                       S-W-OUTPGM
                       S-CV-PRCNBR-AD S-CV-PRCNBR-CD.
       P2000-M-INIT-EXIT. EXIT.
      ** (3.0) MAIN  PROC
      *
       P3000-M-MAIN SECTION.
       P3000-M-MAIN-START.
           PERFORM UNTIL FLG-LOOPEXIT-1-ON
              PERFORM P3100-M-INPMAP
              EVALUATE A-PF-KEY
                 WHEN 'ENTR'
                    PERFORM P3200-M-INPCHK
                 WHEN OTHER
                    PERFORM P3300-M-PFKCTL
              END-EVALUATE
              IF   S-W-ENDFLG = '1'
              THEN
                 EXIT PERFORM
              END-IF
              PERFORM C100-M-MSG
           END-PERFORM.
       P3000-M-MAIN-EXIT. EXIT.
:省略
      ** (4.0) END  PROC
      *
       P4000-M-END SECTION.
       P4000-M-END-START.
           MOVE A-PROGRAM TO S-G-EXEPGM
           IF   S-W-OUTPGM = ' '
           THEN
              MOVE A-PROGRAM TO S-W-OUTPGM
           END-IF
           MOVE S-W-OUTPGM TO A-NEXT-PGM
           PERFORM FINAL-RTN
           GOBACK.
       P4000-M-END-EXIT. EXIT.
      ** (C1.0) MSG SET  PROC
      *
       C100-M-MSG SECTION.
       C100-M-MSG-START.
           IF   S-W-MSGNBR NOT = ' '
           THEN
              MOVE S-W-MSGNBR TO S-ZO080-MSGNBR
              EXEC SQL INCLUDE ZO08C.CPY END-EXEC.
              MOVE S-ZO080-MSGCTT TO S-W-MSGCTT
           END-IF.
       C100-M-MSG-EXIT. EXIT.
      **-----< PROGRAM END >-----**
:省略
      
    

このページのトップへ戻る