SQL/MX Programming Manual for Java

Program and Module Management
HP NonStop SQL/MX Programming Manual for Java523726-003
6-17
Versioning
3. The SQL/MX compiler produces modules with unique table-set names:
/usr/tandem/sqlmx/USERMODULES/CAT.SCH.^MYPROGCTX1^TS1^
/usr/tandem/sqlmx/USERMODULES/CAT.SCH.^MYPROGCTX2^TS1^
To build another application from the same SQLJ source file that targets a different set
of database objects:
1. Use the OSS add_define command to set up the class MAP DEFINEs for a
different set of tables. For example:
add_define =employee class=MAP file=\$SAMDB.PTPERSNL.EMPLOYEE
2. Run the SQLJ translator program and specify the -moduleTableSet option on
the command line:
java sqlj.tools.Sqlj -d=mybin2 -dir=myjava2
-moduleTableSet=TS2 MyProg.sqlj
3. The SQL/MX compiler produces modules with unique table-set names:
/usr/tandem/sqlmx/USERMODULES/CAT.SCH.^MYPROGCTX1^TS2^
/usr/tandem/sqlmx/USERMODULES/CAT.SCH.^MYPROGCTX2^TS2^
After building applications to target different sets of database objects, you can execute
any of the SQLJ programs in any order. Before running the SQLJ program, remember
to reset the DEFINEs to the correct set of tables.
Versioning
By using the version attribute for module management, you can create and use
multiple versions of an application from a single SQLJ source file without changing the
MODULE directive or the catalog or schema. In the SQLJ source file, you would
change the source code according to the new version but keep the same MODULE
directive. Versioning and targeting differ in that versioning typically requires you to
make minor changes to the source code of the application.
The version attribute is necessary if you want two or more versions of the application
(and its module files) to coexist on the same NonStop system. Without the version
attribute, each build of the application writes an identically named module in the
/usr/tandem/sqlmx/USERMODULES directory, unless you change the MODULE
directive in the source code. The version attribute prevents a subsequently built
application from overwriting the module file of the previously built application.
Note. During translation, specify unique directories for each targeted application by using
the -d and -dir options. These options ensure that the program files for each table set
are not overwritten by program files for the next targeted application. For more information
about these options, see Options for Output Files and Directories
on page 5-18.