ブログ - open cobol
brew updateしたら,open cobolというものがあったので,確認.
やっぱりCOBOLコンパイラ.GNU COBOLのことだそうです.
早速インストール.
インストール完了.ほとんどはBerkeley DBのダウンロード時間だった.
サンプルを拾ってきたので,hello.cobを作成.
行番号が必要なのと,アスタリスクがコメント行を示すってのは,懐かしいな.
コンパイルして実行.
-xオプションをつけると,実行ファイルが作成される.つけないと動的ライブラリが作成される.
実行してみる.
ありがとうございました.
$ brew info open-cobol
open-cobol: stable 1.1 (bottled)
COBOL compiler
https://sourceforge.net/projects/open-cobol/
Conflicts with:
gnu-cobol (because both install `cob-config`, `cobc` and `cobcrun` binaries)
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/open-cobol.rb
==> Dependencies
Required: gmp ✔, berkeley-db ✘
$
早速インストール.
$ brew install open-cobol
==> Installing dependencies for open-cobol: openssl, berkeley-db
==> Installing open-cobol dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2o_2.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2o_2.sierra.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
==> Summary
🍺 /usr/local/Cellar/openssl/1.0.2o_2: 1,792 files, 12.3MB
==> Installing open-cobol dependency: berkeley-db
==> Downloading https://homebrew.bintray.com/bottles/berkeley-db-18.1.25.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring berkeley-db-18.1.25.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/berkeley-db/18.1.25: 5,672 files, 116.7MB
==> Installing open-cobol
==> Downloading https://homebrew.bintray.com/bottles/open-cobol-1.1_2.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring open-cobol-1.1_2.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/open-cobol/1.1_2: 38 files, 1007.2KB
$
サンプルを拾ってきたので,hello.cobを作成.
$ cat hello.cob
000100* HELLO.COB GNU Cobol FAQ example
000200 IDENTIFICATION DIVISION.
000300 PROGRAM-ID. hello.
000400 PROCEDURE DIVISION.
000500 DISPLAY "Hello World!".
000600 STOP RUN.
$
コンパイルして実行.
$ cobc -x hello.cob
$ ls -la
total 28
drwxr-xr-x 5 ujpadmin 191071026 170 6 27 16:35 .
drwx------+ 87 ujpadmin 191071026 2958 6 27 16:33 ..
rwxr-xr-x 1 ujpadmin 191071026 9348 6 27 16:35 hello
rw-r--r-- 1 ujpadmin 191071026 181 6 27 16:35 hello.cob
$
実行してみる.
$ ./hello