Reply To: Passing a file name to the destination

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Passing a file name to the destination Reply To: Passing a file name to the destination

#57889
Rentian Huang
Participant

    Ryan,

    Thanks for your hint!

    Sounds the only place I can find the input file name from the IB thread is in the “Directory Parse” TPS.

    Then I used this tcl to store the file name in a global variable:

    Code:

    global viamdFDate

    keylget args MODE mode
    keylget args CONTEXT context
    if {![keylget args ARGS.DEBUG debug]} { set debug “0” }
    if {![keylget args ARGS.FILTER filter]} { error “No filter argument provided” }

    set dispList {}
    switch -exact — $mode {
    start {}
    run {
    keylget args MSGID mh
    set data [msgget $mh ]

    set return_files {}
    foreach file $data {
    if [string match $filter $file] {

    set viamdFDate $file
    lappend return_files $file
    }
    }
    msgset $mh $return_files
    lappend dispList “CONTINUE $mh”
    }
    shutdown {}
    time {}
    default {
    error “Unknown mode ‘$mode’ in tps_fileset_dir_parse”
    }
    }
    return $dispList

    But when I tried to use is in another tcl, I get this error:

    Code:

    11/28/2005 16:06:01 [xlt :xlat:ERR /0:viamd_lawson_po_xlate] Tcl error:
           msgId   = message0
           proc    = ‘tpsSetUserData’
           args    = ‘{{VALUE} {PO}}’
           result  = ‘can’t read “viamdFDate”: no such variable’
           errorInfo: ‘
    can’t read “viamdFDate”: no such variable
       while executing
    “msgmetaset $mh USERDATA ${value}_$viamdFDate”
       (”run” arm line 7)
       invoked from within
    “switch -exact — $mode {
           start {
               # Perform special init functions
               # N.B.: there may or may not be a MSGID key in args
          …”
       (procedure “tpsSetUserData” line 9)
       invoked from within
    “tpsSetUserData {MSGID message0} {CONTEXT xlt_post} {ARGS {{{VALUE} {PO}}}} {MODE run} {VERSION 3.0}”‘

    Here is the tcl that uses the global variable:

    Code:


    keylget args MODE mode               ;# Fetch mode

    ####### Global variable to hold the date in the viaMD’s file name #######
    global viamdFDate

       set dispList {} ;# Nothing to return

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

           run {
    # ‘run’ mode always has a MSGID; fetch and process it
    keylget args MSGID mh
    keylget args ARGS.VALUE value
    #msgmetaset $mh USERDATA $value

    msgmetaset $mh USERDATA ${value}_$viamdFDate
    lappend dispList “CONTINUE $mh”
           }

           time {
               # Timer-based processing
     # N.B.: there may or may not be a MSGID key in args
           }
           
           shutdown {
       # Doing some clean-up work
    }
       }

       return $dispList

    Where did I do wrong???