Source code preparation


Overview

The com.castsoftware.formsreport extension does not accept native .fmb, .mmb, .olb, .pll, and .rdf files for analysis. Instead, these files must be manually converted before they can be analyzed.

This conversion can be actioned using a variety of methods, each described below with accompanying scripts that can serve as a basis for your own environment.

Dealing with .fmb, .mmb and .olb files

.fmb, .mmb and .olb files need to be converted to .xml. There are two main ways that you can do this:

Using Oracle Forms Builder

See https://blogs.oracle.com/apex/post/forms-to-apex-converting-fmbs-to-xmlexternal link.

Using the frmf2xml utility

frmf2xml is a utility provided with an Oracle Server installation and can typically be found in the following locations:

Microsoft Windows:
%ORACLE_HOME%\forms\templates\scripts\

Linux:
$ORACLE_HOME/config/fmwconfig/components/FORMS/instances/forms1/bin/

Typical syntax to generate an output .xml file is as follows:

frmf2xml [options] file1 [file2...]

See https://docs.oracle.com/database/apex-18.1/AEMIG/Converting_FormModules_ObjectLibraries_MenuModules_to_XML.htm#AEMIG172external link.

Example scripts

The following example scripts target .fmb files using the frmf2xml utility but can be modified to take .mmb and .olb files as input. You will also need to modify them to match your own environment:

Using the frmf2xml directly:

@echo off
setlocal

rem === CONFIGURATION ===
set FORMS_HOME=C:\Oracle\Middleware\Oracle_Home\forms
set INPUT_DIR=C:\Oracle\Projects\forms
set OUTPUT_DIR=C:\Oracle\Projects\xml\forms

rem Add Oracle Forms bin directory to the PATH
set PATH=%FORMS_HOME%\bin;%PATH%

rem Create the output directory if it doesn't exist
if not exist "%OUTPUT_DIR%" mkdir "%OUTPUT_DIR%"

rem === Convert .fmb files to XML ===
for %%f in ("%INPUT_DIR%\*.fmb") do (
    echo Converting %%~nxf...
    frmf2xml module="%%f" module_type=form batch=yes output_file="%OUTPUT_DIR%\%%~nf.xml"
)

echo All .fmb files have been converted.
pause

Calling the frmf2xml.bat file (supplied by Oracle):

@ECHO OFF

ECHO *******************************************************
ECHO "FORMS conversion to XML" 

REM Java 1.8 required
SET JAVA_HOME=C:\Users\CASTUSR\Documents\CAST_Solution_Design\OracleForms\jre1.8.0_221
SET ORACLE_HOME=C:\Oracle\Middleware\Oracle_Home
SET ORACLE_BAT=C:\Oracle\Middleware\Oracle_Home\forms\templates\scripts
SET SOURCES=C:\CAST\SC\OracleForms\Forms_Demo

SET ROOT_PAHT=C:\Users\CASTUSR\Documents\CAST_Solution_Design\OracleForms

SET Oracle_bin=%ORACLE_BAT%

RD %SOURCES%-XML
MD %SOURCES%-XML

SET RESULTATS=%SOURCES%-XML

cd %SOURCES%
pause

for %%f in (*.fmb) do %ORACLE_BAT%\frmf2xml.bat %%f

cd %ROOT_PAHT%

pause
#!/bin/bash

# ========================
# Oracle Forms FMB to XML Converter
# ========================

# --- Configuration ---
ORACLE_HOME="/your/path/to/oracle"  # <<< Update this!
FRMF2XML="$ORACLE_HOME/bin/frmf2xml"

# --- Check arguments ---
if [ "$#" -ne 1 ]; then
    echo "Usage: $0 /path/to/fmb_directory"
    exit 1
fi

FMB_DIR="$1"

if [ ! -d "$FMB_DIR" ]; then
    echo "Error: Directory '$FMB_DIR' does not exist."
    exit 2
fi

if [ ! -x "$FRMF2XML" ]; then
    echo "Error: frmf2xml tool not found or not executable at $FRMF2XML"
    exit 3
fi

# --- Prepare output and logs ---
TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
OUT_DIR="$FMB_DIR/output_xml"
LOG_DIR="$FMB_DIR/logs"
LOG_FILE="$LOG_DIR/convert_log_$TIMESTAMP.log"

mkdir -p "$OUT_DIR" "$LOG_DIR"

echo "---------------------------------------------" | tee -a "$LOG_FILE"
echo "Starting FMB to XML conversion: $TIMESTAMP" | tee -a "$LOG_FILE"
echo "FMB Source Directory : $FMB_DIR" | tee -a "$LOG_FILE"
echo "Output XML Directory : $OUT_DIR" | tee -a "$LOG_FILE"
echo "Log File             : $LOG_FILE" | tee -a "$LOG_FILE"
echo "---------------------------------------------" | tee -a "$LOG_FILE"
echo "" | tee -a "$LOG_FILE"

