PreviousPublishing Applications Using COBSQL with Database ApplicationsNext

Chapter 5: Importing UNIX Applications into Net Express

If you want to use Net Express to edit an application that you have already developed, and that resides on a UNIX system, you have to import the application into Net Express. You only have to do this once, and once the application is on the PC, you can maintain it using Net Express.

Most complex UNIX applications consist of multiple application modules. An application module can be considered as a group of programs that are a distinct part of an application. For example, an accounting application might consist of several modules - Purchase Ledger, General Ledger, Sales Ledger, and so on. Each application module might consist of many programs. Each module (like Purchase Ledger) has its own directory structure, where it is maintained and managed. Typically, there are separate directories for application source code, copy libraries, data files and execution files (often with separate directories for intermediate, generated and executable code). When you import an application, you can specify multiple source directories, and specify that they are copied to multiple target directories.

Before importing an application, you need to be aware that Net Express assumes that each project resides in one directory and, while it does support source code in multiple directories, it is not the prefered way of working. Because Net Express builds all modules of a project in the same directory, there are certain limitations to how you locate the files in your application; for example, you cannot have the same source filename in different directories. When you want to import an application from UNIX, we recommend that you try to minimize the number of source directories as much as possible and/or create seperate Net Express projects for each module in your application.

The Unix Option Import Wizard helps you to import a UNIX application into Net Express, however, it is likely that you will need to make manual changes to the project before you can successfully use Net Express to develop and maintain the application module.

Invoke the Import Wizard by clicking UNIX, Import.

Note: Before you start the Import Wizard, you should ensure that all of your project source code is available on a network share via Samba so that it can be accessed from the PC. Please see the appendix Installing SCP and Samba for details of installing and configuring Samba.

The Import Wizard leads you through the following steps:

Step 1 - Project Defaults

Name the Net Express project and the project directory. The project directory is particularly important to Net Express; this is where Net Express assumes that the source code is, and where the application is built.

Step 2 - Source Directories

Enter all of the directories on the UNIX system that contain source code for your project. You should include all copyfile directories.

You cannot add files (in step 4) if they do not exist in one of these directories.

Step 3 - Target Directories

For each of the source directories you've entered you can specify where any files in that directory should be copied. The default is the project directory. You should keep the project directory as the value for the target directories, and only change it if necessary.

Step 4 - Source File Specification

Enter all of the source files that make up your project. You can only enter files that reside in one of the source directories specified in step 2.

The Scan for Copyfiles button causes the Import Wizard to examine all of the files entered to see if they contain COPY statements, and if they do, to attempt to locate any copyfiles referenced. Only the source directories specified in step 2 are scanned for the copyfiles. All copyfiles found are added to the source file list. If any copyfiles referenced by a COPY statement cannot be found, a list of these files is displayed.

Note: The scan for copyfiles only locates literal copyfile references; for example, COPY "filename.cpy"

The File Type column specifies whether the file is text (the default) or binary. Text files are a valid target for the Import Conversion operations that will be specified in step 5. Binary files are copied from the source to the target without any changes.

Step 5 - Import Conversions

For source files that are defined as type Text in step 4, you can have these files processed by the Import wizard.

The search/replace patterns specified here are the same as those described in the Setting Search/Replace Patterns. For details of regular expressions, please see the appendix Regular Expressions.

Check Convert UNIX Text file to PC to convert the UNIX-style line terminators in tect files to PC-style line terminators.

Check the Convert text files from EUC to SJIS checkbox convert text files in the Japanese EUC character set encoding (as used on some UNIX systems) to the Japanese SJIS character set used on PCs.

Note: Some UNIX systems also use SJIS character encoding. If you're importing a Japanese language project, make sure you know what character set it is encoded with.

Step 6 - Miscellaneous Project Settings

If you have any directives files on UNIX, the checker settings from these can be automatically added to the Net Express project. Both cobol.dir and cobopt files are supported.

Note: Only the checker options from the cobopt file are imported. Any other options are ignored.

Check Create Default Targets to specify that the Import Wizard should add the source files to the project and create a default target for each COBOL file. If you uncheck this control, the source files are copied to the project but no targets created.

Step 7 - Confirm

Click Finish and the specified source files are copied and converted and the project created.

The Import Wizard automatically adds the INTLEVEL"2" and WARNINGS"2" directives to your project settings. In addition, if you checked EUC to SJIS conversion at step 5, the FLAGEUC directive is also added to the project settings.

5.1 COBOL Copyfiles

If you have specified that source files are imported into multiple source directories on the PC, you might need to set the COBCPY environment variable so that Net Express can locate the copyfiles. You can set the COBCPY environment variable in Project Properties in the Net Express IDE.

5.2 COBOL Data Files

If you have COBOL data files in directories other than the Net Express Project directory, you can use external filename mapping to locate your data files during execution. External filename mapping provides a flexible method of mapping the assigned filename used within your COBOL program to a physical filename, by enabling filename mapping to be resolved within a text file (the mapper file). Filename mappings can subsequently be altered by editing the file. For example, a mapper file could contain the entries:

apfile c:\tmp\unixapp\ap\data\apfile
arfile c:\tmp\unixapp\ar\data\arfile

To use the External file Mapper you need to compile your project with the directive ASSIGN"EXTERNAL" and set the run-time tunable environment_mapper to TRUE. For every project you use, the mapping file must be in the main project directory.

For more details on external filename mapping, see the chapter Filenames in the File Handling (FHpubb03.htm) book.

5.3 Executing Programs in Other Projects

If your project makes calls to programs outside the current project, add the location of the called programs to the COBDIR environment variable. If the program has absolute pathnames you can remove the path to the program completely, and add the path to the COBDIR environment variable. A more flexible approach would be to replace the path with an environment variable and set the environment variable before Net Express is invoked.

Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousPublishing Applications Using COBSQL with Database ApplicationsNext