Please enable JavaScript to view this site.

Navigation: Technical Information > Cobwebb Monitor Programs > Cobwebb Folder Monitor

Creating a bespoke Folder Monitor program

Scroll Prev Top Next More

When you are creating your program to process the files in the folder being monitored by FLRMON you must have the following two parameters defined. Note: The Return Code is set to x'01'  when the monitor program is called.

Parameter

Type

Length

Description

Supported CPPD Version

File Path

CHAR

255

File path including file name e.g. /QDLS/test/file.txt


Return Code

CHAR

1

x'00' = Success - move file being processed to success folder if defined



x'01' = Fail - move file being processed to fail folder



x'02' = Leave file in the same folder to be reprocessed

6.2.78+


x'10' = Success - move ALL files with same filename (but different extensions) to success folder if defined

6.2.78+


x'11' - Fail - move ALL files with same filename (but different extensions) to fail folder

6.2.78+


Anything other than the above = Fail i.e. as if x'01' returned


You will also need to make sure to pass back the correct Return Code in order that the folder monitor knows what to do with the file after the program has finished processing. If you are satisfied that you have correctly processed the file then set the Return Code to x'00' (or x'10' to move all files) otherwise set it to anything else other than x'02' and the file will be moved to the Failed folder.

If you are accessing files / programs outside the CPPD library then you will need to make sure that you create a Job Description to include any additional libraries.

We have supplied a FLRMON Job Description that you can copy which has the correct User and Job Queue entries to run in the CPPD Subsystem; all you will then need to do is to add the extra libraries and make sure that you add this Job Description to your Folder Monitor entry in Work with Folder Monitor or to your SBMJOB command if you are adding a bespoke Autostart job.

Referencing Folder Monitor Parameters in your Folder Monitor Program

From Version 6.2.62 -  When an Online folder monitor is running in the CPPD Subsystem the Job Name will be the Folder Monitor Name. You can therefore retrieve the Folder Monitor Name by referencing the Program Status Data Structure to retrieve the Job Name e.g.

      *

     D                SDS

     D  @JobName               244     253

This can then be used to retrieve the required parameter values by using each pre-defined parameter name from AFLRMONP. By the use of parameters you should be able to use the same base Folder Monitor program to monitor several folders where the only difference is a couple of variables. Take FTP for instance; you may wish to create a program to FTP details from a folder to another server where the only difference is the IP Address, User Name and Password. To save you having to create several almost identical programs you can access previously stored parameters to hold the varying information.

Note: We have provided some sample source FMSAMPLE in QUSRTOOLLE in library CPPD based on using the *STD Folder Monitor Type which you can copy for your program - from Version 6.2.72.