MFFTP Processing the User Module

The parameter block specified in the topic The Parameter Block is passed to the user module.

As a minimum, set the return code in the INIT function and return the call. This enables the user module to call MFFTP. If the user module requires any other initialization, you need to specify the required parameters at this point.

In the CALL function, the user module should do its normal processing. The module passes four unique filenames, two of which are required by MFFTP and two that might be used by this module.

While it is not a requirement to use these names, they must be unique within the Enterprise Server environment, allowing concurrent execution without locking files.

The “PASS-IP” (ftpxxxxx.snnn.ip) is a dynamically created text file which contains the control cards that MFFTP has checked and performed any reformatting on. As a minimum, the file should include the following four records:

The user module writes any output from the client to this file, as it is this file that MFFTP writes to the designated print file. The client could write directly to this file or to an intermediate file, and the user module can edit the output, for example, to mask any sensitive information such as the user id or the password.

Two sample modules are provided:

The two sample modules can be found in the %ProgramFiles(x86)%\Micro Focus\Enterprise Developer\src$COBDIR/src/enterpriseserver/exit directories.

Different clients are likely to have different requirements. Micro Focus recommends that, if you wish to use this option, you either start from scratch by creating new modules or make a copy of one of the sample modules rather than modify the original files.

To access any of the control variables, you need to call MFFTP12 rather than use the DISPLAY ENVIRONMENT-NAME / ACCEPT ENVIRONMENT-VALUE method. This is because if the variable was set using the ENVVAR DD statement or configured in the FTP.DATA dataset , it does not exist within the environment space.

To retrieve any variable, call MFFTP12 as follows:

01  ws-var-name                             pic x(32). 
01  ws-var-value                            pic x(256).

move "MFFTP_var-name" to ws-var-name.
call "MFFTP12" using ws-var-name
                     ws-var-value
end-call

After the call, if MFFTP locates the variable, it is in the second parameter.

If the value in the first parameter is not an MFFTP control variable, the first byte of the second parameter is set to x’FF’.