TinyCOBOL documents written in wiki
Version: 0.02
Author:
Hudson Reis
Original language:
Brazil, Portuguese
Translator:
Hudson Reis
Revised by: Glen
Cunningham
License: FDL
TinyCOBOL installation
Needed Packages:
Libraries:
- Libc/Libm: GNU C Libraries
Compiler:
-
GCC 2.95.x: C Compiler.
- GAS(Binutils): Tools to C and Assembly
development.
- Flex: Gramatical and Logical scanner used in
parser.
- Berkeley YACC(byacc): Gramatical and Logical analizer
used in parser.
- Bison: Gramatical and Logical analizer used in
parser, like Byacc.
- Ncurses: Library used in Screen section.
-
Libdb: Library used in indexed files.
- Getopts: Tool to get
informations from command-line.
- Bash Shell: Shell
interpreter.
Tools:
- Sed: A stream editor
-
Makefiles: A tool to aid compilation.
- GDB: A program debugger.
-
CVS: Maitainance, download and source code control.
- Perl:
Scripts for compiling test_suite examples.
- Tcl/tk: Graphic Unit
Interfaces(GUI's) development.
- Cgi-util: CGI development.
-
PostgreSQL/MySQL/Interbase: Database development.
- Cygwin:
windows-development environment using cygnus tools.
- Mingw:
windows-development environment using gnu tools.
Installing needed packages:
Here is how to install libdb, Cygwin and mingw.
LibDb:
The
LibDB is a library needed by indexed files in TinyCOBOL. It was
created by Berkeley University.
Download:
The libdb library
may be downloaded from Sleepycat at http://www.slepycat.com
or Ibiblio at http://www.ibiblio.org/pub/linux/libs/db
Installation:
Unpack the db-1.85.4-src.tar.gz
file using tar.
tar -zxvf db-1.85.4-src.tar.gz
After unpack, go to the PORT/linux
directory
cd db.1.85.4/PORT/linux
Use the Makefiles to start the
compilation. You do "make all" to compilation the cource
and generate the necessary objects for linking.
make all
After compilation, it is time to
link the objects, generate the libdb libraries and install them. To
do that, you must use "make install"
make install
To use the libdb library in a program, you must pass in
linkstep the -ldb parameter.
ex: gcc -o program program.o
-lhtcobol -lm -ldb
Major versions of libdb 1.85.4:
Download a libdb library(ex: db-2.7.7.tar.gz) into a directory of your choice.
Unpack the db-2.7.7.tar.gz file
using tar:
tar -zxvf db-2.7.7.tar.gz
After unpack, change to the build_unix directory and use the configure script to start the verification of libdb needed packages. Remember that you must insert the "--enable-compat185" parameter to enable the compatibility API with the 1.85.4 library.
cd db-2.7.7/build_unix ../dist/configure --enable-compat185
Use Makefiles to start the
compilation. Type "make" to compile and generate all
necessary objects.
make
After compilation, it is time to link the objects, generate
libraries and install them. You must use "make install"
make
install
Notes for instalation:
Notice that you need to use the "--enable-compat185" parameter to enable the compatibility API from libdb 1.85.4 library.
Although it was explained here how to install the major libraries of libdb 1.85.4, you should give preference to the libdb-1.85.4 version, because only this library version is free and another problem is that if you create a file using libdb 1.85.4 version and you try to modify this file using a major versions of libdb, this file won't be modified.
Just in case of any problems in compiling libdb 1.85.4, look for a patch to fix these in http://pragana.net/cgi-bin/wiki.pl?LibdbPatch
If you have a redhat linux and have an error in the configure script on veryfing the packages needed by libdb, you should access the /lib directory and add symlinks for the libraries with libdb prefix and numeric end.
ex: ln -s libdb1.so libdb.so ex: ln -s db1/db.h db.h
Notes about major versions of libdb library:
When the major
versions of libdb library aren't compatible with libdb 1.85.4
library, then:
The libdb 1.85.4 and libdb 2.0 versions, should be used in linkstep as -ldb and -ldb1, respectively.
To enable the libdb's 1.85.4 version compability API, you must insert the "--enable-compat185" parameter when you run the configure script.
Cygwin:
Definition,
Thanks,
Tutorials and hints to installation,
Downloading Cygwin program,
Basic steps to Cygwin installation,
Download of needed packages by Cygwin,
Cygwin Instalation,
Finishing Cygwin instalation,
How to use Cygwin with bash and ms-dos prompt,
Understanding the Cygwin functionality of bash.
1. Definition.
Cygwin is a group of POSIX GPL tools which were ported to the windows environment and these tools can be executed in an ms-dos prompt or in a bash shell. To run the configure scripts, you should use a bash shell simulating a POSIX terminal. The user can choose between the ms-dos prompt and a bash shell to develop your aplications. Cygwin is an acronym of CYGnus(The partner name) + WINdows. It is a project sponsored by RedHat. Then, at a ms-dos prompt, you can be use POSIX system comands, such as ls, cp, man, make and others. You can execute configure scripts or use files that have a period as prefix(ex: .vimrc), you can use a sh or bash shell or execute a GUI interface within an X server, loading the window manager of your choice. Cygwin is a complete POSIX development environment under windows.
2. Thanks.
Thanks to Roberto Luiz Souza Monteiro, at info at souzamonteiro.com for hints and explanations. Thanks! :-)
3. Tutorials and types to install.
These may be found in issues 50 and 51 of pcmaster magazine. There are tutorials about Cygwin installation, using text mode and including all sources needed. The address to buy the 50 and 51 issues of the pcmaster magazine is http://www.europanet.com.br/revistas/pcmaster/vai_anterior.htm. Search the site for number 50 and 51.
4. Downloading Cygwin program.
In webpage http://www.cygnus.com or http://www.cygwin.com , you can download the setup.exe file which is then used for your Cygwin installation.
5. Basic steps to Cygwin instalation.
Now, we will install
Cygwin. However, we will install in two steps:
The first step is to download the Cygwin packages. These packages are stored in bz2 format.
After getting the packages, they will be installed using the Cygwin program installer.
6. Download of needed packages to Cygwin.
In this first
part, we will get the Cygwin packages to be installed. It is very
important that you follow this part step by step, otherwise the
process will not complete correctly. After the download of setup.exe,
double click in setup.exe to start your Cygwin installation.
In welcome screen, click in next to go to the next screen.
Select "download from internet"(to get the files)
and click next to continue.
Enter the directory where the Cygwin packages are to be
stored.
Select the configurations to get the files. If you have a ppp
connection, use "Direct connection", if you use cable modem
or other thing like that, "use IE5 settings" or "HTTP/FTP
proxy".
Now, it dispays the list of all avaliable mirrors. Select
one near you. Here (ftp.unicamp.br)
is selected and click next.
Now, it will search the list of avaliable packages in the
selected mirror and display them in the following window. To select
any of the full groups, click on the “Default” text
message, repeated clicks will cycle through the options "Skip,
Install, Reinstall or Default". To select an individual item,
check the appropriate checkbox. You have the option of getting the
binaries or the sources. It is recommended that all packages are
installed. Later, it may be necessary to remove some packages, due to
version compatibilities (ex: libdb, gcc, bison).
Click next and wait for the download of Cygwin packages.
Usually this process gets about 200MB in bzipped files and takes
around 8 hours with a 56k modem. Obviously a faster connection is
better to get these files.
7. Cygwin Instalation.
After
the download, double click in setup.exe to start the installation.
Click “Next”
Select "Install from Local Directory"
Select the default configuration options.
Root directory: c:/Cygwin
Install for: all users
Default text file type: Unix
Type in the location of the downloaded packages (Local package
directory)
After that, the package list will be displayed. In the “All”
group, click until it shows “Install”
Click in “Next” to start the instalation.
After instalation, the installer program will ask about the
following items: Select both, then click “Finish”:
Create icon on desktop
Add icon to Start Menu
If all is ok, the installer program will show the following
confirmation message about Cygwin instalation. Press ok. Now, the
Cygwin is installed in your system. To confirm this, go to start
menu, click in programs, Cygwin solutions and click in Cygwin bash
shell. You should be shown a shell as in a POSIX system.
8. Finishing Cygwin instalation.
To finish the Cygwin installation, you may add "C:\CYGWIN\BIN" to the PATH variable in autoexec.bat. This allows you to use the Cygwin tools in ms-dos prompt(without a bash). After that, you must restart your computer.
9. How to use Cygwin by bash and by ms-dos prompt.
Cygwin is basically a lot of POSIX tools ported to the Windows environment by Red Hat. The prompt created by Cygwin is just a bash shell. The shortcut in start menu/programs/Cygwin solutions/Cygwin Bash Shell, points to Cygwin.bat file. Opening the Cygwin.bat to analize, I notice that it is very simple:
@echo off C: chdir \Cygwin\bin bash --login -i
Notice that chdir(or cd), changes the directory to "c:\Cygwin\bin", and then executes bash, which creates a shell "atmosphere" in an ms-dos window. The bash shell allows you to use tools which are not possible for you to use at the ms-dos prompt, such as configure scrips.
Just in case you don't want to use this POSIX prompt, you can access ms-dos prompt and use the POSIX commands, since you have set the "C:\CYGWIN\BIN" in your PATH variable in autoexec.bat
If you want to load the bash shell in ms-dos prompt, type
bash:
bash --login -i
10. Understanding the Cygwin functionality through
bash.
Cygwin works the following way:
Evaluate a
constant called "/cygdrive/c" to determine the C: drive of
a PC. The cygdrive is stored in windows registry in a key called
"cygdrive prefix"
From a embebbed point of view, then all the programs that use
this reference:
/cygdrive/c/Cygwin/bin is
c:\Cygwin\bin
/cygdrive/c/mingw/bin is c:\mingw\bin
With the "/" it will assume the directory where Cygwin was installed C:\CYGWIN
With the "/usr/bin" it will assume the bin directory where Cygwin was installed. C:\CYGWIN\BIN
With the "/usr/lib" it will assume the lib directory where Cygwin was installed. C:\CYGWIN\LIB
This values are stored also in windows registry in keys called "native".
Although the HOME environment variable may be set to the initial directory of Cygwin, if this variable is empty, it search the directory /home/$USER (or C:\CYGWIN\$USER), where USER is a environment variable to indicate a username. As with any POSIX distribution, the Cygwin determine your paths in /etc/profile file(or C:\CYGWIN\etc\profile). If you view the /etc/profile file, you notice that from this way, Cygwin see the environment variable $PATH for last and this way, you cannot use your ms-dos programs with Cygwin. To solve this problem, you must modify this structure in your /etc/profile file this way:
change: PATH="/usr/local/bin:/usr/bin:/bin:$PATH" to: PATH="$PATH:/usr/local/bin:/usr/bin:/bin"
So, it first evaluates the declared paths in environment variable PATH in our autoexec.bat. The directory "c:\Cygwin\bin" is considerated in bash as /usr/bin. This is used so you don't need to always use the Cygwin bash, having the ability to choose between the bash or ms-dos prompt to develop your applications in windows environment.
MinGw
Definition,
Thanks,
Tutorials and hints to installation,
Downloading mingw program,
Installing mingw,
Finishing mingw instalation,
Testing the installation,
Using Cygwin tools with mingw tools together.
1. Definition.
Mingw is a group of GNU tools which was specifically ported to the Windows environment. They add GCC, BINUTILS and others. The principal goal of mingw is to allow the use of GNU tools, binaries and shared libraries with Windows native API's.
MinGW is a acronym of Minimalist GNU for Windows(a GNU project), therefore, is a set of minimal GNU tools to development under Windows, so mingw does not have an X server and at first may seen a disadvantage, but is not so. When you link your programs, MinGW uses the msvcrt.dll (Microsoft Visual C Run-time), and generates win32 native binaries and interfaces directly with your API's.
A problem in mingw is to execute configure scripts. Unfortunately it doesn't port a bash shell, so it was decided to create msys, which gives a much reduced bash functionality.
2. Thanks.
Thanks to Roberto Luiz Souza Monteiro, at info at souzamonteiro.com for hints and explanations passed. Thanks! :-)
3. Tutorial and hints to installation.
Tutorials and guides to mingw installation may be founded in: http://mingw.sourceforge.net/mingwfaq.shtml
4. Downloading mingw program.
To get the mingw program, get
the file mingw-1.1.tar.gz from the
address:
http://sourceforge.net/project/showfiles.php?group_id=2435
5. Installing mingw
To install mingw, follow this
steps:
Create a directory (ex: c:\mingw)
Access this directory and under it, unzip this file using a winzip 8.0 (which does support unzipping tar.gz files)
Add the path "C:\MINGW\BIN" to your PATH environment variable in autoexec.bat
Restart your computer.
6. Finishing mingw instalation.
Remember, to finish the mingw installation, you should add "C:\MINGW\BIN" to the PATH environment variable, to that the GNU programs that we need can be found. It is very important that when you set the path "C:\MINGW\BIN", that it not after the path "C:\CYGWIN\BIN", otherwise the programs to be founded in ms-dos prompt are the program's compiled with Cygwin's runtime library. Therefore, if you have also the Cygwin installed in your system, you must set your path this way:
ex: SET PATH=%PATH%;C:\MINGW\BIN;C:\CYGWIN\BIN;
You must
restart your computer for this to take effect.
7. Testing the instalation.
To verify if the instalation is
complete, type "gcc -v" in your ms-dos prompt. If it shows
the following message:
Reading specs from c:/mingw/bin../lib/gcc-lib/mingw32/2.95.3-5/specs
This shows that mingw is sucessufully installed. If it shows the following message:
Reading specs from /usr/lib/gcc-lib/i686-pc-Cygwin/2.95.3.5/specs gcc version 2.95.3-5 (Cygwin special)
You don't have the paths to mingw set correctly. Repeat the
installation process.
8. Using Cygwin tools with mingw tools.
To use the Cygwin tools with mingw tools together, you should install Cygwin and set the "C:\CYGWIN\BIN" in PATH environment variable in your autoexec.bat. You need to modify the autoexec.bat file, modifying it by typing in first the mingw path and then typing the Cygwin path.
SET PATH=%PATH%C:\MINGW\BIN;C:\CYGWIN\BIN;
This may seem
repetitious, but the order of these paths is very important. After
this modification you must restart your computer.
With this modification, when you use any POSIX program or when you need a POSIX library or POSIX program, it searches first in mingw dependencies, and after, it searches in Cygwin dependencies.
Just in case of you want to use configure scripts, you have to enable bash. The bash shell is only found in Cygwin dependencies, but whenever a configure script was executed, the configure script will search first in mingw dependencies. Just in case it doesn't find anything, if you do not set C:\MINGW\BIN in your autoexec.bat it will search in Cygwin dependencies.
Using a bash(Cygwin dependencies), we should notice that in mingw environment, the /bin directory does not exist. So we should edit the /etc/profile (or C:\CYGWIN\ETC\PROFILE, I suggest that you access this file with bash) and remove the /bin directory from PATH, this way:
Change from: PATH="/usr/local/bin:/usr/bin:/bin:$PATH:" to: PATH="$PATH:/usr/local/bin:/usr/bin"
If in bash, type the command "echo $PATH", you should obtain the answer like this:
/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/COMMAND:/cygdrive/c/MINGW/BIN:/usr/bin:.:/usr/local/bin
where:
All itens were declared in
autoexec.bat:
/cygdrive/c/WINDOWS is equal to
C:\WINDOWS
/cygdrive/c/WINDOWS/COMMAND is equal to
C:\WINDOWS\COMMAND
/cygdrive/c/MINGW/BIN is equal to
C:\MINGW\BIN
This items were declared in autoexec.bat, but Cygwin
interpret them as /bin directory, for this reason we should remove
the "/bin" directory from /etc/profile.
/usr/bin is
equal to C:\CYGWIN\BIN
This items were declared in
/etc/profile(or C:\CYGWIN\BIN\PROFILE) or in other
places:
/usr/local/bin is equal to C:\CYGWIN\USR\LOCAL\BIN
Notes
About Mingw and Cygwin
Well, in begin, seems that the Cygwin is totaly highter than Mingw, in all aspects, however it isn't true. A one of principal advantages of mingw is the generation of binaries and libraries. When any application is linked with Cygwin, for a example, this application must need from a Cygwin run-time library called cygwin1.dll to be executed, while Mingw not. Mingw generate a binary or a library from windows API's, generating a NATIVE windows binary. The applications generated by mingw, need only to msvcrt.dll library(Microsoft Visual C Run-time), which is a C runtime library and your routines may be used for any C compiler which respect the ANSI C guidelines, like GCC. The file msvcrt.dll is present in any windows version.
Well, notice that Mingw is Cygwin complete themselves. Using the configure scripts from Cygwin bash and compiling using mingw's GCC, may be use TinyCOBOL as any COBOL distribution which exist in Windows environment. In begin, may be hard to install this applications, but all that is new is hard, after is easy!
Downloading TC:
Using a browser:
To get TinyCOBOL from within a browser, you should access the snapshots section in http://tiny-cobol.sourceforge.net/snapshots.html and get the package of your choice.
By ftp:
To get TinyCOBOL from ftp, you should access the ftp section in ftp://tiny-cobol.sourceforge.net/pub/tiny-cobol . At the prompt:
% ftp % ftp> open ftp://tiny-cobol.sourceforge.net/pub/tiny-cobol % password: (press enter)
By cvs:
Anonymous CVS access (From command line)
You
could get the CVS repository files, acessing as a anonymous CVS,
according from the following instructions:
1. Logging as a
anonymous user(there is no password, just press enter)
cvs -d:pserver:anonymous@cvs.tiny-cobol.sourceforge.net:/cvsroot/tiny-cobol login
Obs: If you access CVS from Linux and receive a error message saying
that the file .cvspass does not exist in your home directory, you
must create this file (“touch .cvspass” will create the
empty file).
2. Getting the files:
cvs -d:pserver:anonymous@cvs.tiny-cobol.sourceforge.net:/cvsroot/tiny-cobol checkout development
3. Logoff from CVS repository:
cvs -d:pserver:anonymous@cvs.tiny-cobol.sourceforge.net:/cvsroot/tiny-cobol logout
CVS Access by GUI:
You may get the files for acessing CVS
from a GUI, get the program in the following addresses:
CVS Access by Browser:
If you want to access the CVS
repository by internet, use the address
http://sourceforge.net/cvs/?group_id=383.
Installing TC:
To install TC it is necessary to compile and link the TC source code. However, in different environments, you can have some problems with the tools that are necessary to compile and link the TC source code. In Linux, you must install the libraries that are needed by the compiler (GCC, GAS, Flex, Bison or Byacc, ncurses, libdb and getopts). In windows, you must install also mingw or Cygwin(or both).
Verifying the needed packages:
To prepare to install TC, use the configure script. It has the goal to verify (it searches for needed packages) that the system is ready to install. Type "./configure" to start the instalation. If you are interested in more information about the configure script, type "./configure --help" in your bash. The most important options are:
--with-lang=ARG : set the default language(en/es/fr/it/pt_BR) default=en
--with-compiler=ARG: set the default compiler(gcc/kgcc/egcs) default=gcc
--with-yacc=ARG : set the default YACC(yacc193) version default=bison
--with-libltdl : use LTDL library to run-time dynamic load routines.
--with-libdb=ARG : set the default libdb(2/3/4) version default=1.85.4
--with-readline : use readline library
--with-dl : use dynamic loader for RTS libraries
Compiling programs:
After the end of configure, it is time to compile your sources. To ease your work, type "make" to compile and link the sources. If there are no errors after make, you must become the superuser and then type "make install" to install the binaries in your system and install man pages(if you have them).
Location of the binaries after instalation:
After
install, the files are located in:
Binaries:
htcobol: /usr/local/bin
htcobolpp: /usr/local/share/htcobol
htcobf2f: /usr/bin/
Libraries:
libhtcobol.so: /usr/local/lib
Documentation:
htcobol.1: /usr/local/share/man/man1
htcobolpp.1: /usr/local/share/man/man1
htcobf2f.1: /usr/local/share/man/man1
User's profile configuration:
During the binaries installation, if you install TC in a place other than the default place(/usr/local/share/htcobol), then it will be necessary to declare the environment variables $COBDIR and $PATH manually.
Compiler environment variables:
TCOB_OPTIONS:
Environment-variable responsible for the options file name
(htcobolrc)
TCOB_OPTIONS_PATH: Environment-variable needed
to locate where the options file is installed
TCOB_PP_PATH:
Environment-variable needed to locate where the preprocessor is
installed
TCOB_LD_LIBRARY_PATH: Environment-variable
responsible for dynamic call loading.
TEMP:
Environment-variable to locate the TEMP files.
Compiling programs with TC
First, some history. In the MS-Dos environment, when the TC compiler was first developed, there was no free C compiler to parse the COBOL code, so instead of C, the free assembler masm was used. To port TC to Linux, Alan Cox ported the COBOL compiler which worked with the MS-Dos assembler masm to use GAS (Gnu Assembly) in Linux, making the start for project we have today.
Compilation process:
The compiler process is divided
in three parts.
Translation of a COBOL source into a GAS source,
Translation of a GAS source into object code,
Translation of an object code into a binary code.
Translation of a COBOL source into a GAS source
To
translate the COBOL source into a GNU Assembly source, you should use
the htcobol program, which will generate a file with *.s extension,
with same name as the COBOL program.
htcobol -S program.cob
In the example above, it will generate the following file:
program.s: the COBOL source translated to GNU Assembler source.
Translation of a GNU Assembly source into an object code
To
create the object code, is necessary to use the AS tool to assemble
and link from the program.s file, and generate an object file called
program.o
as -o program.o program.s
In the example above, it generates the following file:
program.o: program.s file compiled and linked(object code).
Translation of a object code to a binary code.
Now, you
must translate the object code generated by AS(program.o) into a
binary file linking with GCC and joining the object file with other
OS shared or static objects.
gcc program program.o -lhtcobol -m
Compiler Switches
A Switch is a parameter which is
passed by a user to the compiler through the command line so that it
can execute a particular function for the user, without the necessity
for external commands(as AS and GCC). Generally, switches are called
as "compiler options".
See the htcobol manfile to
see all switches supported by our front-end(htcobol).
Comparison
of compiler process alone (without a switch) and compiler process
using a switch.
Compiler process (alone):
htcobol -S program.cob as -o program.o program.s gcc -o program program.o -lhtcobol -lm
Compiler process (using a switch):
htcobol -x program.cob
Notice that in compiler process using a switch, it only needed only one line to compile, assemble and link the program, while without the switch to the compiler, 3 lines were needed to compile, assemble and link the program.
Linking programs with TC
TinyCOBOL requires that particular libraries are added(linked) into the binary program, to be enable your funcionality. Ex: screen section libraries, indexed files, tcl/tk, databases, etc. These libraries can be configured in the htcobolrc file.
1. Libraries that must be used in all programs:
lhtcobol: TinyCOBOL Run-time library
lm......: Arithmetic (maths) calculation library
2. Additional Libraries:
2.1. Screen section and
DISPLAY/ACCEPT verbs:
lncurses.: Library for SCREEN SECTION use and to allow the use of ACCEPT/DISPLAY with line/position mode.
2.2. Files:
ldb: Libdb: Library to indexed files use.
ldb1: LibDB version 1
ldb2: LibDB version 2
ldb3: LibDB version 3
ldb4: LibDB version 4
2.3. Environment variables:
lreadline: Library to allow history and editing, as in bash.
2.4. Dynamic calls:
ldl: Using libdl as a library for dynamic subroutine calls (dynamic loader)
ltdl: Using libtool as a library for dynamic subroutine calls (dynamic loader)
lsubrots: Library to create subroutines
ltextz: Library to create subroutines
2.5. Databases:
lpq: Library to interface with PostgreSQL
lmyisam: Library to interface with MySQL
lcrypt: Library to interface with interbase
2.6. GUI Development:
ltcl: Library to tcl program's use
ltk: Library to tcl toolkit's use
ltcl8.0: Library to tcl 8.0 version program's use
ltk8.0: Library to tcl 8.0 version toolkit's use
ltcl8.3: Library to tcl 8.3 version program's use
ltk8.3: Library to tcl 8.3 version toolkit's use
Installing TC in a Windows Environment
Using Cygwin
TinyCOBOL Installation in Windows using Cygwin.
Download the needed packages for to TinyCOBOL work,
Installing TinyCOBOL,
Testing the instalation,
Compiling and linking a program with TinyCOBOL.
1.1. Download the needed packages for to TinyCOBOL work,
To
let TinyCOBOL work, it is necessary to install the following
packages:
Libdb 1.86
Getopts 1.0.3
Yacc 1.9.3
Installing needed packages:
Here is an explaination of how to
install the binaries of needed packages:
Libdb 1.86
Get the file db-1.86-1.Cygwin.tar.gz in our homepage.
Unpack this file in c:\CYGWIN directory, according the following criteria:
libdb.a in c:\Cygwin\lib
db.h in c:\Cygwin\usr\include\db.h
mpool.h in c:\Cygwin\usr\include\mpool.h
btree.3 in c:\Cygwin\usr\man\man3\btree.3
mpool.3 in c:\Cygwin\usr\man\man3\mpool.3
hash.3 in c:\Cygwin\usr\man\man3\hash.3
recno.3 in c:\Cygwin\usr\man\man3\recno.3
dbopen.3 in c:\Cygwin\usr\man\man3\dbopen.3
Or then, access Cygwin bash shell
and execute the following commands:
% cd /
% tar -zxvf
db-1.86-1.Cygwin.tar.gz
Yacc 1.9.3
Get the file yacc-1.9.3-1.Cygwin.zip in our homepage
Unpack the file yacc-1.9.3-1.Cygwin.zip
Unpack the file yacc-1.9.3-1.Cygwin.tar.gz in c:\CYGWIN directory, according the following criteria:
yacc193.exe in c:\Cygwin\bin\yacc193.exe
yacc.1 in c:\Cygwin\usr\man\man1\yacc.1
ACKNOWLEDGEMENTS in c:\Cygwin\usr\doc\yacc-1.9.3-1\ACKNOWLEDGEMENTS
NEW_FEATURES in c:\Cygwin\usr\doc\yacc-1.9.3-1\NEW_FEATURES
NOTES in c:\Cygwin\usr\doc\yacc-1.9.3-1\NOTES
NO_WARRANTY in c:\Cygwin\usr\doc\yacc-1.9.3-1\NO_WARRANTY
README in c:\Cygwin\usr\doc\yacc-1.9.3-1\README
ChangeLog in c:\Cygwin\usr\doc\yacc-1.9.3-1\ChangeLog
INSTALL.TXT in c:\Cygwin\usr\doc\yacc-1.9.3-1\INSTALL.TXT
Or then, access Cygwin bash shell
and execute the following commands:
% cd /
% unzip
yacc-1.9.3-1.Cygwin.zip
% tar -zxvf yacc-1.9.3-1.Cygwin.tar.gz
Getopt 1.0.3
Get the file getopt-1.0.3.Cygwin.tar.gz in our homepage.
Unpack this file in c:\Cygwin directory, according the following criteria:
libgnugetopt.a in c:\Cygwin\lib\libgetopt.a
libgnugetopt.h in c:\Cygwin\usr\include\getopt.h
COPYING in c:\Cygwin\usr\doc\getopt-1.0.3-1\COPYING
Changelog in c:\Cygwin\usr\doc\getopt-1.0.3-1\Changelog
getopt.1 in c:\Cygwin\usr\doc\getopt-1.0.3-1\getopt.1
getopt-1.0.3.lsm in c:\Cygwin\usr\doc\getopt-1.0.3-1\getopt-1.0.3.lsm
README in c:\Cygwin\usr\doc\getopt-1.0.3-1\README
TODO in c:\Cygwin\usr\doc\getopt-1.0.3-1\TODO
Or then, access Cygwin bash shell
and execute the following commands:
% cd /
% tar -zxvf
getopt-1.0.3.Cygwin.tar.gz
TinyCOBOL X.XX
Get the file tinycobol-X.XX.tar.gz in our homepage.
1.2. Installing TinyCOBOL.
With all libraries installed,
access Cygwin bash shell and execute the following commands:
% cd / % tar -zxvf tinycobol-X.XX.tar.gz % cd tinycobol-X.XX % ./configure % make % make install
1.3. Testing the instalation.
To test if TinyCOBOL was
sucessufully installed in your computer, type in your bash the
command "htcobol -V", you should see:
TinyCOBOL - pre alpha X.XX.X (released on 99/99/9999) (C) 1991, 1993, 1999-2002 Rildo Pragana et. al.
If it shows this message, TinyCOBOL is sucessufully installed in your
computer.
1.4. Compiling and linking a program with
TinyCOBOL.
To compile a program, type in your command line the
command "htcobol -v ./tinycobol-X.XX/test.code/t01/test01a.cob".
It must show the following commands performed by TinyCOBOL
pre-processor:
% htcobolpp.exe -v -t 8 -x test01a.cob -o test01a.i % as.exe -o test01a.o test01a.s % gcc.exe -o test01a test01a.o -lhtcobol -lm
The compilation in bash would look like this:
If it generates a file called "test01a" or
"test01a.exe", then probably the compilation was complete
with no errors. To run the program, ypu type ./test01a. This should
produce a screen, like this:
Using Mingw
TinyCOBOL Installation in Windows using Cygwin.
Download of needed packages to TinyCOBOL work,
Installing TinyCOBOL,
Setting the environment variables,
Testing the instalation,
Compiling and linkstepping a program with TinyCOBOL.
1.1. Download of needed packages to TinyCOBOL work,
To
TinyCOBOL work, you need to install the following packages:
Libdb 1.86
Getopts 1.0.3
Yacc 1.9.3
Cygwin Bash Shell to use configure scripts.
Installing needed packages:
Here is explained how to install
the binaries of needed packages:
Libdb 1.86
Get the db-1.86-1.mingw32.zip file in our homepage.
Unpack this file in c:\MINGW directory, according the following criteria:
libdb.a in c:\mingw\lib\libdb.a
db.h in c:\mingw\include\db.h
mpool.h in c:\mingw\include\mpool.h
Yacc 1.9.3
Get the yacc-1.9.3-1.mingw.zip file in our homepage
Unpack the file yacc-1.9.3-1.mingw.zip in c:\MINGW directory, according the following criteria:
yacc193.exe in c:\mingw\bin\yacc193.exe
Getopt 1.0.3
Get the getopt-1.0.3.mingw32.zip file in our homepage.
Unpack this file in c:\MINGW directory, according the following criteria:
libgetopt.a in c:\mingw\lib\libgetopt.a
getopt.h in c:\mingw\include\getopt.h
TinyCOBOL X.XX
Get the file tinycobol-X.XX.tar.gz in our homepage.
1.2. Installing TinyCOBOL.
With all libraries installed,
access a ms-dos prompt and execute the following commands:
% cd \mingw % tar -zxvf tinycobol-X.XX.tar.gz % cd tinycobol-X.XX % bash --login -i % ./configure % exit % make -f Makefile.mingw
1.3. Setting the environment variables.
set the following
paths in our autoexec.bat
TCOB_OPTIONS_PATH=c:\mingw\share\htcobol TCOB_PP_PATH=c:\mingw\bin
Restart your computer
1.4. Testing the instalation.
To
Test if TinyCOBOL is sucessufully installed in your computer, type in
your ms-dos prompt the command "htcobol -V", It should
shows a message like that:
TinyCOBOL - pre alpha X.XX.X (released on 99/99/9999) (C) 1991, 1993, 1999-2002 Rildo Pragana et. al.
If it shows this message, TinyCOBOL is sucessufully installed in your
computer.
1.5. Compiling and linking a program with
TinyCOBOL.
To compile a program, type in your command line
"htcobol -v .\tinycobol-X.XX\test.code\t01\test01a.cob". It
must show the following commands performed by TinyCOBOL
pre-processor:
% htcobolpp.exe -v -t 8 -x test01a.cob -o test01a.i % as.exe -o test01a.o test01a.s % gcc.exe -o test01a test01a.o -lhtcobol -lm
The compilation in a ms-dos prompt would be this way:
If it generates a file called "test01a.exe", then
probably the compilation was complete with no errors. To run the
program, type test01a.exe. You should be shown a screen, like this:
Packaging a application compiled with TC for a user
To package a application compiled with TC in windows enviroment for a user, you need to send the user the following packages:
cygwin1.dll (If you compile your programs using Cygwin tools)
msvcrt.dll (If you compile your programs using mingw tools, however, this file is included in C:\WINDOWS\SYSTEM).
libhtcobol.so or libhtcobol.a (TinyCOBOL run-time library)
your compiled application executable.