Advanced Scheduling with FTP protocol

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Advanced Scheduling with FTP protocol

  • Creator
    Topic
  • #48823
    Kevin Scantlan
    Participant

    I am wanting to pick up a file via FTP 3 times daily.  I tried to set up Advanced Scheduling with the FTP Protocol Properties, but it doesn’t seem to work.  Has anyone set something up like this?

    Thanks.

Viewing 6 reply threads
  • Author
    Replies
    • #59807
      William Grow
      Participant

      The advanced scheduling worked great in 5.3 for this problem. I did note that the thread would automatically look for a file whenever it was bounced. Also, the specified ftp directory needs to be relative to the ftp ftp server root of the user that is logging in to the system.  Another problem I noted was that the thread would go into an error state if it tried to parse a completely empty directory. To resove that problem I placed some dummy files in the directory and added a tps directory parse script to ignore the dummy files.

    • #59808
      Kevin Scantlan
      Participant

      I’m just tested that myself and I agree with you.  I have the FTP scheduled for 10:30a, 11:40a, and 2:10p.  It was after 4pm when I bounced the thread and it picked up the file.  What’s going on here?

    • #59809
      Kevin Scantlan
      Participant

      In connection with this, I noticed a checkbox, FTPDELAY, with the FTP protocol.  From what I read, this is to “delay connection until needed”.  With an outbound thread, I can understand what “until needed” means.  But what does it mean on an inbound thread like I have?

    • #59810
      Greg Eriksen
      Participant

      You might want to check out this forum thread and decide if it is relevant:

      http://clovertech.infor.com/viewtopic.php?t=1278&highlight=

      If you’d like, I could post the code of the proc I created.

    • #59811
      Bala Pisupati
      Participant

      Hi Greg

      can you post the code for the proc you created. thanks

    • #59812
      Greg Eriksen
      Participant

      Hi Bala,

      This has seemed to run pretty well since I set it up a year ago.  It doesn’t look for the file when run mode is executed right after the process is bounced, but it does look for the file when advanced scheduling kicks it off afterwards.

      Code:


      ######################################################################
      # Name: tps_local_midas_drg
      # Purpose:  select the file in the local directory to process
      # UPoC type: tps
      # Args: tps keyedlist containing the following keys:
      #       MODE    run mode (”start”, “run” or “test”)
      #       MSGID   message handle
      #       ARGS    user-supplied arguments:
      #              
      #
      # Returns: tps disposition list:
      #          Returns a list of messages for the fileset
      #   driver to process.
      #
      # Note: there appears to be a bug current in 5.4 in that when the
      # thread or process is started, this dirParse proc is run twice, once
      # in ‘start’ mode and then again in ‘run’ mode. I have put a fix in
      # place using a global flag variable, so that the first ‘run’ after a
      # startup will skip most actions in the run mode section.  The actions
      # will execute on a subsequent run triggered by advanced scheduling.

      proc tps_local_midas_drg { args } {
         global midas_drg_startup

         keylget args MODE mode
       
         set proc_name [lindex [info level [info level]] 0]

         switch -exact — $mode {
             start {
                 # Perform special init functions
                 # N.B.: there may or may not be a MSGID key in args

                 # set flag to indicate process/thread startup.
                 set midas_drg_startup “1”

                 return {}
             }

             run {
                 # ‘run’ mode always has a MSGID; fetch and process it
                 keylget args MSGID mh

                 # Check for correct context
                 keylget args CONTEXT ctx
                 if {![cequal $ctx “fileset_ibdirparse”]} {
                     echo “ERROR proc used in wrong context”
                     echo “Context should be fileset_ibdirparse”
                     echo “Proc called in: $ctx”
                     return “{CONTINUE $mh}”
                 }

                 # check for startup flag and set off if this is the first run after start.
                 if {[cequal $midas_drg_startup “1”]} {
                     set midas_drg_startup “0”
                     msgset $mh {}
                 } else {
                 # all other actions in run mode occur only during a scheduled run, not startup run.

                     # In this context the message handed to this proc
                     # by the driver in not a data message.  Rather
                     # it is a space separated string of file names
                     # from the directory the fileset driver is
                     # configured to read.
                   
                     # I am expecting this directory to contain a single instance of file “MDSDRG”,
                     # and if it’s not there I want to raise a stink about it.  

                     set msg_list [msgget $mh]
                     set msg_list [split $msg_list]
                     set msg_list [lregexp  $msg_list “^MDSDRG$”]
                     if {[llength $msg_list] != 0} {
                         echo “***n*** $proc_name – found file to process: $msg_list n***”
                         set emails “MDSDRG”
                         set subject “_SUCCESS_ – Midas DRG/Charges Interface File”
                         set message “File MDSDRG was found and will be processed.”

                         set filePath “/quovadx/ftptransfers/MDSDRG/MDSDRG”
                         set fileSize [file size $filePath]
                         set fileDate [clock format [file mtime $filePath] -format %Y%m%d]
                         set todayDate [clock format [clock seconds] -format %Y%m%d]
                         if {(![cequal $fileDate $todayDate]) || ($fileSize == 0)} {
                              set subject “_WARNING_ – Midas DRG/Charges Interface File”
                              set message “File MDSDRG was zero-length or not today’s date.”
                         }
                     } else {
                         echo “***n*** $proc_name – NO MDSDRG FILE FOUND TO PROCESS n***”
                         set emails “MDSDRG_ERR”
                         set subject “_ERROR_ – Midas DRG/Charges Interface File”
                         set message “File MDSDRG has not been transfered from the mainframe!nnPage the PAB DO.”
                     }
                     alertTrigger “$emails” “$subject” “n$message” “gemini.mmc.org” “mmc.org” “” “”
                     msgset $mh $msg_list
                 }

                 return “{CONTINUE $mh}”
             }

             time {
                 # Timer-based processing
                 # N.B.: there may or may not be a MSGID key in args
             }

             shutdown {
         echo “***  $proc_name shutting down.”
             }

             default {
         error “Unknown mode ‘$mode’ in $proc_name”
             }
         }
      }

      Of course some of this proc is specific to our site and this particular file, but you should be able to just swap in your runtime actions in the section after:

      Code:


      } else {
                 # all other actions…


      I also don’t know if this unfortunate quovadx behaviour of executing both Start and Run modes after a process bounce remains consistant in releases before or after 5.4, so caveat emptor, etc.

      Greg E.

    • #59813
      Bala Pisupati
      Participant

      Thanks Greg

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

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,435
Topic Tags
286
Empty Topic Tags
10