How to Compile Oracle Forms Modules Using the Form Compiler

Compile forms, menus, and libraries in Oracle Forms 14.1.2, from Forms Builder shortcuts to frmcmp_batch parameters, errors, and exit codes.

A design file such as an .fmb holds everything about a module, including the source of its PL/SQL. Before users can run it, the Form Compiler has to turn it into a runnable file that holds what the Forms runtime needs: the objects, their properties, and the compiled code.

This guide shows how to compile Oracle Forms 14.1.2 modules in Forms Builder and from the command line with frmcmp_batch, how to read its output and errors, and which parameters matter in a build script.

Sample Form for This Guide

The examples and screenshots use the sample form CH06_MODULE from the Oracle Forms code repository on GitHub. Download it, open it in Forms Builder, and connect as CAREWELL to follow along.

FormFileWhat it shows
CH06_MODULEforms/ch06/ch06_module.fmbThe form compiled in the examples

The forms run against the CareWell Clinic sample schema, which you install first.

Design Files and Runnable Files

ModuleDesign fileRunnable filemodule_type
Form.fmb.fmxform
Menu.mmb.mmxmenu
PL/SQL library.pll.plxlibrary

Runnable files are specific to the platform and the Forms release they were compiled for. An .fmx made on Windows does not run on Linux, so compile on the server that runs the forms, or on a machine of the same platform. For more on the kinds of modules, see how to create modules in Oracle Forms.

Compile in Forms Builder

Forms Builder has several compile commands, all on the Program menu:

CommandShortcutWhat it compiles
Compile ModuleCtrl+TThe current module, writing the runnable file next to the design file.
Compile PL/SQL, IncrementalCtrl+KOnly the code changed since the last compilation, without writing a file.
Compile PL/SQL, AllShift+Ctrl+KEvery trigger and program unit, without writing a file.
Compile SelectionCtrl+MThe code of the selected objects.
Run FormCtrl+RCompiles the form, then runs it.

Use Compile PL/SQL while you write code to catch errors quickly, and Compile Module when you need the .fmx file.

Compile from the Command Line with frmcmp_batch

Applications with dozens or hundreds of modules compile them from the command line, in a script. The compiler is frmcmp, and frmcmp_batch runs it without opening any window, which is what a script needs.

On Linux, run them through frmcmp.sh and frmcmp_batch.sh in the bin directory of the Forms instance, which set up the environment. On Windows, run frmcmp_batch.cmd from the same place.

Syntax:

frmcmp_batch module=file userid=user/password@database
             [module_type={form | menu | library}]
             [compile_all={yes | no}] [batch={yes | no}] [output_file=file]
             [logon={yes | no}] [script={yes | no}] [parse={yes | no}]
             [forms_doc={yes | no}] [debug={yes | no}] [statistics={yes | no}]

Example:

frmcmp_batch.sh module=ch06_module.fmb userid=carewell@formspdb module_type=form compile_all=yes

Output:

Compiling WHEN-NEW-FORM-INSTANCE trigger on form...
   No compilation errors.

Compiling WHEN-BUTTON-PRESSED trigger on CLOSE item in CONTROL data block...
   No compilation errors.


Created form file ch06_module.fmx

The compiler also prints its version and the versions of the libraries it uses, which the output above leaves out.

When the Code Has Errors

When the code has errors, the compiler lists each one with its trigger or program unit, its line and column, and the PL/SQL error, and writes no runnable file. Here is the result for a trigger that refers to an item that does not exist.

Output:

Compiling WHEN-NEW-FORM-INSTANCE trigger on form...
Compilation error on WHEN-NEW-FORM-INSTANCE trigger on form:
PL/SQL ERROR 49 at line 2, column 3
bad bind variable 'props.nosuch'

Compilation errors have occurred.

Form not created

PL/SQL error 49, bad bind variable, is the error you will see most often. It means the code refers to a block or item, here PROPS.NOSUCH, that the form does not have.

Check the Exit Status in Scripts

frmcmp_batch ends with exit status 0 when it created the file and 1 when it did not. A build script should check that status and stop, rather than deploy an old .fmx.

Form Compiler Parameters

ParameterDefaultMeaning
moduleNoneThe design file to compile.
useridNoneThe database connection. The compiler needs it to check the code against the tables and stored program units it uses.
module_typeformform, menu, or library.
compile_allnoyes compiles all the code of the module, not only what changed. Use it in build scripts.
batchnoyes suppresses the messages on the screen.
output_fileNoneThe runnable file to write, if not the default name and folder.
logonyesno works without a database connection, which is enough for script and forms_doc but not for compiling code.
script, parsenoConvert the module to a text file (.fmt, .mmt, .pld), or a text file back to a module.
forms_docnoWrite a text file that lists every object of the module with its properties.
debugnoInclude the information the debugger needs.
statisticsnoPrint the number of objects of each type.

For a build script, the combination to remember is module, userid, module_type, and compile_all=yes, with the exit status checked after each call. For compiling and running a single form from Forms Builder, see also how to run and compile an Oracle Form.

Conclusion

The Form Compiler turns .fmb, .mmb, and .pll design files into .fmx, .mmx, and .plx runnable files for one platform and release, so compile on the platform that runs the forms. In Forms Builder, use Compile Module (Ctrl+T) for the runnable file and Compile PL/SQL while you write code. In scripts, run frmcmp_batch with module, userid, module_type, and compile_all=yes, read the errors it lists by trigger, line, and column, and check its exit status before deploying.

Vinish Kapoor
Vinish Kapoor

An Oracle ACE and software veteran with 25+ years of experience, passionate about AI and IT innovation.

guest

0 Comments
Oldest
Newest Most Voted
00