Fileset-Local – Renaming an output file when finished

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Fileset-Local – Renaming an output file when finished

  • Creator
    Topic
  • #47894
    Steve Drozdowski
    Participant

    Using the fileset-local protocol to move a batch file thru the engine.  When done, I want to rename (and/or move) the outbound file to indicate that it is finished processing.  Anyone have any good ideas about how to do this?

    Thanks much!

Viewing 6 reply threads
  • Author
    Replies
    • #57006
      James McPheron
      Participant

      Steve –

        Whatever value the metadata has for OBFILE will ultimately be the file name.

        Example –

                 # The fileset driver’s configuration in NetConfig

                 # may be overridden by setting the equivelant key

                 # to the desired value in the messaga meta data

                 # field DRIVERCTL.

                 #

                 # Here the name of the outbound field is changed

                 # from what is configured in NetConfig to the

                 # value supplied by the user by setting file name to

                 # the value currently in the variable ‘file_name’.

                 set dvr_ctl_str “{FILESET {{OBFILE $file_name}}}”

                 msgmetaset $mh DRIVERCTL $dvr_ctl_str

    • #57007
      Steve Drozdowski
      Participant

      Hi James, thanks for this info.  This might come in handy.

      What I am actually trying to do is to create a file in an OB directory with a “.lck” extension (indicating that the file is still being processed), and then when it is all done, rename it without the “.lck” extension.

      Any ideas?

      Thanks.

    • #57008
      Rentian Huang
      Participant

      You could use a upoc thread, first make sure the OB queue of OB thread and xlt queue of the IB thread are both 0, then another tcl to change the file name. Put the below tcl in the Read TPS inside the UPoC properties.

      Hope this helps,

      Sam 🙂


                set ib_thread adt_eagle_only

        set ob_thread star_adt_eagle

                set ob_stats [msiGetStatSample $ob_thread]

        keylget ob_stats OBDATAQD ob_q

        set ib_stats [msiGetStatSample $ib_thread]

        keylget ib_stats INTERTHREAD inter

        foreach thread $inter {

           keylget thread NAME name

           if {[cequal $name $ob_thread]} {

      keylget thread POSTXLTQD xlt_q

      break

           }

        }

                if {$ob_q == 0 && $xlt_q == 0} {

            # change the output file name

           

        } else {

            echo “Continue scanning…”

            return “”

        }

    • #57009
      Anonymous
      Participant

      Steve,

      You could put the procedure that renames the file into the ‘send ok’ tps.  That way you’re guaranteed that the engine has closed the file.

    • #57010
      Steve Drozdowski
      Participant

      Thanks Greg, I will try that!   😀

    • #57011
      Steve Drozdowski
      Participant

      Greg will this method only work if the outbound fileset-local “style” is set to EOF?  Currently we are using style NL because the file being processed is very large.  If I switch to EOF, will the entire file (a single big message) be kept in memory until it isa ready to be written out?

      Thanks.

    • #57012
      Michael Hertel
      Participant

      If you know you have the last transaction…

      Do a msg copy and set the the metadata for the filename of the second message to .done

      Have an alert sitting there watching for file change to .done and fire off your script to rename and cleanup.

      -mh

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

Forum Statistics

Registered Users
5,127
Forums
28
Topics
9,299
Replies
34,443
Topic Tags
288
Empty Topic Tags
10