元のソースコード
******************************************************************
* Author:
* Date:
* Purpose:
* Tectonics: cobc
******************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTCOBOL7.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT EMPFW ASSIGN TO 'EMPFILEW'
ORGANIZATION INDEXED
ACCESS MODE IS RANDOM
RECORD KEY IS EMPKEY.
DATA DIVISION.
FILE SECTION.
FD EMPFW.
01 EMPF-REC.
03 EMPKEY PIC X(3).
03 EMPNO REDEFINES EMPKEY
PIC 9(3).
03 EMPNAME PIC X(10).
03 EMPBDATE PIC X(8).
WORKING-STORAGE SECTION.
01 CHECKDATE.
03 DATECENT PIC 9(2).
03 DATEINPUT PIC X(6).
03 CHECKDATEW REDEFINES DATEINPUT.
05 DATEYY PIC 9(2).
05 DATEMM PIC 9(2).
05 DATEDD PIC 9(2).
01 CDATE.
03 CYY PIC 9(2).
03 CMM PIC 9(2).
03 CDD PIC 9(2).
01 FLAG PIC 9.
01 TABLEWORK.
03 DDTBL PIC X(24)
VALUE "312931303130313130313031".
03 DDT REDEFINES DDTBL
PIC 9(2) OCCURS 12.
PROCEDURE DIVISION.
MAIN SECTION.
MAIN-PROCEDURE.
DISPLAY "社員ファイル作成".
PERFORM INIT-RTN.
PERFORM MAIN-RTN UNTIL EMPNO = 999.
PERFORM END-RTN.
STOP RUN.
MAIN-END.
EXIT.
INIT-RTN SECTION.
INIT-S.
OPEN OUTPUT EMPFW.
ACCEPT CDATE FROM DATE.
INIT-E.
EXIT.
MAIN-RTN SECTION.
MAIN-S.
DISPLAY "社員番号を入れてください".
ACCEPT EMPNO.
IF EMPNO = 999
GO TO MAIN-E.
DISPLAY "社員名をいれてください".
ACCEPT EMPNAME.
MOVE 1 TO FLAG
PERFORM UNTIL FLAG = 0
DISPLAY "生年月日を6桁でいれてください。"
ACCEPT DATEINPUT
PERFORM CHECK-DATE-RTN
END-PERFORM.
MOVE CHECKDATE TO EMPBDATE.
WRITE EMPF-REC.
MAIN-E.
EXIT.
END-RTN SECTION.
END-S.
CLOSE EMPFW.
END-E.
EXIT.
CHECK-DATE-RTN SECTION.
CHECK1-S.
MOVE 0 TO FLAG.
IF DATEYY NOT NUMERIC
THEN MOVE 1 TO FLAG
ELSE
IF DATEYY > CYY
THEN MOVE 19 TO DATECENT
ELSE MOVE 20 TO DATECENT.
IF DATEMM NOT NUMERIC
THEN MOVE 1 TO FLAG
ELSE IF DATEMM < 0 OR DATEMM > 12
THEN MOVE 1 TO FLAG.
IF DATEDD NOT NUMERIC
THEN MOVE 1 TO FLAG
ELSE IF DATEDD > DDT(DATEMM)
THEN MOVE 1 TO FLAG.
IF FLAG = 1
THEN DISPLAY "生年月日が正しくない".
CHECK1-E.
EXIT.
END PROGRAM TESTCOBOL7.
フローチャート図で表現したもの
%%{init: {'theme':'base','themeVariables':{
'primaryColor':'white',
'primaryTextColor':'#000000',
'primaryBorderColor':'#000000',
'lineColor':'#808080',
'textColor':'#6A7FABCC',
'fontSize''15px'}}}%%
%%{ init: { 'flowchart': { 'curve': 'basis' } } }%%
graph TD;
classDef default fill:#FFFFE0,stroke:#333,stroke-width:2px;
classDef clrPattern1 fill:#FFFF00,stroke:#333,stroke-width:2px;
classDef clrPattern2 fill:#F0E68C,stroke:#333,stroke-width:2px;
classDef clrPattern3 fill:#ADD8E6,stroke:#333,stroke-width:2px;
classDef clrPattern4 fill:#FFC0CB,stroke:#333,stroke-width:2px;
classDef clrPattern5 fill:#ADFF2F,stroke:#333,stroke-width:2px;
linkStyle default stroke:#808080,stroke-width:2px;
%%データ項目
21(["46行目
"])
22[/"48行目
DISPLAY “社員ファイル作成“."/]:::clrPattern5
23[["49行目
PERFORM INIT-RTN."]]:::clrPattern3
24[/"50行目
PERFORM MAIN-RTN UNTIL EMPNO
= 999.
"\]:::clrPattern2
25[["50行目
(一構文複数機能)PERFORM MAIN-RTN"]]:::clrPattern3
26[\"50行目
(一構文複数機能)END-PERFORM"/]:::clrPattern2
27[["51行目
PERFORM END-RTN."]]:::clrPattern3
28["52行目
STOP RUN."]
29(["54行目
EXIT."])
%%ルート設定
21-->22
22-->23
23-->24
24-->25
25-->26
26-->|繰返文を継続する|24
26-->|繰返文を終了する|27
27-->28
28-->29
%%{init: {'theme':'base','themeVariables':{
'primaryColor':'white',
'primaryTextColor':'#000000',
'primaryBorderColor':'#000000',
'lineColor':'#808080',
'textColor':'#6A7FABCC',
'fontSize''15px'}}}%%
%%{ init: { 'flowchart': { 'curve': 'basis' } } }%%
graph TD;
classDef default fill:#FFFFE0,stroke:#333,stroke-width:2px;
classDef clrPattern1 fill:#FFFF00,stroke:#333,stroke-width:2px;
classDef clrPattern2 fill:#F0E68C,stroke:#333,stroke-width:2px;
classDef clrPattern3 fill:#ADD8E6,stroke:#333,stroke-width:2px;
classDef clrPattern4 fill:#FFC0CB,stroke:#333,stroke-width:2px;
classDef clrPattern5 fill:#ADFF2F,stroke:#333,stroke-width:2px;
linkStyle default stroke:#808080,stroke-width:2px;
%%データ項目
30(["55行目
"])
31[/"57行目
OPEN OUTPUT EMPFW."/]:::clrPattern4
32[/"58行目
ACCEPT CDATE FROM DATE."/]:::clrPattern4
33(["61行目
EXIT."])
%%ルート設定
30-->31
31-->32
32-->33
%%{init: {'theme':'base','themeVariables':{
'primaryColor':'white',
'primaryTextColor':'#000000',
'primaryBorderColor':'#000000',
'lineColor':'#808080',
'textColor':'#6A7FABCC',
'fontSize''15px'}}}%%
%%{ init: { 'flowchart': { 'curve': 'basis' } } }%%
graph TD;
classDef default fill:#FFFFE0,stroke:#333,stroke-width:2px;
classDef clrPattern1 fill:#FFFF00,stroke:#333,stroke-width:2px;
classDef clrPattern2 fill:#F0E68C,stroke:#333,stroke-width:2px;
classDef clrPattern3 fill:#ADD8E6,stroke:#333,stroke-width:2px;
classDef clrPattern4 fill:#FFC0CB,stroke:#333,stroke-width:2px;
classDef clrPattern5 fill:#ADFF2F,stroke:#333,stroke-width:2px;
linkStyle default stroke:#808080,stroke-width:2px;
%%データ項目
34(["62行目
"])
35[/"64行目
DISPLAY “社員番号を入れてください“."/]:::clrPattern5
36[/"65行目
ACCEPT EMPNO."/]:::clrPattern4
37{"66行目
条件文"}:::clrPattern1
39(["67行目
(追加)THEN"])
40[/"67行目
GO TO MAIN-E."/]:::clrPattern5
41(["67行目
(追加)END-IF."])
42[/"68行目
DISPLAY “社員名をいれてください“."/]:::clrPattern5
43[/"69行目
ACCEPT EMPNAME."/]:::clrPattern4
44["70行目
MOVE 1 TO FLAG"]
45[/"71行目
PERFORM UNTIL FLAG = 0"\]:::clrPattern2
46[/"72行目
DISPLAY “生年月日を6桁でいれてください。“"/]:::clrPattern5
47[/"74行目
ACCEPT DATEINPUT"/]:::clrPattern4
48[["75行目
PERFORM CHECK-DATE-RTN"]]:::clrPattern3
49[\"76行目
END-PERFORM."/]:::clrPattern2
50["77行目
MOVE CHECKDATE TO EMPBDATE."]
51[/"78行目
WRITE EMPF-REC."/]:::clrPattern5
52[/"79行目
"/]:::clrPattern4
53(["80行目
EXIT."])
%%ルート設定
34-->35
35-->36
36-->37
37-->|条件文 真 |39
37-->|条件文 偽 |41
39-->40
40-->52
41-->42
42-->43
43-->44
44-->45
45-->46
46-->47
47-->48
48-->49
49-->|繰返文を継続する|45
49-->|繰返文を終了する|50
50-->51
51-->52
52-->53
style j1 color:red,fill-opacity:0, stroke-opacity:0
style j2 color:red,fill-opacity:0, stroke-opacity:0
subgraph j1["IF EMPNO = 999"]
subgraph j2[ ]
37
end
end
%%{init: {'theme':'base','themeVariables':{
'primaryColor':'white',
'primaryTextColor':'#000000',
'primaryBorderColor':'#000000',
'lineColor':'#808080',
'textColor':'#6A7FABCC',
'fontSize''15px'}}}%%
%%{ init: { 'flowchart': { 'curve': 'basis' } } }%%
graph TD;
classDef default fill:#FFFFE0,stroke:#333,stroke-width:2px;
classDef clrPattern1 fill:#FFFF00,stroke:#333,stroke-width:2px;
classDef clrPattern2 fill:#F0E68C,stroke:#333,stroke-width:2px;
classDef clrPattern3 fill:#ADD8E6,stroke:#333,stroke-width:2px;
classDef clrPattern4 fill:#FFC0CB,stroke:#333,stroke-width:2px;
classDef clrPattern5 fill:#ADFF2F,stroke:#333,stroke-width:2px;
linkStyle default stroke:#808080,stroke-width:2px;
%%データ項目
54(["81行目
"])
55[/"83行目
CLOSE EMPFW."/]:::clrPattern5
56(["85行目
EXIT."])
%%ルート設定
54-->55
55-->56
%%{init: {'theme':'base','themeVariables':{
'primaryColor':'white',
'primaryTextColor':'#000000',
'primaryBorderColor':'#000000',
'lineColor':'#808080',
'textColor':'#6A7FABCC',
'fontSize''15px'}}}%%
%%{ init: { 'flowchart': { 'curve': 'basis' } } }%%
graph TD;
classDef default fill:#FFFFE0,stroke:#333,stroke-width:2px;
classDef clrPattern1 fill:#FFFF00,stroke:#333,stroke-width:2px;
classDef clrPattern2 fill:#F0E68C,stroke:#333,stroke-width:2px;
classDef clrPattern3 fill:#ADD8E6,stroke:#333,stroke-width:2px;
classDef clrPattern4 fill:#FFC0CB,stroke:#333,stroke-width:2px;
classDef clrPattern5 fill:#ADFF2F,stroke:#333,stroke-width:2px;
linkStyle default stroke:#808080,stroke-width:2px;
%%データ項目
57(["86行目
"])
58["88行目
MOVE 0 TO FLAG."]
59{"89行目
条件文"}:::clrPattern1
61(["90行目
(一構文複数機能)THEN"])
62["90行目
(一構文複数機能) MOVE 1 TO FLAG"]
63(["91行目
ELSE"])
64{"92行目
条件文"}:::clrPattern1
66(["93行目
(一構文複数機能)THEN"])
67["93行目
(一構文複数機能) MOVE 19 TO DATECENT"]
68(["94行目
(一構文複数機能)ELSE"])
69["94行目
(一構文複数機能) MOVE 20 TO DATECENT."]
70(["94行目
(一構文複数機能)END-IF"])
71(["94行目
(追加)END-IF"])
72{"95行目
条件文"}:::clrPattern1
74(["96行目
(一構文複数機能)THEN"])
75["96行目
(一構文複数機能) MOVE 1 TO FLAG"]
76(["97行目
(一構文複数機能)ELSE"])
77{"97行目
条件文"}:::clrPattern1
79(["98行目
(一構文複数機能)THEN"])
80["98行目
(一構文複数機能) MOVE 1 TO FLAG."]
81(["98行目
(一構文複数機能)END-IF"])
82(["98行目
(追加)END-IF"])
83{"99行目
条件文"}:::clrPattern1
85(["100行目
(一構文複数機能)THEN"])
86["100行目
(一構文複数機能) MOVE 1 TO FLAG"]
87(["101行目
(一構文複数機能)ELSE"])
88{"101行目
条件文"}:::clrPattern1
90(["102行目
(一構文複数機能)THEN"])
91["102行目
(一構文複数機能) MOVE 1 TO FLAG."]
92(["102行目
(一構文複数機能)END-IF"])
93(["102行目
(追加)END-IF"])
94{"103行目
条件文"}:::clrPattern1
96(["104行目
(一構文複数機能)THEN"])
97[/"104行目
(一構文複数機能) DISPLAY “生年月日が正しくない“."/]:::clrPattern5
98(["104行目
(一構文複数機能)END-IF"])
99(["106行目
EXIT."])
%%ルート設定
57-->58
58-->59
59-->|条件文 真 |61
59-->|条件文 偽 |63
61-->62
62-->71
63-->64
64-->|条件文 真 |66
64-->|条件文 偽 |68
66-->67
67-->70
68-->69
69-->70
70-->71
71-->72
72-->|条件文 真 |74
72-->|条件文 偽 |76
74-->75
75-->82
76-->77
77-->|条件文 真 |79
77-->|条件文 偽 |81
79-->80
80-->81
81-->82
82-->83
83-->|条件文 真 |85
83-->|条件文 偽 |87
85-->86
86-->93
87-->88
88-->|条件文 真 |90
88-->|条件文 偽 |92
90-->91
91-->92
92-->93
93-->94
94-->|条件文 真 |96
94-->|条件文 偽 |98
96-->97
97-->98
98-->99
style j1 color:red,fill-opacity:0, stroke-opacity:0
style j2 color:red,fill-opacity:0, stroke-opacity:0
subgraph j1["IF DATEYY NOT NUMERIC"]
subgraph j2[ ]
59
end
end
style j3 color:red,fill-opacity:0, stroke-opacity:0
style j4 color:red,fill-opacity:0, stroke-opacity:0
subgraph j3[" IF DATEYY > CYY"]
subgraph j4[ ]
64
end
end
style j5 color:red,fill-opacity:0, stroke-opacity:0
style j6 color:red,fill-opacity:0, stroke-opacity:0
subgraph j5["IF DATEMM NOT NUMERIC"]
subgraph j6[ ]
72
end
end
style j7 color:red,fill-opacity:0, stroke-opacity:0
style j8 color:red,fill-opacity:0, stroke-opacity:0
subgraph j7["(一構文複数機能) IF DATEMM < 0 OR DATEMM > 12"]
subgraph j8[ ]
77
end
end
style j9 color:red,fill-opacity:0, stroke-opacity:0
style j10 color:red,fill-opacity:0, stroke-opacity:0
subgraph j9["IF DATEDD NOT NUMERIC"]
subgraph j10[ ]
83
end
end
style j11 color:red,fill-opacity:0, stroke-opacity:0
style j12 color:red,fill-opacity:0, stroke-opacity:0
subgraph j11["(一構文複数機能) IF DATEDD > DDT(DATEMM)"]
subgraph j12[ ]
88
end
end
style j13 color:red,fill-opacity:0, stroke-opacity:0
style j14 color:red,fill-opacity:0, stroke-opacity:0
subgraph j13["IF FLAG = 1"]
subgraph j14[ ]
94
end
end