Ray Ontko & Co.
Services | Products | Library | Careers News | About Us | Contact Us | Search | Site Map


Author: Ray Ontko (rayo@ontko.com)
Download: sqrsh.zip

SQRSH is an SQR shell. It is an extensible, command-oriented utility designed for use by SQR programmers, and is written entirely in SQR. It contains utilities that generate program modules, make it easy to re-use procedures, and debug and beautify your programs. SQRSH is meant to make life easier for SQR programmers.

SQRSH is freely distributable as long as the original copyright notice is kept and the source code is provided. For the legal language, see COPYING.TXT.

For installation information, see README.TXT.

For version specific information and other release notes, see RELNOTE.TXT

Key features

In the sections which follow, each sqrsh command is followed by a link to its help screen (.hlp file) and its source code (.sqh file) for your perusal.

autodoc autodoc.hlp autodoc.sqh
reads a file and extracts to a new file all lines appearing between "!++" and "!--". This provides a simple mechanism to document your programs and use selected portions of the internal documentation in external documents. The help ultilty for sqrsh uses this to document sqrsh commands.
libr libr.hlp libr.sqh
reads a file which contains reusable procedures and generates a similar file in which all procedures are surrounded by an #ifdef #endif section. This allows the modified file to be used as a library in which: 1) only those procedures which are needed are included, and 2) procedures are included only once.
modhist modhist.hlp modhist.sqh
reads a program file and inserts a "Author/Modification History" section near the top of the program if one is not already present.
optimize optimize.hlp optimize.sqh
a simple optimizer which reads a program and replaces statements with ones which are more optimal. For example, replaces "LET $a = ''" with "MOVE '' to $a". At present, LET to MOVE conversions are supported. At some future time we hope to add support for things like "LET #a = #a + 1" with "ADD 1 to #a". Contributed by Peter Reeve-Newson.
pretty pretty.hlp pretty.sqh
reads a program file and produces a similar file which is pretty. At present, the module does not handle indentation of nested structures, but it does insert dividing lines between procedure declarations, begin-heading, begin-setup, and other major program sections.
profile profile.hlp profile.sqh
reads a program file and produces a similar program in which excution profiling statements have been inserted. The resulting program may then be executed to determine which statements are being executed how often during a run of a program.
trace trace.hlp trace.sqh
reads a program file and produces a simlar file in which a show statement is inserted at the beginning and end of each procedure. Each statement includes the name of the procedure, and is prefixed by "#debugt", allowing you to turn trace on or off easily.

ORACLE-only features

columns columns.hlp columns.sqh
lists all the columns in all user-owned tables which match the table and column name masks given.
connect connect.hlp connect.sqh
changes the sqrsh connection to the database. This allows you to change your current user while using sqrsh. This is similar to the SQR "CONNECT" statement.
fk fk.hlp fk.sqh
generates code which validates foreign key constraints which are disabled.
sql sql.hlp sql.sqh
allows you to execute an arbitrary sql comand. This is similar to the SQR "BEGIN-SQL" section.

Planned enhancements

reads a program and writes a similar file in which each statement is preceded by code necessary to allow step-by-step execution of the program, setting trace points, watch points, and break points.
reads a program file and produces a similar file in which "#define inc_xxx" have been inserted, where xxx is the name of a routine which is called by the program but not defined in the program. This is meant to be used with the libr program, described above. The link program "links" a program to its libraries. At present, this is done by hand, an easy but slightly tedious task.
reads a program and looks for common coding mistakes, such as variables which are used before they are assigned.

Known bugs and limitations

a few utilites (trace, profile, pretty, etc.) look for begin-procedure or other commands in a file and perform some special processing. At present, the scanner/parser is not very sophisticated, so there is a requirement that the entire statement appear on a single line in order for the utility to work correctly. This is particularly anoying when working with procedures that take a lot of parameters.


Thanks to Lori Donnelly and Eric Eastman for suggestions, comments, and bug fixes.

Special thanks to Peter Reeve-Newson for his contribution of the "optimize" module.

If you have utilities that you think others would find useful, I'd be happy to add them to sqrsh. Comments, suggestions, bug reports are always welcomed. If you use sqrsh and like it, please let me know.

Page maintainer: Ray Ontko (rayo@ontko.com)

Copyright © 1999, Ray Ontko & Co. Last updated: Tuesday, February 27, 2007
Careers Library Products Services Site Map Search Contact Us About Us News