|
Release 4 Technical Tips
Below are some technical tips for Release 4 that you may
find useful. A new tip will be posted at least once a month. If you have a
technical tip you would like to see included here, please
email
us!
To
determine that a secondary index is being used with a
jQL statement,
trace output will be produced by setting the following environment variables
prior to running the jQL statement:
JDIAG=TRACE=INDEX
JQL_TRACE_DEBUG=1
A recent
addition to the jBC SYSTEM() function on Release 4 is
SYSTEM(1035).
This function returns the type of license currently in force for this particular
user session.
The
possible license types returned by this function are:
1 =
Enterprise
13 = Server
In jBASE 4, the Keyboard
Independence subroutines
CommandInit and
CommandNext have been renamed to
JBASECommandInit and
JBASECommandNext respectively.
jBASE has
gone to great lengths to make Release 4's functionality unified on all
platforms, which means functionality that only existed on UNIX platforms now
works on Windows. This makes porting your jBASE application to different
operating systems nearly painless. The most advantageous of these are
background processing and record locking (jRLA).
Background processing
provides the complete set of PH-* (and Z{H})
commands. Note that there is no longer a jBTP daemon
to start up.
The big
payoff with jRLA is that locks can be taken on
directory files. Plus, jRLA makes it easy to see
what is going on because it updates an internal hashed table managed by jBASE.
Because locks are hashed into groups, jRLA locks are
faster than OS locks and performance will not degrade when there are a large
number of locks.
The
functionality provided by
JBASE_WARNLEVEL
on 3.x has been
implemented in a different fashion on Release 4. This was a design decision to
make the behavior of the runtime more flexible and consistent at the same time.
Instead of a global setting handling all conditions, there are now settings for
individual error messages according to a bit mask.
For
example, we are all familiar with the well-known error message: Non-numeric
value -- ZERO USED. If you set (or export) JBASE_ERRMSG_NON_NUMERIC=3, you will
not get this error message and the program will not drop into the debugger.
The other
handy environment variable, to handle the condition where a BASIC program
encounters an unassigned variable, is
JBASE_ERRMSG_ZERO_USED.
The bit
masks available for these environment variables are as follows:
1
- Don't print the error message
2 - Don't enter the debugger
16 - Caller to place "0" in the target variable after operation
32 - Caller to place "" in the target variable after operation
128 - Caller to leave target variable alone after operation
256 - Caller to place source variable in the target variable after operation
jBASE Release 4.1
introduced COL.HDG, CNV and FMT to allow for
complete
command line dictionary manipulation.
From this... LIST CUST *A1
*A4
CUST.......... *A1........... *A4...........
1 JOHN SMITH 8135551212
2 BOB LEMMON 8135551212
To this...
LIST CUST *A1 COL.HDG "Customer Name" CNV "MCT" FMT "L#25"
*A4 COL.HDG "Phone Number" CNV "ML###-###-####" FMT "L#12"
CUST.......... Customer Name Phone Number
1 John Smith 813-555-1212
2 Bob Lemmon 813-555-1212
Often when
working on jQL reports you may want to work with a smaller portion of the data
to test the layout, breaks and totals. jBASE provides for
"sampling"
the data
in two different forms.
Sample a
known number of items (in this case 100)
SORT
CUSTOMER BY NAME BY CITY NAME ADDR1 ADDR2 CSZ SAMPLE 100
Sample the
data taking every nth item (in this case 1 of every 100)
SORT
INVOICE WITH DATE >= "01/01/04" BY CUST BY DATE BREAK-ON CUST DATE TOTAL INV.AMT
SAMPLED 100
Not all Unix/Linux users
realize that jBASE commands can be used without the actual need to "login" to
jBASE. This can be accomplished with a
"minimum environment".
With this simple process you can use any jBASE command from any user environment
with permissions to access jBASE. (This could also be included in the
etc/profile)
vi /usr/local/bin/j4
JBCRELEASEDIR=/opt/jbase4/4.1 ; JBCGLOBALDIR=/opt/jbase4/4.1
export JBCRELEASEDIR JBCGLOBALDIR
LD_LIBRARY_PATH=$JBCRELEASEDIR/lib:/usr/ccs/lib:/usr/lib
LIBPATH=$JBCRELEASEDIR/lib:/usr/ccs/lib:/usr/lib
SHLIB_PATH=$JBCRELEASEDIR/lib:${SHLIB_PATH:-/usr/lib:/lib}
export LD_LIBRARY_PATH LIBPATH SHLIB_PATH
PATH=/opt/jbase4/4.1/bin:$PATH
$*
"j4 JED /etc hosts" allows you to use the jBASE JED editor to maintain the Unix
file /etc/hosts.
One of the greatest
aspects of the jBASE database is the
jQL
(reporting)
flexibility for those
coming from other MultiValue databases. jBASE supports legacy PICK A type
dictionaries complete with F and A correlatives and also supports simultaneously
the newer D type dictionaries and I - correlatives. What many do not know is:
We auto
display fields for LIST/SORT if sequential numeric DICTS exist (1-nnn)
We support
PH DICTS where a DICT called DEMOGS has field 1 = PH , 2 = NAME ADDRESS PHONE
would display NAME ADDRESS and PHONE by doing a LIST CUSTOMER DEMOGS
A combo
where DICT named 1 has field 1 = PH and 2 = NAME etc. and then LIST CUSTOMER
would use the PHrase NAME ADDRESS PHONE and display those fields.
jBASE allows
different
types of forms to be attached to a printer.
These types are controlled by the SP-TYPE command. The SP-TYPE command instructs
jBASE to read the jspform_"TYPE" file from the config directory and apply the
attributes included in that file to all print jobs for printers using that
TYPE. The config item jspform_deflt is used if no other TYPE is defined. Look
at the $JBCRELEASEDIR/config/jspform_deflt item to see the many options you can
set including WIDTH, DEPTH, STARTJOB, ENDJOB and others. Copy the jspform_deflt
to jspform_TYPE where TYPE is whatever you want to define and change the
settings for that form type.
In jBASE Release 4, you can create a
datalevel file called OBJECT for your BP files and
the $ items will then be put there instead of in the actual BP file. This makes
it much nicer to LIST the BP files since the $ item which contains non-printable
characters will no longer exist in the BP data file. Simply "CREATE-FILE DATA
bpfilename,OBJECT
modulo"
and all subseqent BASIC bpfilename
will place the $ items in
bpfilename,OBJECT.
In Release 4 of jBASE, the ability
exists to create a data-section only file
without having to create the dictionary, nor is the
dictionary required to exist prior to creating the file.
One of the goals of Release 4 is to
unify the functionality between Unix type systems and
Windows. For example, Windows now supports jRLA,
which means you can now READU lock files in directories. Another example is
background processing. No longer do you need to run the 'jstart' command;
Windows now supports all of the background commands that were previously only
available on Unix, like PH-START, PH-STATUS, and Z.
|