Run script on end of file?

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Run script on end of file?

  • Creator
    Topic
  • #49728
    garry r fisher
    Participant

      Hi,

      I have a large file (105000 records) in CSV format which I read in using fileset local without any other scripts. Its mapped to a different format and again written out to file. What I want to do is run a tcl script against the resultant file but only when the file read has completed.

      Anybody any idea how to do this? One thought I had was to check the input directory to see if the file has been deleted after processing and then I know to run my script.

      Any other suggestions?

      Regards

      Garry

    Viewing 3 reply threads
    • Author
      Replies
      • #63315
        Jim Kosloskey
        Participant

          Garry,

          It has been a while so I may not have all the details but here is a way I have used:

          In the directory where the file(s) will reside I put a file with a name which will always sort last (not required but reduces the amount of Tcl needed) and I protect it so that it is very difficult to delete accidently.

          In that file I place one message which essentially tells me I have reached that point. SInce this file name will sort last this essentially becomes my ‘end of file(s)’ indicator.

          Then I need a Tcl proc to make sure Cloverleaf(R) does not delete the special file in the Fileset Local protocol.

          Finally, if I need to know I have read all of the messages from the directory on the inbound thread, I have a Tcl proc (usually on the IB Tps) to do whatever I want when I reach the message from that special file.

          If I need to know that information (all messages read) further down the line, then I put an indicator in the USERDATA Metadata field and interogate that where appropriate.

          I just know I have missed or mis-stated some steps in that description but that is essentialy the idea.

          There has been a request for at least a decade to have Cloverleaf(R) set an indication end of file per fiel and end of all files has been reached.

          Jim Kosloskey

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #63316
          garry r fisher
          Participant

            Thanks Jim,

            Yes – That makes sense and is more elegant than checking the existence of the file. I’ll have a playaround with some idea”s and see how it goes.

            I assume that the end of file(s) inidcator is not in 5.6 then:-)?

            Regards

            Garry

          • #63317
            Jim Kosloskey
            Participant

              Garry,

              I don’t recall that being a part of 5.6.

              But if it is that would be very welcome.

              If you want to chat directly email me.

              Jim Kosloskey

              email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

            • #63318
              David Harrison
              Participant

                Garry,

                There are issues around processing files which have been transferred by another process, as you don

            Viewing 3 reply threads
            • The forum ‘Cloverleaf’ is closed to new topics and replies.