November 4, 2001
===================================================================
>From the Edge: Converting DOS EEPs to Windows (Part I)
Section: Upgrading from DOS to Windows 6.5++
Platform: R:BASE 2000 (ver 6.5++) for Windows
Build: 1.842xRT03 and Higher ...
===================================================================
When moving an application from DOS to Windows, you may need
to make changes to Entry/Exit Procedures (EEPs) used in your
applications. Many EEPs use techniques designed to be fully
compatible with the DOS operating system and these techniques
need to be modified for use in Windows.
With a few specific examples for reference, you should be able
to quickly and easily convert EEPS from your DOS applications
to the latest R:BASE 2000 (ver 6.5++) for Windows applications.
By looking at some EEP examples that are commonly used in
applications, you can make note of the necessary changes and
apply them to the EEPs in your applications.
This section "Converting DOS EEPs to Windows (Part I)" shows
how to convert the WRITE command to display data from DOS EEP
to Windows:
Many DOS EEPs calculated values and then displayed the value
on the form using the WRITE command. This technique works in
DOS because there is only one screen on which to display data;
everything displays in the same window. In Windows, there are
many windows or screens used for displaying data�the form in
one window and the R> prompt is in another. The WRITE command
displays to the R> prompt window, not to the form window.
The WRITE command in an EEP is usually used in conjunction
with the SCREEN RESTORE commands. One way this technique is
used in DOS is to calculate and display a total for the rows
in a region.
For example, you might have the following EEP on exit from a
field in the region:
-- SUM.EEP (for DOS version)
SAVEROW
SELECT (SUM(ExtPrice)) INTO vTotPrice INDIC IvTotPrice +
FROM TransDetail WHERE TransID = .vTransID
WRITE .vTotPrice AT 22,62 WHITE ON RED
SCREEN RESTORE OFF
RETURN
The EEP saves the current row, calculates the total into the
variable vTotPrice, then uses the WRITE and SCREEN RESTORE
commands to display the variable on the form screen. You use
this technique in DOS, because you can't locate a variable
associated with the region and place it outside the region
boundary. You can do this in the Windows version of R:BASE.
In Windows, the EEP becomes:
--SUM.EEP (for Windows version)
SAVEROW
SELECT (SUM(ExtPrice)) INTO vTotPrice INDIC IvTotPrice +
FROM TransDetail WHERE TransID = .vTransID
RECALC VARIABLES
RETURN
The variable vTotPrice is placed on the form (associated
with the region table) where you want the total to display.
The RECALC VARIABLES command displays the current variable
value when you return from the EEP to the form. The only
change needed to the EEP code was to replace the WRITE and
SCREEN RESTORE commands with RECALC VARIABLES. Then the
variable is located on the form.
In general, follow these steps to convert an EEP from DOS
to Windows that uses a WRITE command to display data back
to the form:
01. Remove the WRITE and SCREEN RESTORE commands from the EEP.
02. Add the command RECALC VARIABLES to your EEP.
This recalculates all the located variable objects on the
form and displays the variable values calculated in your
EEP.
03. Place the variables used in the EEP on the form.
04. Locate the variables directly on the form, you do not
need to define form expressions.
05. Always pre-define global variables used in form with
appropriate Data Type.
In addition, the WRITE command has been enhanced to allow
you to display short messages on the status bar. Some WRITE
commands used for displaying messages to the screen can be
modified to display on the status bar instead. Just add
AT BAR to the WRITE command.
===================================-============================
R:BASE Developers's Conference: http://www.rbase.com/conference
Official R:BASE List Server: mailto:[EMAIL PROTECTED]
RBTI Events/Training: http://www.rbase2000.com/events
R:DCC Members: http://www.rbase2000.com/rdcc
================================================================
R:BASE, Oterro & R:Tango are registered trademarks of RBTI.
==================================-=============================