May 1993 Newsletter
Volume 3, No. 3
Highlights of This Issue
Our newsletter is growing. This issue has the following of major articles:
Timing out Informix Processes - by Sameer Gupta
Getting column names within vi - by Lester Knutsen
Next Meeting
Our next meeting is scheduled for Wednesday, April 21, 1993 from 9:30 to 11:30 am.
Westmount USA Inc., will be presenting their CASE product ISEE the Information Systems
Engineering Environment. ISEE is an integrated CASE solution that provides:
- standards-based Upper CASE Analysis and Design tools
- customizable Lower CASE code generation (4GL, SQL, C, and C++)
- version control and configuration management
- reverse engineering
- centralized or distributed shared repository in Informix and other RDBMS
- automatic generation of documentation
Location: Informix Software, 2111 Wilson Blvd., Suite 500, Arlington, VA
Agenda: Presentation by Westmount USA Inc.
Question and answer session.
Discussion - Future Plans for the User Group
Sponsors for the Newsletter Mailing
We need sponsors for the newsletter mailings to keep operating without requiring dues. Our
current method is to get different companies to cover the cost of our mailings in exchange for
including marketing information. Advanced DataTools Corporation sponsored this and the
previous mailing. Two other companies have expressed interest in sponsoring future mailings.
As long as we can get companies to cover the cost of the newsletter we will not need to charge
membership dues. If your company would like to sponsor a mailing, or if you know of any one
who might be interested, please give me a call.
User Survey Results
The results of the survey sent out in the last newsletter have started to come in with 15
returned out of the 138 mailed. The following are the highlights of the survey:
- Everyone agreed to giving out our mailing list to companies that request it.
- Most members are programmers, DBA's and consultants.
- The preferred meeting place and time was split between Maryland and Virginia, AM
and PM. However, until we have another option for a meeting place we will continue
to meet at the Informix Office. The majority said we should meet every other month.
- Most members are interested in getting technical information, new product
information and networking.
- We were split on the question of willingness to pay membership dues.
Question and answer session
A question and answer session will be held during each meeting. The purpose of the session
is to provide members a forum in which technical questions can be answered by members, as
well as Informix staff. Past sessions have proven very informative, even to experienced
Informix users. Some of the past questions have related to keyword usage, termcap/terminfo,
and others. It is requested that questions be submitted in advance to give the steering
committee a little time to prepare answers. However, questions on the fly may still be
presented and discussed among meeting attendees. Please use the Question and Answer
Session Form at the end of the newsletter for submitting your questions.
Informix User Group Membership
If you would like to be included on the Informix User Group mailing list, please provide the
contact information on the attached Question and Answer Session Form, and mail or fax it to
the address indicated on the form. Currently their are no membership fees. The group meets
every other month and the newsletter comes out about six times a year.
Last Meeting - SuperNOVA by Four Seasons Software
Four Seasons Software presented SuperNOVA, an objected oriented database independent,
distributed processing 4GL application development tool. The following is an article from
Four Seasons describing their product for everyone who missed it.
4GLs - Insurance For Your Applications
By Ross S. Altman, Director of Marketing
Four Seasons Software
Copyright 1993
It's a world of change. Users' requirements change as the needs of the organization shift.
Operating platforms evolve, with proprietary software giving way to more open systems.
Networks grow and become more complex as terminal/host configurations are replaced with
PC and workstation-based LANs and WANs. Database software comes and goes as fashion
and function dictate a migration from ISAM files to relational and object-oriented databases.
And, application models shift from standalone processing to various models of client/server
computing.
In this world of constant change, there are risks that must be addressed as you build new
applications. What happens if the network changes? What do we do if we have to move the
client side of the application from Windows to UNIX? What happens if we need to integrate
data from other databases?
With the cost of building new applications, you need to protect your investment in these new
systems. You can't afford to build an application that will be difficult to update as the users'
requirements change. You can't afford to build an application that is tied to a single database
or operating system. And, you can't afford to build an application that can only operate in
one client/server mode.
What you need is an insurance policy against application obsolescence. In other words,
you need insurance against the need - down the road - for a massive re-write of your
application.
If you select the proper one, a 4GL can provide you with that type of insurance. By writing
your application in a fourth generation language, application obsolescence can become a thing
of the past.
First, using a 4GL makes it easy to update your application as the users' requirements evolve.
4GL applications are made up of a series of objects that are linked together. This means that
the application is essentially self-documenting and there are fewer lines of code. As a result,
the application is easier to understand and easier to change.
The second way that a 4GL can insure you against application obsolescence is by enabling
the development of a database independent and platform independent system. With the
right 4GL, you can build the application once and run in under DOS, Windows, UNIX,
MOTIF, and Open Look without making any changes to your program.
And, you can run the same application against a long list of supported databases. So, if
necessary, you can move the backend of your application between Oracle, Ingres, Informix,
Allbase, and Sybase (to name a few) without going through the pain of re-writing big chunks
of your system.
This database independence also can also provide you with additional benefits. With the
right 4GL, it is possible to build an application that does not depend on the network software
provided by the database vendor to support client/server processing. This helps you in a
number of ways.
First, you can use the capability to access data that is on two or more databases. These
databases don't have to be from the same vendor; one database can be on a UNIX server while
another database can be on a mainframe.
This independence from the database vendor's network software also allows you to
dynamically distribute your application functions throughout the network. The processing
that you place on the server aren't limited to those functions that can be written in the stored
procedure/trigger language of your database. You don't even have to learn how to use a
different language to implement the functions that will not run on the client. Just write the
application once and then you can move each application component around on the network
at will.
Or, you can write an application that sends some functions off to a separate, application server
on the network. This lets you place parts of the application on the client, other parts on the
database server, and - for computationally intensive tasks - functions can also run on an
application server.
In the end, we'll all need tools that can provide us with insurance against application
obsolescence. Developers simply can't afford to be limited to a single application infrastructure
anymore. And, they can't afford the time and resources required to write low level code,
either. They need to be able to describe an application in very high level terms and their
development tools must take these high level specifications and translate them into applications
that run efficiently on multiple platforms and against multiple databases.
In selecting a 4GL, these capabilities provide you with application insurance - a good thing to
keep in mind as you build your new systems.
By Sameer Gupta
One of the problems that a DBA usually faces in an Online Environment is when users leave
a process running and take a coffee break or worse leave for the day. The problem is more
severe when the process is locking some resources. In such a situation, it will be nice to have
the process 'time out' after a specified interval.
This can be accomplished by finding the PID and forking a process which sends an interrupt
signal to the parent process (the Informix 4GL code) after sleeping for a specified time period.
On sensing this interrupt, the 4GL code behaves as if the interrupt is coming from the
keyboard. The 4GL code can then be made to take suitable action.
C code for finding the PID
The following C function returns the PID of the process which calls it. This C function can be
linked with the Informix 4GL code.
#include <sys/types.h>
#include <sys/errno.h>
ugetpid(nargs)
int nargs;
{
int upid;
upid = getpid();
retint(upid);
return(1);
}
Shell Script for sending a Delayed Interrupt
The following shell script sends an interrupt signal to the PID after a specified interval of time.
sleep 300
kill -2 $1 2> /dev/null
Informix 4GL Code to Activate the Delayed Interrupt
The following code fetches the process id and runs the shell script.
DEFINE ucommand CHAR(20)
DEFINE upid INTEGER
CALL ugetpid() RETURNING upid
LET ucommand = "dkill ", upid
RUN ucommand WITHOUT WAITING
Informix 4GL Code to trap the interrupt
The following Informix 4GL code traps the interrupt and takes the
necessary action. It can be included in a INPUT, INPUT ARRAY,
DISPLAY ARRAY, MENU statements.
ON KEY (INTERRUPT)
LET flg_timeout = 'Y'
MESSAGE "TIME OUT"
EXIT MENU
After the variable "flg_timeout" is set, code can be written to EXIT from the program in a
'decent' manner.
Any queries may be directed to
Sameer Gupta, Consultant
Tata Consultancy Services
c/o Sheet Metal Workers' International Association
1750 New York Avenue N.W.
Washington, D.C. 20006
Phone : (202) 662-0808
By Lester B. Knutsen
How often have you tired of retyping the same column names repeatedly in vi? One solution
is to save the column names in a file and read them in as needed. However, vi has the
capability to insert into a document the results of an operating system command. With a little
work with shell scripts and awk, you can create a command that will get the column names
from any table in any database, and insert them in to your current document. And with a little
more work, you can add formatting like commas, datatypes or the 4GL format of
"variablename like tablename.columnname".
To insert the results of a Unix command on the current line in vi use "!!command". For
example, start vi and type "!!ls". This inserts, the names of the files in the current director into
your document. To run the Informix SQL info command for the item table in the stores
database, and insert the results in the current document, you would do the following:
1. Create an SQL script called itemsinfo.sql with one line as
follows:
info columns for items;
2. Load vi and type the following:
!!isql stores itemsinfo
3. This runs the sql script and inserts the results in the current
document.
The following shell script is one I have created to get the column names from a database for
SQL, ESQL/C, and 4GL programs. As long as the script getcol is in my path, I can get
columns names from any table. Type in the script, put it in your path and within vi type
"!!getcol databasename tablename". I use awk to format the output so it's more useful. The
script can also be run from Unix command line and the output will display on your screen.
#############################################################################
# PROGRAM: getcol - this is a shell/awk script to get the columns from
# an Informix database in a format ready to use in a sql
# query, a 4gl program etc...
# In vi, put the cursor on a blank line where you want to
# insert the columns and type !!getcol database tablename. The
# columns will be inserted into the current file.
#
# USAGE: getcol database table [-d\-l]
# -d displays column data type
# -l displays as column like table.column
# The default displays column names only
#
# AUTHOR: Lester B. Knutsen
# Advanced DataTools Corporation
# 4510 Maxfield Drive, Annandale, VA 22003, 703-256-0267
# Copyright (c) 1993, Advanced DataTools Corporation, All rights reserved.
#############################################################################
# function to display usage error message and exit
usage() {
echo "usage: $1 database table [-d|-l]"
echo "\t-d: column data type\n\t-l: column like table.column" ; exit 1
}
#############################################################################
# test for correct number of arguments - call usage function if incorrect
[ $# -lt 2 ] || [ $# -gt 3 ] && { usage $0
}
# test for valid third argument ( -l or -d ) - call usage function if
incorrect
case $3 in
-d|-l|"") ;;
*) usage $0 ;;
esac
#############################################################################
# use the info columns command to get the data from informix and pipe to awk
# everything within the { } is excuted and piped to awk
{ echo $3 $2; isql $1 - <<EOF
info columns for $2;
EOF
} | awk '
#############################################################################
# The awk commands to format the data start within the two ''
# set variables
BEGIN { opt = " "; tab = " " ; outcnt = 0 }
# First Line (NR=1) check options from echo $3 $2 statement piped to awk
NR==1 && $1 == "-l" { opt = $1; tab = $2; getline }
NR==1 && $1 == "-d" { opt = $1; getline }
# check lines after first line and format based on options
NR >1 && $1 > "" && $1 != "Column" && $1 != "Error" && $1 != "Near" {
# add the comma and a newline to the end of the last line
if ( outcnt >= 1 ) printf(",\n")
# option -d print column and data type
if ( opt == "-d" ) printf("%-18s\t%s",$1 , $2)
# option -l print column like table.column
else if ( opt == "-l" ) printf("%-18s\tlike %s.%s",$1 , tab, $1 )
# no option print column name only
else printf("%s",$1)
outcnt++
}
# print a newline at the end
END { print "\n" } '
#############################################################################
This Newsletter is published by the Washington Area Informix Users Group.
Lester Knutsen, President/Editor
Washington Area Informix Users Group
4216 Evergreen Lane, Suite 136, Annandale, VA 22003
Phone: 703-256-0267
lester@access.digex.net
|