Consultor Eletrônico



Kbase 8706: A tutorial guide to running an hli demo (UNIX-based example)
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
A tutorial guide to running an hli demo (UNIX-based example)

900625-sal01

INTRODUCTION: Date Last Modified: 8/24/90
=============

This Technical Support Knowledgebase entry can be used as a guide to
creating a PROGRESS Host Language Interface (HLI) executable from the
PROGRESS demonstration database (demo.db). The example is for UNIX-
based systems and is relevant to PROGRESS version 6 and later.


WHY YOU NEED TO DO THIS:
========================

To test how the HLI process works and to build an HLI executable
using the PROGRESS probuild utility.


PROCEDURAL APPROACH:
====================

By following the steps below, you can create an HLI executable:


1. Make a working directory called hlitest and move to it.

UNIX: mkdir hlitest (creates the directory)

cd hlitest (moves to the directory)


2. Set up the environment variables that are needed run HLI.

UNIX:

DLC=/usr/dlc; export DLC
DLCDB=/usr/dlc4gl; export DLCDB
PROCFG=/usr/dev/full.cfg; export PROCFG
PROEXE=/usr/dlc4gl/_progres; export PROEXE
PROMSGS=/usr/dlc/promsgs; export PROMSGS
PROLOAD=/usr/dlcload; export PROLOAD
PROSRV=/usr/dlc4gl/_mprosrv; export PROSRV
PATH=.:$PROCFG:$DLC:$DLCDB:$PATH
TERM=wy60; export TERM
PROTERMCAP=/usr/dlc/protermcap; export PROTERMCAP


Be sure to adjust these variables to point to where you installed
PROGRESS. Also set the TERM variable equal to the terminal type
you are using.


3. In order to run HLI you also need set up the environment variables
that are specific to HLI. A script called buildenv in the
/usr/dlcload/eucapp directory will set the variables. Copy buildenv
into your working directory and execute it.


UNIX: cp /usr/dlcload/eucapp/buildenv . (copy to your working dir)

. buildenv (execute script)


4. At this point, copy the files that you want compile with the HLI
executable. There are three types of programs that can be used
with HLI, they are: C, Cobol, and Pascal. Check to make sure that
your release supports the language you are trying to test. Each
language has it's own directory in $PROHLI (use the SET command to
see which directory $PROHLI is pointing to). Under this directory,
there are test programs for each language that can be used to run
with the demo database. These are kept in subdirectories that are
named: hlic for C, hlipas for Pascal, hlicob for Cobol). You want
to copy the programs from one of these directories to create the
HLI executable. The following example shows how to copy the C
programs from the hlic subdirectory to your working directory:


UNIX: cp $PROHLI/hlic/*.cc .


5. Next we want to create a demo database for testing.


UNIX: prodb hlidemo demo


6. The "C" or (Cobol,or Pascal) programs you are using must be
preprocessed. The "sqlcpp" script in $PROLOAD/uce runs the
preprocessor routine that converts the embedded SQL statements
into calls to the HLI functions. There are two modes of running
the preprocessor, precompile and non-precompile. For testing, use
the precompile mode.


UNIX: sqlcpp hlidemo.cc -a hlidemo


7. After preprocessing, the code is ready to be compiled with the
compiler. This example uses the "C" routines.


UNIX: cc -c -I$PROLOAD/uce/hlic hlidemo.c


Here, the -c parameter suppresses linking. Only the objects are
created. The -I option specifies a directory for the compiler to
search for include files.


8. In version 6 the executable must be created using the PROGRESS
probuild utility. By following the steps below you can create an HLI
executable that will run the demo routines with the code that
has been compiled in the previous steps. Before running PROBUILD
be sure that $PROLOAD and $PROLOAD/eucapp are set in your PATH.

1. Execute probuild.

UNIX: probuild


2. You will see the PROGRESS banner then EUC Interface


3. When prompted for directory, enter your current working
directory.


4. At the Selection Menu:
Select Full CHLI <RETURN>


5. When prompted for link script and executable name:
Use the defaults for scripts and change executable name to:
hlidemo.

The link script is what will be created and run to create the
executable, the name of the executable used in the link
script.


6. Configurable Elements - Set up depends on system.
Choose that features you want built into your executable.


7. Enter objects:
Enter all the object code that should be included in the
executable. In demo, if defaults were used then (hlidemo.o)
should be the only entry.


8. You will see a processing message and a message when it ends.


9. When prompted if you want to quit - enter YES.


10. Probuild has just created the script that must be executed to
create the executable with the image name that was selected.
Therefore, the script must be executed next. Some machines
may require that the user be root to create an executable.


UNIX: . ldchli (or name of script created by probuild)


11. After successful completion of the script you have a new
Progress executable that can be run with the sample test
programs.


UNIX: hlidemo -db hlidemo -1


12. Running the new PROGRESS executable hlidemo should run a demo
routine with the output listed below. If this is true, you
have successfully built a new HLI Progress executable.


Check the output - it should look like this:


-------------------------------------------------------------------
Logging into the Progress Host Language Interface
Deleting Customers with Cust-num less than 007 and greater than 004

Cust-num Name City State Max-Credit
001 Second skin scuba Yuma AZ +001500
002 +001970
003 +00685
004 +00416
005 +001708
** Customer 005 deleted
006
** Customer 006 deleted

Increasing Max Credit by 150 for remaining customers.
Here is evidence of the increased max credits.
Cust-num Name City State Max-Credit
1 Second Skin Scuba Yuma AZ +001650
2 +002120
3 +00835
4 +00566

Rolling back all work...

_____________________________________________________________________


ONLINE PROCEDURES OR UTILITIES:
===============================

PROGRESS probuild utility

PROGRESS Embedded SQL


REFERENCES TO WRITTEN DOCUMENTATION:
====================================

3GL Interface Manual (PROGRESS version 6) - Chapters listed below:

Chapter 1 - Building a Progress Executable

Chapter 8 - Introduction to HLI

Chapter 9 - Embedded SQL

Chapters 10 - 15 - Running HLI with the Three
Languages (C, Cobol, Pascal)

Progress Software Technical Support Note # 8706