Configuring a Legacy Application

In this case, the term "legacy application" refers to a software development project first created without use of the BASIS IDE, which does not follow the recommended practices outlined in the preceding sections. The project may use dozens of different file extensions, applied to both source and tokenized files at the same time, or it may contain files with no extension at all. There may never have been any need to distinguish between source text and tokenized versions of the files, and text versions may never have been stored at all.

It would be difficult or extremely impractical to impose a set of new and arbitrary standards on such a project. If the names of the tokenized files were changed (given new standard extensions), every CALL statement in the entire application would have to be changed to match them. The tokenized files already expect to find their resources in specific places, so shuffling file locations to match a new, more logical tree structure would mean a lot of additional code revision.

Given these challenges, follow the guidelines below to prepare a legacy application for compiling in the IDE:

1. Register all file extensions as BBj Object Types. Collect all extensions used in the project and register them in the Options dialog under IDE Configuration ->System ->Object Types ->BBj Files. Note that this does not include extensions for files used by DDBuilder, ResBuilder or GUIBuilder. These extensions are already registered by their respective modules and do not belong to the BBj module. By default, the extensions .bbj, .bbx and .src are already registered. Files that have no extension will also be treated as Business BASIC files by default. All other extensions used in the project must be manually added, as shown in the figure below.


After registering all of the extensions, the IDE considers these files Business BASIC file types. All of the IDE's Business BASIC development components can now manipulate them.

2. Create source versions of all the tokenized files. If text versions of the Business BASIC files do not already exist, then create them. This is the single most important step in configuring a development project. To create text versions of the tokenized files, load the tokenized files into the IDE Source Editor and then save them one at a time as text, or use the lister utility from the command line, or create them in a batch script.

3. Append a standard file extension to the names of all the source text files. Do not remove the existing extensions, just append the new extension to source text files.



In the Explorer image above, find the ASCII versions of the BASIS standard utilities in a mounted directory called BBj Test Source. These files use .utl, .pub and .dat file extensions, or no extension at all. Appending the .src extension to each file changes _AMORT into _AMORT.SRC, _CATPGM.UTL into _CATPGM.UTL.SRC, etc.


4.Compile the source to strip off the last file extension. In this example, configure the compiler options so that the names of the tokenized files will not have the .src extension. The figure below shows the results of compiling to a mounted directory called BBj Test Tokenized.


Because the tokenized files use a variety of extensions, an output extension was not specified. The Strip Output File Extension option was set to 'true' to remove .src extension.

To accomplish the same result, leave both the Output File Extension and Output Directory options blank. Tokenized files will be created in the same directory as the source, but without the .src extension. Either way of compiling produces tokenized files with their original name intact, so that none of the CALL statements in the code requires a change.

The default behavior of BBjCpl, pro5cpl and bbx4cpl has always been to give a tokenized file the exact same name as the source file if an output directory was specified by the –d parameter (and no file extension was requested with the –x parameter for BBjCpl and pro5cpl). The new Strip Output File Extension option of the IDE compiler changes that behavior when set to 'true'. When set to 'false', the tokenized files receive the same names as the source files.

Why bother adding the .src extension to all the source files? Why not simply compile to a different output directory and let the source and tokenized files keep the same names? This is also a perfectly workable solution. Careful developers will not have trouble with this method. The IDE will still show the correct icons for the two file types, because the compiling system can distinguish between them. However, BASIS does not recommend this practice because there is an increased potential for confusion. It is always safer to have the type of file reflected in its name. If using a Version Control System, the repository of source files could become corrupted if a tokenized file were accidentally swapped with its corresponding text file.