Originally posted by Kevin Scantlan
Originally posted by William Grow
Originally posted by Greg Eriksen
Originally posted by Bala Pisupati
####################################################################### 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:# <describe user-supplied args here>## 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" } }}
} else { # all other actions...