1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/bin/sh
cblsrc=./cobolsrc.tmp
cblbin=${cblsrc}.bin
cat <<++EOS > $cblsrc
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
ENVIRONMENT DIVISION.
DATA DIVISION.
*
WORKING-STORAGE SECTION.
01 GREETING-STRING.
10 STR01 PIC X(05).
10 FILLER PIC X(01) VALUES ' '.
10 STR02 PIC X(06).
*
PROCEDURE DIVISION.
MAIN-RTN.
MOVE 'HELLO' TO STR01.
MOVE 'WORLD!' TO STR02.
DISPLAY GREETING-STRING.
MOVE 0 TO RETURN-CODE.
EXIT PROGRAM.
*
++EOS
cobc -free -x $cblsrc -o $cblbin && $cblbin
echo "\$?=$?"
rm $cblsrc $cblbin
|