Starting FM/Db2 functions from an external application

You can use the FM/Db2 exec FMN2INEX to start a File Manager/Db2 function from an external application such as a REXX exec or CLIST.

FMN2INEX is distributed in FMN.SFMNEXEC. When using this interface you need to ensure the following:
  • The File Manager libraries must be allocated before calling FMN2INEX.
  • If you use LIBDEFs and ALTLIB statements to allocate the File Manager libraries, invoke FMN2INEX using the following command:
    "SELECT MODE(FSCR) CMD(%FMN2INEX "parms") NEWAPPL(FMN2) PASSLIB SUSPEND"
    This will ensure that the File Manager libraries are available to FMN2INEX.

The parameters that can be passed to FMN2INEX are shown in Parameters for FMN2INEX.

The function codes that can be specified are shown in Function codes for FMN2INEX.

For example, referring to Parameters for FMN2INEX and Function codes for FMN2INEX, you might build the following parameter string:
SSID(DFE2) OW(DSN81210) NM(EMP) F(4.5)
In this case your select statement would be:
"SELECT MODE(FSCR) CMD(%FMN2INEX SSID(DFE2) OW(DSN81210) NM(EMP) F(4.5)),
NEWAPPL(FMN2) PASSLIB SUSPEND"
Table 1. Parameters for FMN2INEX
Parameter Description
SSID The Db2® subsystem (or data sharing group) ID that FM/Db2 should connect to.
OW The owner (creator) of a Db2® object that FM/Db2 should access.

The owner is only passed if the function will accept an owner. Owner values are not passed to menu panels, or any option panel. See Function codes for FMN2INEX for additional exceptions.

NM The name of a Db2® object that FM/Db2 should access.

The name is only passed if the function will accept a name. Name values are not passed to menu panels, or any option panel. See Function codes for FMN2INEX for additional exceptions.

F
  • A code that indicates which FM/Db2 function should be executed. The code corresponds to the FM/Db2 main menu option used to select the desired function (eg 3.6 for import).
  • For editor functions only, if the function code has 'O' as a suffix, the editor function entry panel will be displayed.
  • For editor functions without the 'O' suffix, the first data displayed will be the data for the specified Db2® object.
Table 2. Function codes for FMN2INEX
Function code Description
B FM/Db2 Browse function. First panel displayed shows data for the specified Db2® object.
BO As for B, except the editor function entry panel is the first panel displayed.
1 FM/Db2 View function. First panel displayed shows data for the specified Db2® object.
1O As for 1, except the editor function entry panel is the first panel displayed.
2 FM/Db2 Edit function. First panel displayed shows data for the specified Db2® object.
2O As for 1, except the editor function entry panel is the first panel displayed.
3 Displays the FM/Db2 Utilities menu.
3.1 FM/Db2 Print function. First panel displayed is the print function entry panel.
3.2 File Manager Object functions. First panel displayed is the Object Functions function entry panel. Any owner or name values are NOT passed.
3.3 FM/Db2 Copy function. First panel displayed is the copy (from) function entry panel.
3.4 File Manager Object List function. First panel displayed in the Object List function entry panel.
3.5 File Manager Object Privileges function. First panel displayed in the Object Privileges function entry panel.
3.6 FM/Db2 Import function. First panel displayed is the import (from) function entry panel.
3.7 FM/Db2 Export function. First panel displayed is the export function entry panel.
3.8 FM/Db2 Data Create function. First panel displayed is the data create function entry panel.
3.9 FM/Db2 Utilities function. First panel displayed is the Db2® utilities function entry panel. Any owner or name values are NOT passed.
3.10 FM/Db2 Audit Log function. First panel displayed is the audit log function entry panel. Any owner or name values are NOT passed.
4 Displays the FM/Db2 SQL Prototyping, Execution and Analysis menu.
4.1 File Manager Basic SQL Prototyping function. First panel displayed is the basic SQL prototyping function entry panel.
4.2 File Manager Advanced SQL Prototyping function. First panel displayed is the advanced SQL prototyping function entry panel. Any owner or name values are NOT passed.
4.3 File Manager "Enter, Execute and Explain SQL Statements" function. First panel displayed is the "Enter, Execute and Explain SQL Statements" function entry panel. Any owner or name values are NOT passed.
4.4 File Manager "Edit and Execute SQL Statements from a Data Set" function. First panel displayed is the "Edit and Execute SQL Statements from a Data Set" function entry panel. Any owner or name values are NOT passed.
4.5 File Manager Explain Utilities function. First panel displayed is the explain utilities function entry panel. Any owner or name values are NOT passed.
6 File Manager Enter and Execute Db2® Commands function. First panel displayed in the enter and execute Db2® commands function entry panel. Any owner or name values are NOT passed.
0 Displays the FM/Db2 Options menu.
0.0 Displays the FM/Db2 System Options menu.
0.0.1 Displays the FM/Db2 Print Settings panel.
0.0.2 Displays the first FM/Db2 Systems Options panel.
0.0.3 Displays the FM/Db2 Batch Job Card information panel.
0.0.4 Displays the FM/Db2 Compiler Language selection panel.
0.0.5 Displays the FM/Db2 COBOL Processing Options panel.
0.0.6 Displays the FM/Db2 HLASM Processing Options panel.
0.0.7 Displays the FM/Db2 PL/I Processing Options panel.
0.0.8 Displays the FM/Db2 Temporary Data Set Allocations panel.
0.0.9 Displays the FM/Db2 Output Data Set Allocation Options panel.
0.0.10 Displays the FM/Db2 Trace Options panel.
0.1 (0.2) Displays the first FM/Db2 Editor options panel.
0.3 Displays the FM/Db2 Utility Processing Options panel.
0.3.1 Displays the FM/Db2 Print Utility Options panel.
0.3.3 Displays the FM/Db2 Copy Utility Options panel.
0.3.4 Displays the FM/Db2 Object list utility options panel.
0.3.7 Displays the FM/Db2 Export utility options panel.
0.3.L Displays the FM/Db2 Db2® LOAD utility options panel.
0.3.UL Displays the FM/Db2 Db2® Utility LISTDEF options panel.
0.3.UO Displays the FM/Db2 Db2® Utility OPTIONS options panel.
0.3.UT Displays the FM/Db2 Db2® Utility TEMPLATE options panel.
0.3.UU Displays the FM/Db2 Db2® Unload utility options panel.
When a File Manager/Db2 function is started using FMN2INEX, the following restrictions apply:
  • You cannot issue a command to change the currently connected Db2® system.
  • The SQLID used when FM/Db2 is started is the same as the users TSO logon ID, unless modified by a Db2® authorization exit.
  • Exiting the first panel displayed by the FMN2INEX invocation returns to the caller. It is not possible to navigate to other parts of File Manager. You can however use the pull-down options to perform FM/Db2 functions.

These restrictions do not apply when no option code is specified for the FMN2INEX invocation.

Only the function codes listed in Function codes for FMN2INEX are supported. Any attempt to use any other code will result in the primary FM/Db2 menu being displayed; the erroneous function code will be discarded.