Converting a Q&A Application to Alpha Five
You just woke up from a l-o-n-g nap and are surprised to find out that DOS is dead! But, but, you've got that wonderful database you created 8, 10, 12 years ago in that killer program from Symantec - Q&A that ran fine under DOS. What are you gonna' do? Well, let's see: you could keep running it in whatever version of Windows is presently on your system. You know, thought, that as Windows morphs into newer and newer versions there is a greater and greater possibility that this wonderful database will lose stability and you'll start having more and more problems, so you decide to 'bite the bullet' and upgrade to the new killer program called Alpha Five from Alpha Software.
by Dave Jampole
You open Alpha Five and quickly hit the first (of many) small stumbling blocks - A5 won't read your Q&A database. Hum, your knowledge of Q&A is more than the average Q&A user, so you take a look at the file extensions of the Q&A files and find that there are two different files for each database -
Here's how to convert your Q&A database into A5 with as smooth a transition as is possible.
Open Q&A and click on File, Utilities and then Export data. You will see a list of the seven different export formats that are available:
Figure 1 - Export Menu
The ones that work for Alpha 5 are either 3 - dBase III or 4 - dBase IV. When you click on either of these two options, a dialog box will open. Select the Q&A file that you want to export FROM and tap the [ENTER] key and the 'Export to:' line will appear. Designate the path and name of the TO file. If the TO file name you select already exists, you will see the following warning message:
Figure 2 - Export Warning
If you want to replace the existing file, select Yes, in not, select No and you will be back to the point at which you select the TO file name.
Once you are satisfied with the TO file name, you will be at the Retrieve Spec, where you can
Figure 3 - Retrieve Spec
specify a subset of your Q&A file to export to Alpha Five. If you want all of the records, tap [F10]. However, if you want only some of the records you can indicate a restriction and whether your restriction is inclusive or exclusive; that is, do you want to records for which your specification is true, or the records for which the specification is false. Tap [F10].
Now, you are at the Merge Spec screen, where you can specify what information from the specified records you want. If you want all the data, tap [F10]. If you only want selected data, follow the directions in the last paragraph.
Figure 4 - Merge Spec
Make sure you understand what the last paragraph is telling you. If you want the data from the third Q&A field in the fifth A5 field, tab to the third field is Q&A and type a '5'. If, by chance you misnumber the fields, you will get some strange results, but you can delete the results and go through the process again.
A word of warning is appropriate here: If the A5 file (the TO file) has a calculated field, the import will be unsuccessful. Open Alpha Five, navigate to Fields Rules, click on 'Field Types' and change all the calculated fields to 'User entered'. After the import process is completed, change the appropriate fields back to 'Calculated' and your calculation will reappear.
Okay, we've got the data - now what about forms, menus, calculations, scripts, etc, etc.? The short Readers Digest answer is that you can't import any of those items, BUT you can re-create them the old fashioned way - one keystroke at a time. Depending on how familiar you are with Q&A or how good your memory is, the following can be somewhat daunting.
Navigate to the Q&A File menu and select D - Design file, P- Program a file and specify the file (and path if necessary) in the Data file dialog that appears. The Programming Menu (Figure 5) contains the keys to the underlying 'magic' of your Q&A application.
Figure 5 - Programming Menu
Figure 6 is an example of a lookup table:
Figure 6 - Lookup Table
Rather that go into the details of how to create a lookup table, which is not the focus of this article, suffice it to say that the KEY column is what the user types and the offset determines what is value is returned. If you try to cursor into a field that is wider than the column, you will need to tap the [F6] to expand the field.
Field navigation is where you can use the good old GOTO statements that many of us are trying to purge from our heads as we get further away from the DOS programming paradigm. In addition to simple navigation statements, you can tell Q&A to execute the statement on entry by use if the < (less than) symbol and on exit by use of the > (greater than) symbol. R - Read-only fields are so designated by an 'R' (somewhat like our skip rule or setting a field as calculated). The S - Set field names option allows you to designate a field name different than what appears as the field label on the form. Now for the biggie - P - Program form!
P - Program form is where all the programming resides. When you click 'P', you'll see the underlying form with (possibly) numbers are preceded with the pound sign (#), some of the pound signs may be preceded with either a greater than (>) or less than (<) sign (as explained above). You may see calculations, lookup statements (there are two internal lookup statements, two internal lookup functions, two external lookup functions and two external lookup functions), popup user dialogs, if-then-else statements, and more. Some of the programming statements are longer than what can be displayed because the field input length is shorted than the length of the statement. If you tap [F6], the program editor box opens and you can see that one program statement in its entirety. You can tap [F2] and print that one statement, if you wish.
If you want to print all the programming statements, tap [F2] from outside the editor and you can get a nice printout ordered from the top leftmost field to the bottom rightmost field with all the statements in their entirety.
Now, [ESC] back up to the File Menu and select D - Design file (Figure 7)
Figure 7 - Design Menu
C - Customize a file brings up the Customize Menu (Figure 8)
Figure 8 - Customize Menu
F - Format values allows you to specify the data type (T (text), N (number), D (dates), H (hours), Y (yes/no), K (keyword) along with the number of decimals (number only), alignment, uppercase, lowercase and initial caps).
R - Restrict values is where you will find: upper limit, lower limit or both, acceptable specific values, greater than values, less than values, required field or requested field - analogous to Alpha's field rules.
T - Field template lets us restrict data input to numeric, alpha or text. I - Set initial values is where we specify current day's date, current time, or a unique number. S - Speed up searches is where we do what in A5 is called setting an index. Also, we can specify whether new data must be unique or must already exist.
D - Define custom help doesn't need any explanation. The last item, C - Change palette allows us select from eight different pre-designed color combinations.
All of these options will give you a leg up on the re-creation process you will experience as you duplicate your Q&A application in Alpha Five.
As far as the menus, form layouts and macros are concerned, they will also have to be recreated in A5. The menus and form layouts can be produced with a simple screen print operation, or, if you are lucky, you can open Q&A on a laptop while you duplicate them to the extent possible in A5.
Now for the scripts (Alpha terminology), or macros (Q&A terminology). By default, the macros are saved to QAMACRO.ASC but, it is common practice to use different names if a person developed multiple custom databases in Q&A. Regardless of the name, the extension is .ASC and the file can be opened in Q&A Write and then printed.
Here is a small segment from a QAMACRO.ASC file:
<begdef><alta><name>"<caps,>alta<caps.>"<vidoff><esc><esc><esc><esc><esc>rp
<capsf4>c:\qa4\qafiles\classic\inventry<enter><capsf4>PRODUCT<sp>NAME<sp>
WITH<sp>COST<enter>n<menu>"*REPORTS<sp>MENU" <enddef>
The scariest thing is that if you have worked with Q&A for any length of time, you can read the macros almost as if they were written in plain English. The example above is a tiny bit of a 22-page long printout for an application that ran for over 12 years! You gotta' love DOS, or more accurately, the memory of DOS. Klutzy, crude, not very 'cool', but it is/was solid! Oh, well.