# --- Conversion loop ---
shopt -s nullglob
FMB_FILES=("$FMB_DIR"/*.fmb)

if [ ${#FMB_FILES[@]} -eq 0 ]; then
    echo "No .fmb files found in $FMB_DIR" | tee -a "$LOG_FILE"
    exit 0
fi

for fmb_file in "${FMB_FILES[@]}"; do
    base_name=$(basename "$fmb_file" .fmb)
    xml_output="$OUT_DIR/${base_name}.xml"

    echo "Converting: $base_name.fmb..." | tee -a "$LOG_FILE"

    "$FRMF2XML" module="$fmb_file" userid=/ output_file="$xml_output" >>"$LOG_FILE" 2>&1

    if [ $? -eq 0 ]; then
        echo "Success: $base_name.xml created." | tee -a "$LOG_FILE"
    else
        echo "Error: Conversion failed for $base_name.fmb" | tee -a "$LOG_FILE"
    fi
    echo "" | tee -a "$LOG_FILE"
done

echo "---------------------------------------------" | tee -a "$LOG_FILE"
echo "Conversion completed. See log for details." | tee -a "$LOG_FILE"
echo "---------------------------------------------" | tee -a "$LOG_FILE"

Dealing with .pll files

.pll files need to be converted to .pld. Use the File > Convert option in Oracle Forms Builder, see: https://docs.oracle.com/cd/E14373_01/migrate.32/e13368/appmgr_forms.htm#CHDEIIHCexternal link.

Example scripts

The following example scripts target .pll files using the frmf2xml utility. You will need to modify them to match your own environment:

@echo off
setlocal

rem === CONFIGURATION ===
set FORMS_HOME=C:\Oracle\Middleware\Oracle_Home\forms
set INPUT_DIR=C:\Oracle\Projects\libraries
set OUTPUT_DIR=C:\Oracle\Projects\xml\libraries

rem Add Oracle Forms bin directory to the PATH
set PATH=%FORMS_HOME%\bin;%PATH%

rem Create the output directory if it doesn't exist
if not exist "%OUTPUT_DIR%" mkdir "%OUTPUT_DIR%"

rem === Convert .pll files to XML ===
for %%f in ("%INPUT_DIR%\*.pll") do (
    echo Converting %%~nxf...
    frmf2xml module="%%f" module_type=library batch=yes output_file="%OUTPUT_DIR%\%%~nf.xml"
)

echo All .pll files have been converted.
pause
#!/bin/bash

# =============================
# Oracle PLL to PLD Converter
# =============================

if [ "$#" -ne 1 ]; then
    echo "Usage: $0 /path/to/pll_directory"
    exit 1
fi

PLL_DIR="$1"
ORACLE_HOME="/your/path/to/oracle"  # <<-- Adjust this
TOOL="$ORACLE_HOME/bin/plsql2asc"

if [ ! -x "$TOOL" ]; then
    echo "Error: Tool not found at $TOOL"
    exit 2
fi

TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
OUT_DIR="$PLL_DIR/output_pld"
LOG_DIR="$PLL_DIR/logs"
LOG_FILE="$LOG_DIR/convert_pll_log_$TIMESTAMP.log"

mkdir -p "$OUT_DIR" "$LOG_DIR"

echo "----------------------------------------" | tee -a "$LOG_FILE"
echo "Starting PLL to PLD conversion: $TIMESTAMP" | tee -a "$LOG_FILE"
echo "Source Directory : $PLL_DIR" | tee -a "$LOG_FILE"
echo "Output Directory : $OUT_DIR" | tee -a "$LOG_FILE"
echo "Log File         : $LOG_FILE" | tee -a "$LOG_FILE"
echo "----------------------------------------" | tee -a "$LOG_FILE"
echo "" | tee -a "$LOG_FILE"

shopt -s nullglob
PLL_FILES=("$PLL_DIR"/*.pll)

if [ ${#PLL_FILES[@]} -eq 0 ]; then
    echo "No .pll files found in $PLL_DIR" | tee -a "$LOG_FILE"
    exit 0
fi

for pll_file in "${PLL_FILES[@]}"; do
    base_name=$(basename "$pll_file" .pll)
    echo "Converting: $base_name.pll..." | tee -a "$LOG_FILE"

    "$TOOL" module="$pll_file" userid=/ output_file="$OUT_DIR/$base_name.pld" >>"$LOG_FILE" 2>&1

    if [ $? -eq 0 ]; then
        echo "Success: $base_name.pld created." | tee -a "$LOG_FILE"
    else
        echo "Error converting $base_name.pll" | tee -a "$LOG_FILE"
    fi

    echo "" | tee -a "$LOG_FILE"
done

echo "----------------------------------------" | tee -a "$LOG_FILE"
echo "PLL to PLD conversion complete." | tee -a "$LOG_FILE"
echo "----------------------------------------" | tee -a "$LOG_FILE"

Dealing with .rdf files

.rdf files must be converted to either .xml or to .rex files:

Converting to .xml

See the following for more information:

Example scripts

The following example scripts target .rdf files using the rwconverter utility. You will need to modify them to match your own environment:

@echo off
setlocal

rem === CONFIGURATION ===
set REPORTS_HOME=C:\Oracle\Middleware\Oracle_Home\bin
set INPUT_DIR=C:\Oracle\Projects\reports
set OUTPUT_DIR=C:\Oracle\Projects\xml\reports

rem Add Oracle Reports bin directory to the PATH
set PATH=%REPORTS_HOME%;%PATH%

rem === Database login (can be dummy if not needed) ===
set USERID=user/password@yourdb

rem Create the output directory if it doesn't exist
if not exist "%OUTPUT_DIR%" mkdir "%OUTPUT_DIR%"

rem === Convert .rdf files to XML ===
for %%f in ("%INPUT_DIR%\*.rdf") do (
    echo Converting %%~nxf...
    rwconverter userid=%USERID% source="%%f" stype=rdffile dtype=xmlfile overwrite=yes dest="%OUTPUT_DIR%\%%~nf.xml"
)

echo All .rdf files have been converted.
pause
#!/bin/bash

# =============================
# Oracle RDF to XML Converter
# =============================

if [ "$#" -ne 1 ]; then
    echo "Usage: $0 /path/to/rdf_directory"
    exit 1
fi

RDF_DIR="$1"
ORACLE_HOME="/your/path/to/oracle"  # <<-- Adjust this
TOOL="$ORACLE_HOME/bin/rwconverter"

if [ ! -x "$TOOL" ]; then
    echo "Error: Tool not found at $TOOL"
    exit 2
fi

TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
OUT_DIR="$RDF_DIR/output_xml"
LOG_DIR="$RDF_DIR/logs"
LOG_FILE="$LOG_DIR/convert_rdf_log_$TIMESTAMP.log"

mkdir -p "$OUT_DIR" "$LOG_DIR"

echo "----------------------------------------" | tee -a "$LOG_FILE"
echo "Starting RDF to XML conversion: $TIMESTAMP" | tee -a "$LOG_FILE"
echo "Source Directory : $RDF_DIR" | tee -a "$LOG_FILE"
echo "Output Directory : $OUT_DIR" | tee -a "$LOG_FILE"
echo "Log File         : $LOG_FILE" | tee -a "$LOG_FILE"
echo "----------------------------------------" | tee -a "$LOG_FILE"
echo "" | tee -a "$LOG_FILE"

shopt -s nullglob
RDF_FILES=("$RDF_DIR"/*.rdf)

if [ ${#RDF_FILES[@]} -eq 0 ]; then
    echo "No .rdf files found in $RDF_DIR" | tee -a "$LOG_FILE"
    exit 0
fi

for rdf_file in "${RDF_FILES[@]}"; do
    base_name=$(basename "$rdf_file" .rdf)
    echo "Converting: $base_name.rdf..." | tee -a "$LOG_FILE"

    "$TOOL" userid=/ source="$rdf_file" dest="$OUT_DIR/$base_name.xml" batch=yes stype=rdffile dtype=xmlfile overwrite=yes >>"$LOG_FILE" 2>&1

    if [ $? -eq 0 ]; then
        echo "Success: $base_name.xml created." | tee -a "$LOG_FILE"
    else
        echo "Error converting $base_name.rdf" | tee -a "$LOG_FILE"
    fi

    echo "" | tee -a "$LOG_FILE"
done

echo "----------------------------------------" | tee -a "$LOG_FILE"
echo "RDF to XML conversion complete." | tee -a "$LOG_FILE"
echo "----------------------------------------" | tee -a "$LOG_FILE"

Converting to .rex

There are two main ways that you can do this:

@@Echo on
REM set the REPORTS_PATH Oracle Environment Variable to point to the reports and templates required by rwconverter.exe. This environment variable is
REM used to locate reports and external objects that you use in your reports, such as PL/SQL libraries, external queries, and external boilerplate.
REM see https://docs.oracle.com/cd/B14099_19/bi.1012/b14048/pbr_rfap.htm#i648209 for more information.
set REPORTS_PATH=<path_to_reports>;<path_to_dependencies>
 
REM change directories and move to the location of your *.rdf files
cd D:\path_to\some_folder\
 
REM loop through all .rdf files in the current folder and convert into .rex files
for %%f in (*.rdf) do C:\path_to\rwconverter.exe source=%%f userid=<userid> stype=rdffile dtype=rexfile dest=..\rex1%%f.rex batch=yes
pause