Clovertech
› Clovertech Forums › Cloverleaf › How do I get the inbound file name in a tcl
I have a new process where files with different names will be placed in the same directory.
Each file will be processed differently.
How can I get the Inbound file name from the metadata?
Gene Millard
The Guthrie Clinic Sayre, PA
Protocol Driver Control holds this value. You can see it in SMATDB using metdata tab. It will depend where you need to grab the filename from. If from a tclproc, then you would use msgmetaget command. If from inside an xlate xpmmetaget.
I believe msgmetaget $<your filehandle> DRIVERCTL
In an Xlate, xpmmetaget $xlateId DRIVERCTL
Should help getting you the info….
I got it to work.
Thank you
IBFILE I believe is the key for the IB Filename within the DRIVERCTL Keyed List.
email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.
I am able to get the entire path with
set driverCtl [msgmetaget $mh DRIVERCTL] set ibFileName [keylget driverCtl FILENAME]
but I cannot get just the inbound file name with
set ibFileName [keylget driverCtl IBFILE]
[sms :sms :ERR /0:toAtaArchiveAfterProcess:03/10/2022 12:00:59] Tcl error: [sms :sms :ERR /0:toAtaArchiveAfterProcess:–/–/—- –:–:–] msgId = message0 [sms :sms :ERR /0:toAtaArchiveAfterProcess:–/–/—- –:–:–] proc = ‘tpsSetFromOracleFileName’ [sms :sms :ERR /0:toAtaArchiveAfterProcess:–/–/—- –:–:–] args = ” [sms :sms :ERR /0:toAtaArchiveAfterProcess:–/–/—- –:–:–] result = ‘key “IBFILE” not found in keyed list’ [sms :sms :ERR /0:toAtaArchiveAfterProcess:–/–/—- –:–:–] errorInfo: ‘ [sms :sms :ERR /0:toAtaArchiveAfterProcess:–/–/—- –:–:–] key “IBFILE” not found in keyed list [sms :sms :ERR /0:toAtaArchiveAfterProcess:–/–/—- –:–:–] while executing [sms :sms :ERR /0:toAtaArchiveAfterProcess:–/–/—- –:–:–] “keylget driverCtl IBFILE” [sms :sms :ERR /0:toAtaArchiveAfterProcess:–/–/—- –:–:–] (procedure “tpsSetFromOracleFileName” line 17) [sms :sms :ERR /0:toAtaArchiveAfterProcess:–/–/—- –:–:–] invoked from within [sms :sms :ERR /0:toAtaArchiveAfterProcess:–/–/—- –:–:–] “tpsSetFromOracleFileName {MSGID message0} {CONTEXT sms_ob_data} {ARGS {}} {MODE run} {VERSION 3.0}”‘
We just use “file tail”
set driverCtl [msgmetaget $mh DRIVERCTL] set ibFileName [keylget driverCtl FILENAME] set filename [file tail $ibFileName]
Ah my mistake. FILENAME is the Key not IBFILE.
Thanks Boris.
The file tail code worked.