JCL syntax for File Manager/Db2 batch jobs

To use a File Manager/Db2 function in a batch job, include the following statement: //stepname EXEC PGM=FMNDB2,PARM=('SSID=sysid,SQID=sqlid')"

where,
sysid
Refers to the Db2 subsystem where the FM/Db2 functions run.
sqlid
Refers to the Db2 SQLID under which the FM/Db2 functions run.

By default, report output is written to SYSPRINT. Sections of the output can be directed instead to the following ddnames:

FMNRPRM
$$FILEM command parameters and return codes
FMNREPT
Command reports and return codes
If FMNPRINT is present in the JCL, it is used instead of SYSPRINT. If FMNIN is present in the JCL, it is used instead of SYSIN.

You might also need a STEPLIB statement or other DD statements, depending on which File Manager functions the batch job contains.

When you code File Manager control statements, you must:
  • Begin each control statement with $$FILEM in columns 1 to 7, followed by a blank in column 8, followed by the command name, followed by the first parameter (if any).
  • Specify parameters and their values separated by an equal sign, as follows:
    PARAMETER=value
  • Follow each parameter (except the last one) immediately with a comma.

Comment statements, which begin with an asterisk (*), are also allowed.

To continue a control statement onto the next line, end the first line with a comma and begin the next line with $$FILEM and a blank.

To continue a parameter that does not fit onto one line, do not use a continuation character. Instead, split the parameter into more than one line, enclosing each part in apostrophes. For example:
$$FILEM OBJIOWNR='LONGOWNER1234567890123456789012345678901', 
$$FILEM '2345678901234567890123456789012345678901NAME', 
Notes:
  1. If the control statement contains only the function name, there must be a space between the function name and the comma.
  2. To change processing options in batch or to reset options to the installation default, use the SET function.

Example

The following example shows a batch job that uses the FM/Db2 DSP function to print the Db2 table:
//jobcard
$$FILEM DBP FORMAT=TABLE,                                    
$$FILEM OBJIOWNR='LONGOWNER1234567890123456789012345678901', 
$$FILEM '2345678901234567890123456789012345678901NAME',      
$$FILEM OBJINAME='DUMMY_TABLE_WITH_A_LO2345678901234567890', 
$$FILEM '1234567890123456789012345678901234LONG_NAME',       
$$FILEM UCREAD=YES,                                          
$$FILEM NULLIND=_,                                           
$$FILEM ROWS=ALL