› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › TCL – Storing Input FileName into a variable › Reply To: TCL – Storing Input FileName into a variable
Not too familiar with a directory parse proc. Is that any different for a tcl proc? The code that I have is written for an x12 file, in TCL. A bit of the syntax is added below:
proc Facets_x12_div { args } {
keylget args MODE mode ;# Fetch mode
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
set msg [msgget $mh]
set dir /hci/FTP/EOB/FACETS/OUT
set count 0
set segCount 0
set segID “”
set elSep [string index $msg 104]
set ISAHdr [string range $msg 0 [string first “${elSep}” $msg]]
set splitMsg [split $msg ~]
foreach seg $splitMsg {
if {$segCount > 0} {
set preSegInd $segID
}
set segID [string range $seg 0 2]
incr segCount +1
switch -exact $segID {
ISA {
lappend outMsg $seg }
GS* { if {$count > 0} {
set outFile [open $dir/PHP$outFileName.DAT w]
set outMsg “[join $outMsg ~]~”
puts $outFile $outMsg
flush $outFile
set outMsg “”
lappend outMsg $ISAHdr
Thank you David.