While there is certainly nothing wrong with doing it that way, basically you are “circumventing” what Cloverleaf already does for you. If you set your Directory entry in the Fileset Options Inbound to C:/save_msgs/ and set your style to “single” then your Directory Parse proc is going to get the glob’d list that you are manually doing as its message. At that point you can move right to your lsort in order to get the read to process the messages in the order that you want. A couple of handy things that you might want to try are “file tail”, “file extension”, and “file rootname”. These commands give you:
file tail: returns the filename without the path
file extension: returns the extension of the file
file rootname: returns the filename without the extension
As one additional point of order, you are doing: return “{CONTINUE $mh}” followed by lappend dispList “CONTINUE $mh”
The execution of the proc is going to terminate and return as a direct result of the return command and the lappend is never going to be hit. You can either do the return as you have it or you can do:
lappend dispList “CONTINUE $mh”
return $dispList
I caution you on that mainly to point out that the return command does not set up the return value, it actually does the return and terminates execution of the proc.
These are all just points of order, if what you have done is working for you then that is the important part.
One other potentially helpful aside is that I believe the filename is placed into the driver control metadata once you get to the Inbound-TPS (this did not used to be the case). This is helpful if you need to know the inbound file name while processing the message.