› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Linux uudedode "No `begin’ line"
Linux 7.x
We’re upgrading from 5.7 and have run into a problem with our interface from MUSE with an embedded TIF.
On 5.7 in TCL, we extract the embedded TIF, “decrypt” it (i.e. replace HL7 encoding characters and cr/nl) like so:
set cr [format “%c” 13]
set nl [format “%c” 10]
set DecryptWF [string map {\F\ |} $WaveForm]
set DecryptWF [string map {\S\ ^} $DecryptWF]
set DecryptWF [string map {\T\ &} $DecryptWF]
set DecryptWF [string map {\R\ ~} $DecryptWF]
regsub -all {\X0A\} $DecryptWF $nl DecryptWF
regsub -all {\X0D\} $DecryptWF $cr DecryptWF
set DecryptWF [string map {\E\ \} $DecryptWF]
Then it’s written to a file and an exec to the Linux uudecode command is called:
#Write decrpyted message to file
if [catch {open $path/tmp/EKG$ctrval.tmp w} FileID] {
puts “Error writing File $path/tmp/EKG$ctrval.tmp”
}
puts -nonewline $FileID $DecryptWF
close $FileID
catch {exec uudecode -o $path/tmp/EKG_DECRYPTED_$ctrval.tmp $path/tmp/EKG$ctrval.tmp} result
This works fine in the 6.2 TPS tester and from the TCL command line, however, when I run it through the route tester or in the engine I get:
uudecode: /usr/integrator/prod/muse/tmp/EKG0000000047.tmp: No `begin’ line
A 0KB file is created.
I’ve tried using the base64 and uuencode TCL packages, but I’m still unable to create a readable image. I’ve also tried with and without fconfigure on the file I/O.
The inbound thread is configured with pdl-tcpip protocol. I’ve used ASCII, binary, and bypass for the encoding, but get the same results with all 3.
Any ideas or suggestions?
Can you post a sample HL7 message and the full TCL script that you’re using to do the conversion?
Hi David,
I only have LIVE data so I don’t have an example HL7 message to upload. We will be bringing on another facility to use MUSE in the next couple of weeks, so I should get some test messages then that I can upload.
Meanwhile, attached is the tcl proc in it’s entirety (with some sensitive data removed for security purposes.)
Let me know your thoughts.
What does ZPD-3 in your message look like? Is it something like “begin 644 image.tifX0D\X0A#0V%T…”? Can you at least post the first few characters of that field?
Also, what is the output of this command in your log file (the first few lines)?
echo “Decrypted Wave Form: n$DecryptWF”
Yep. Looks like this:
begin 644 WAV.DATX0D\X0AM24DJ“@““/`/X“P`!“““““`!!“!““X`,“`$!!“!“““,`X0D\X0AM“(!`P`!““`0““,!`P`!““`0““8!`P`!““`0“`!$!!“,““X0D\X0AMT@
Also, here are the first few lines of the echo command:
echo “Decrypted Wave Form: n$DecryptWF”
Decrypted Wave Form: begin 644 WAV.DAT
M24DJ“@““/`/X“P`!“““““`!!“!““X`,“`$!!“!“““,`
M“(!`P`!““`0““,!`P`!““`0““8!`P`!““`0“`!$!!“,““
MT@“`!(!`P`!““`0“`!4!`P`!““`0“`!8!!“!““0@“`!<!!“,
M““`@$“!H!!0`!““P@“`!L!!0`!““R@“`!P!`P`!““`0“`"@!
M`P`!““`@“`#)U`0"6““`0“`)8““!““,@$“"HA“`B00“&F$`
M`!*!“`*H0“`L$“/K@“#R“$`ZB`!`.)“0#:8`$`^!“/@?“#X'P“
M^!“/@?“#X'P“^!“/@?“#X'P“^!“/@?“!8%“`____________
M____________________________________________________________
M____________________________________________________________
M____________________________________________________________
M____________________________________________________________
M____________________________________________________________
Can you manually run uudecode on the EKG0000000047.tmp after the process fails to decode it? Does it give you the same error? What’s in the .tmp file?
It looks like your script is doing the FTP from within the script. Is there a reason that you’re not calling [msgset] on the TIFF data and letting the FTP protocol driver send the file?
And you should probably put a delay in this loop (probably just say “after 1000”), because this will use lots of CPU while waiting for the file.
[code]
Looks like David is on to something here. In your Tcl proc echo out the first 100 characters of the file just before the decode
The .tmp file contains the “decrypted” wave form after the substitutions (string map and regub) are done.
I can manually decode the EKG$ctrval.tmp (i.e. EKG0000000047.tmp) file from the Linux command line and get a readable image:
[hci@cloverleaf-prd muse]$ uudecode -o EKG0000000056.tif tmp/EKG0000000056.tmp
[hci@cloverleaf-prd muse]$ ll
total 296
-rw-r–r–. 1 hci staff 191068 Apr 11 16:14 EKG0000000056.tif
drwxrwxr-x. 2 hci staff 4096 Apr 11 14:44 ftpbackup
drwxrwxr-x. 2 hci staff 6 Apr 11 14:44 image
drwxrwxr-x. 2 hci staff 4096 Apr 11 08:42 log
drwxrwxr-x. 2 hci staff 4096 Apr 11 14:44 tmp
-rw-r–r–. 1 hci staff 95538 Apr 6 08:03 WAV.DAT
and by exec’ing the uudecode command from the tcl command line and get a readable image:
[hci@cloverleaf-prd muse]$ tcl
tcl>exec uudecode -o tmp/EKG_DECODED_56.tif tmp/EKG0000000056.tmp
tcl>exec ls -l tmp
total 2672
-rw-rw-r–. 1 hci staff 267525 Apr 11 14:44 EKG0000000056.tmp
-rw-r–r–. 1 hci staff 191068 Apr 11 16:18 EKG_DECODED_56.tif
-rw-rw-r–. 1 hci staff 383464 Apr 11 14:44 EKG_WF1_0000000056.tif
-rw-rw-r–. 1 hci staff 0 Apr 11 14:44 EKG_WF2_0000000056.tif
I’m using one thread to receive the message via PDL-TCP/IP. I didn’t want to create another thread to use the FTP protocol or write an external script to move the files. I thought this would be a cleaner way to do it. Unless there is a way to receive and send on the same thread that I’m not familiar with (which could be entirely true 🙂 )
Charlie – Earlier posts contain echo’s of ZPD-3 and the waveform data after substitutions have been made.
I don’t believe there’s anything wrong with the wave form data. This is running successfully in 5.7. I just need to make it work in 6.2.
Here’s my recommendation on how to handle this: Do everything in memory. Don’t write out temp files. Don’t call the FTP package. After you decode the message with the Tcllib library (::uuencode::decode), call msgset to put the data in a message and route it to an outbound FTP thread. Just because you can do everything in one thread doesn’t mean that you should. By trying to do this in a script, you lose the retry features of the recovery database if your destination server is down.
In your code comment, you said that ::uuencode::decode “does not error, but does not create a readable image”. That’s probably because you aren’t dealing with binary data correctly. TCL is especially tricky because it tries to treat binary data as Unicode strings. My guess is that the decode is working correctly, but you’re writing to a file using end-of-line translation (because you haven’t used “wb” on the open flags or set the channel to binary with the fconfigure command), and it’s corrupting the data. But as I said above, I wouldn’t write to a file anyway. Just keep it in a message.
Another thing you have to watch out for is the encoding on your outbound FTP thread. The encoding on the properties tab should be “binary” and the Data Type on the FTP Options tab should be Image/Binary.
As an example, here’s some code that I use to handle an HL7 message with a Base64 encoded PDF.
45 run {
46 # ‘run’ mode always has a MSGID; fetch and process it
47
48 keylget args MSGID mh
49 package require hl7
50 package require base64
51 set msg [msgget $mh]
52
53 set driverctl [msgmetaget $mh DRIVERCTL]
54 set userdata [msgmetaget $mh USERDATA]
55 set mid [msgmetaget $mh MID]
56 set filename “eso_[keylget mid NUM].pdf”
57 keylset driverctl FILESET.OBFILE $filename
58 keylset driverctl FILESET.FTPOBDIR /opt2/cmaxftp
59 msgmetaset $mh DRIVERCTL $driverctl
60
61 set hl7 [hl7::parse_msg $msg]
62
63 keylset userdata MRN [hl7::get_field hl7 PID.3]
64 keylset userdata ACCT [hl7::get_field hl7 PID.18]
65 keylset userdata DOC_ID [hl7::get_field hl7 OBR.2]
66 keylset userdata DOC_TYPE [hl7::get_field hl7 OBR.4.1]
67
68 set msh_7 [hl7::get_field hl7 MSH.7]
69 set dt [string range $msh_7 0 7]
70 set tm [string range $msh_7 8 13]
71 set msh_7 [clock format [expr [clock scan “$dt $tm”]-3600] -format %Y%m%d%H%M%S] ;# convert from MST
72 keylset userdata ORIGIN_DT $msh_7
73 keylset userdata ACTIVITY_DT $msh_7
74
75 msgmetaset $mh USERDATA $userdata
76
77 msgset $mh [::base64::decode [hl7::get_field hl7 OBX.5.1]]
78 #msgdump $mh
79 lappend dispList “CONTINUE $mh”
80 }
Still no luck. I added this line to my tcl proc:
msgset $mh [::uuencode::decode $DecryptWF]
$DecryptWF is ZPD-3 with all the substitutions made. I also changed
lappend dispList “KILL $mh”
to
lappend dispList “CONTINUE $mh”
I created an outbound thread with PROTOCOL:fileset-ftp, Encoding: binary and on the FTP Options tab Data Type: Image/Binary.
I was a little confused what to set Style to on the Fileset Options tab. I tried single, nl, and eof. See uploaded PDF for screen shots of the configuration.
I”m sending this to a Windows (probably 2003 or 2008) Server in case that makes a difference.
Windows Photo Viewer says the picture “. . . appears to be damaged, corrupted, or is too large.” I am unable to edit the file in Paint or paint.net. Both indicate an error opening the file.
I’m guessing the hl7 Tcllib package is something you have developed in house?
Thanks so much for taking time to review all of this. I know it’s time consuming.
“Protocol Properties / Fileset Options / Outbound / Style” should be “single”.
You could also try putting the command “encoding system identity” right before your ::decode command, but I don’t know if that will help. Also, make sure you’re restarting your process (or doing a reload on the proc) after all TCL changes.
I’ll have to think about what else we can try.
I think I might have figured it out. I had to read the man page for uudecode. What a pain.
Try this:
msgset $mh [lindex [lindex [::uuencode::uudecode $DecryptWF] 0] 2]
It looks like the ::decode command can’t deal with the “begin 644” header. You have to use the ::uuencode::uudecode command or strip off the header yourself. Also, it looks like ::uudecode returns the data in a weird list format. That’s why I put the “lindex” commands in there. There might be a cleaner way, but I don’t feel like reading more documentation.
Hi David,
Still not having any luck. I was able to get my hands on a test HL7 message with the embedded tif. It’s attached. Maybe this will help.
Thanks,
Sandy
I don’t see the attachment.
We are upgrading from v6.0 to v6.2 and migrating from AIX to Linux. I have a tcl proc that used to work but no longer works in the new environment. The error:
[sms :sms :ERR /0: f_muse_rslt:04/14/2018 11:20:58] Tcl error:
[sms :sms :ERR /0: f_muse_rslt:–/–/—- –:–:–] msgId = message0
[sms :sms :ERR /0: f_muse_rslt:–/–/—- –:–:–] proc = ‘UICformatMusepdf’
[sms :sms :ERR /0: f_muse_rslt:–/–/—- –:–:–] args = ”
[sms :sms :ERR /0: f_muse_rslt:–/–/—- –:–:–] result = ‘uudecode: /tmp/muse/04003286920180414112058.uu: No `begin’ line’
[sms :sms :ERR /0: f_muse_rslt:–/–/—- –:–:–] errorInfo: ‘
[sms :sms :ERR /0: f_muse_rslt:–/–/—- –:–:–] uudecode: /tmp/muse/04003286920180414112058.uu: No `begin’ line
[sms :sms :ERR /0: f_muse_rslt:–/–/—- –:–:–] while executing
[sms :sms :ERR /0: f_muse_rslt:–/–/—- –:–:–] “exec uudecode -o ${path}${pdf_file} ${path}${encoded_file}”
[sms :sms :ERR /0: f_muse_rslt:–/–/—- –:–:–] (procedure “UICformatMusepdf” line 121)
When I ran the uudecode command from the tcl prompt, it works just fine and created the pdf file. But when it runs from within the tcl proc, the error comes up.
First let’s be clear that uuencode and uudecode is *NOT* Base64 so the base64 package will not work here/
uuencode has some very stringent rules. Look at the Wikipedia https://en.wikipedia.org/wiki/Uuencoding
You have not posted your file yet so we cannot look at it. One thing I note is mapping characters in the encoding message. Have you tried to uudecode it and then do that.
It is time to turn this over to the Support guys as a bug!
I created a simple tcl proc which receives a uuencoded ADT_A03 message and simply decodes it.
If I run the proc from the command line – hcitpstest -f eof adtencode cbb – it works fine and outputs an ADT_A03 message. However if I run the exact same thing through the engine using Fileset/local set for eof, I get the Error “No begin line”
I don’t understand what the proc is doing in the engine that is different from hcitpstest.
In the engine I wrote the contents of the msgget to a file. If I diff that file with the adtencode file, there is no difference. It makes no sence unless the exec is working different in the engine.
I have attached a copy of my simple script plus the test message if someone else wants to try. Two files in test.tar.
I used CL 6.2 on Linux for testing
uuencoded messages are meant for email. Can’t you get them to do a simple Base64?
From what I can see, its probably related to how Cloverleaf processes inbound/outbound data.
Have a look at the “identity” encoding: https://usspvlclovertch2.infor.com/viewtopic.php?t=6138
When a inbound message comes in and the inbound format is binary, Cloverleaf still uses encoding to convert the data.
The result is that any processing for binary data will be wrong.
It has to be converted to “identity” and then mapped back after processing.
When there is no manipulation of the binary data, cloverleaf will send it through ok, as it’ll map it back if both inbound/outbound are both binary.
Elisha:
As stated in my message above, I wrote the contents of the msgget to a file. I then compared that file to the inbound file. There was no difference. Therefore I do not believe the encoding to be a problem
Sandy:
Try this, albeit a bit convoluted it seems to work.
I was going under the assumption that the uudecode command was doing something weird in the engine so I decided to move the command.
First I wrote a very simple, 2 line, csh script and put it in $HCISITEDIR/scripts so there would be a path. Make sure the script is executable. I called mine decode.csh but name does not matter
#!/usr/bin/csh -f
uudecode -o /dev/stdout $1
My simple proc is like the below:
run {
# Message handle
keylget args MSGID mh
# Assume we are passed the entire file
set data [msgget $mh]
set fd [open tmpxx wb]
puts -nonewline $fd $data
close $fd
if {[catch {exec decode.csh tmpxx} msg]} {
echo nERROR executing uudecode $msg
echo To Error DBn
msgset $mh USERDATA “Error executing uudecode: $msg”
return “{ERROR $mh}”
}
msgset $mh $msg
file delete tmpxx
return “{CONTINUE $mh}”
}
I run this in the engine passing a uuencoded ADT_A03 message via Fileset/Local. I get the A03 message out with no errors. Like you, when I try to exec the uudecode command from the engine I get the error “No Begin Line”
Try it and let me know
Oops! Let’s try again.
I took Charlie’s code (and his C-shell script) and modified it slightly. The main difference is to read the data from ZPD-3.3, and I had to use “encoding system identity” before the system call to the script. This would not be necessary when using Tcllib uudecode (which is what I recommend).
The script works from the testing tool and from within the engine (version 6.2.1.0). I tested by routing to an outbound file thread and compared the file checksum with the testing tool version and the version produced by uudecode outside of the engine. The file looks fine with Windows Photo Viewer.
run {
# Message handle
keylget args MSGID mh
set dir $::HciSiteDir/exec/processes/david
# not the prettiest way to get the data, but it works
set zpd33 [lindex [split [lindex [split [lsearch -inline -regexp
[split [msgget $mh] r] ^ZPD] |] 3] ^] 2]
#echo zpd33 = $zpd33
set data [string map {\F\ |} $zpd33]
set data [string map {\S\ ^} $data]
set data [string map {\T\ &} $data]
set data [string map {\R\ ~} $data]
regsub -all {\X0A\} $data “n” data
regsub -all {\X0D\} $data “r” data
set data [string map {\E\ \} $data]
set fd [open $dir/tmpxx w]
puts -nonewline $fd $data
close $fd
echo current encoding is [encoding system]
echo switching to identity
encoding system identity
if {[catch {exec $dir/decode.csh $dir/tmpxx} msg]} {
echo nERROR executing uudecode $msg
echo To Error DBn
msgset $mh USERDATA “Error executing uudecode: $msg”
return “{ERROR $mh}”
}
msgset $mh $msg
file delete $dir/tmpxx
return “{CONTINUE $mh}”
}
It still needs to be reported as a bug – undocumented enhancement 🙂
Why can’t you exec uudecode from within a running engine?
If they need a test case just give them the little script and test message I sent.
Unfortunately, these suggestions still don’t work for me.
Here’s my shell script (bash not csh):
#!/usr/bin/bash -f
uudecode -o /dev/stdout $1
And my tcl script:
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
set path “/usr/integrator/prod/muse/tmp”
set zpd3 [lindex [split [lindex [split [lsearch -inline -regexp
[split [msgget $mh] r] ^ZPD] |] 3] ^] 2]
echo “ZPD-3:n$zpd3”
# Substitutions
set data [string map {\F\ |} $zpd3]
set data [string map {\S\ ^} $data]
set data [string map {\T\ &} $data]
set data [string map {\R\ ~} $data]
regsub -all {\X0A\} $data “n” data
regsub -all {\X0D\} $data “r” data
set data [string map {\E\ \} $data]
set fh [open $path/EKG_DECRYPTED.tmp w]
puts -nonewline $fh $data
close $fh
echo current encoding is [encoding system] Tried with and without these lines
encoding system identity <—/
if {[catch {exec decode.sh $path/EKG_DECRYPTED.tmp} msg]} {
echo nERROR executing uudecode $msg
echo To Error DBn
#msgset $mh USERDATA "Error executing uudecode: $msg" <—— This line gives me an error "expected integer but got "Error executing uudecode: uudecode: /usr/integrato"
return "{ERROR $mh}"
}
msgset $mh $msg
return "{CONTINUE $mh}"
#lappend dispList "CONTINUE $mh"
}
And here’s the error I get in the route tester and engine (still works in tps tester):
ERROR executing uudecode uudecode: /usr/integrator/prod/muse/tmp/EKG_DECRYPTED.tmp: No `begin’ line
Here’s the version of uudecode I have (in case that makes a difference):
[hci@cloverleaf-prd scripts]$ uudecode -v
uudecode (GNU sharutils) 4.13.3
I appreciate all the help and suggestions. I will open a ticket with support and report this as a bug. Until it’s resolved, I’ll take the uudecode processing outside the engine.
My $0.02
Cloverleaf 6.2 has Tcl interally support UTF-8 directly. Uudecode and uuencode should work with file only in ASCII.
uudecode: /usr/integrator/prod/muse/tmp/EKG0000000047.tmp: No `begin’ line
I guess
Tao, we tried binary and none. What is the difference between ASCII and UTF-8? I always thought on the system UTF-8 was ASCII. From the Tcl manual:
“The default encoding for newly opened channels is the same platform- and locale-dependent system encoding used for interfacing with the operating system, as returned by encoding system.”
From the Tcl comand line:
tcl>encoding system
utf-8
I did not try your method since I finally pulled my head out of my butt and remember, or was reminded by another post, that there is a uudecode command in the Tcllib package. It is great since it will encode or decode a string or a file. See:
https://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/modules/base64/uuencode.html
So, if I change my little proc to something like:
run {
# Message handle
keylget args MSGID mh
# Assume we are passed an entire uuencoded file
set data [msgget $mh]
package require uuencode
if {[catch {uuencode::uudecode $data} msg]} {
echo nERROR executing uudecode $msgan
msgset $mh USERADATA “ERROR executing uudecode $msg”
return “{ERROR $mh}”
}
msgset $mh $msg
return “{CONTINUE $mh}”
}
Note no need to read or write files. Works fine in the engine, no errors.
Sandy:
You should be able to change your code to fit this paradigm. No need for scripts or to read/write files. Should simplify things a lot.
Sorry it took so long but I am getting old 😀
I also tried the Tcllib uudecode, and you have to use uuencode::uudecode, not uuencode::decode (as I said in an earlier message). When I did it this way, I also had to do “msgset -binary” or the message would get corrupted. I can post this code if you’re interested. It’s my recommended solution.
I’m curious if making another change to Sandy’s code makes a difference. How about changing “regsub -all {\X0D\} $data “r” data” to “regsub -all {\X0D\} $data “” data”? Getting rid of the CR altogether may help because we’re using the Unix version of uudecode. You could also do this with fconfigure flags, but if you’re already doing a regsub then this is easier.
David:
I did not have to msgset -binary I guess because I was just inputting a uuencoded HL7 message. Perhaps you decoded a picture or something else that included binary data then this would be necessary.
My code snippet did use uuencode::uudecode, and not uuencode::decode.
My thanks to you, I think it was your post that jarred my feeble memory to think about Tcllib.
About the regsub, if changing all, I prefer string map. But to each his own.
All,
I’m still not able to get any of these suggestions to work within the engine. Infor support offered the exact same suggestion that Tao posted (is Tao with Infor?), but still no luck.
I’m beginning to think there may be something weird in my environment if everyone else is able to get these suggestions to work.
I’ve asked Infor for a WebEx so they can see it in my environment.
I’ll post once we find a resolution . . . or let you know I had to take the uudecode outside of the engine.
Thanks for all the work and research, especially David and Charlie!
David:
I did not have to msgset -binary I guess because I was just inputting a uuencoded HL7 message.
Sandy:
Did you get this to work? The whole thing irritated me so much I had to figure it out. I just now had the time to do it.
First of all the uuencode package that is part of Tcllib works just fine so no need to exec an external command. The kicker is when executing a command like:
set decoded [uuencode::uudecode $waveform]
The comand returns a list of lists. Since a file to be decoded can contain multiple records, the first list is a list of records decoded. Then each list contains a 3 part sublist. The first element is the filename, the second element is the mode and the third element contains the decoded value. So the above command, to extract the decoded waveform would look like:
set decoded [lindex [uuencode::uudecode $waveform] 0 2]
to return the decoded waveform. That variable could then be written to a file like wave.tifl and you have the waveform. When writing to the file it must be written as binary like:
set fd [open wave.tif wb] ;# Open file for write as binary
puts $fd $decoded
close $fd
You could also continue the decoded message on to another thread. As David said you must set the threads for binary encoding.
Another thing when you are mapping values prior to the decode:
/X0D//X0A/ is CRLF from Windows and the pair should be mapped to a newline (n) not individually to CR and NL.
I set up a Fileset/local IB with binary encoding and raw routing to an OB thread. I put the proc as an IB proc. The OB simply writes to a file. I ran it through the engine and was able to display the waveform from the OB file. No errors.
Trying to figure out your Tcl was a chore. I would suggest you learn to break it down to modules for ease of writing and maintaining. I am not a big fan of the HL7 library as each call requires the message to be parsed again.
I have enclosed a Tcl script which you could modify to add your extra requirements. I would think for recoverability you would be better served to send you file(s) to an OB thread and use the FTP protocol provided by Cloverleaf but that is up to you.
Take a look, let me know. It x’ed a square for me.
Charlie,
I appreciate your tenacity in trying to find a resolution for this. Unfortunately, the TCL uuencode::uudecode command returns nothing for me:
Please Wait ……
Command Issued: hcitpstest -r run -x ASCII -f nl -c sms_ib_data -e “hcitpstestshowbydisp ” /cloverleaf/cis6.2/integrator/clinical/data/MUSE_EKG_20180413141455.NL “tps_decodeMUSE”
Command output:
Wave form after uuencode::uudecode command:
Message should be here —><—
CONTINUE: ''
Granted, I didn’t take your entire script, but I did take your suggestion on the CR/LF substitution and changed the decoding command to:
set msg [uuencode::uudecode $data]
Sorry my code is so messy. It was originally written in the early 2000’s and has worked with subsequent upgrades, so it wasn’t a priority to streamline. We don’t seem to have any performance issues in 5.7. Also, I don’t have a formal programming education, so I typically just find what works and go with it. 🙂
Are you running 5.7? Weird!
I notice you ran this in the ASCII mode. Try binary.
If it works here it should work there. If you sre indeed running 5.7 that means an older version of Tcl
I will try it here
It’s currently working on 5.7. I’m trying to get it to work in 6.2
Also, binary is not an option in 6.2 TPS tester. I tried them all . . . no dice!
Sandy I’ve attached the script that we’re using to convert the uuencode to base64. If you turn the debug flag on it’ll write out the pdf file which you can view with adobe. Hope this helps.
I have run this on both Linux and Windows using Cloverleaf 6.2. If you use hcitpstest it will return a corrupted file on the output I suppose since it is trying to output UTF-8.
If you remove the comments in the script I sent you where it writes to a file called my.tif you will see a good waveform file. Also run it through the engine, it works.
You don’t have to always tie yourself to the GUI. Try it like:
hcitpstest -f eof MUSE_EKG_20180413141455.txt sandy
It will return a len10 encoded file tpsout.CONTINUE but as I said it is corrupted. Just look at the TIF written by the proc.
I can appreciate your lack of Tcl skills but if you really want to learn, as with any language, you should write all but simple code snippets in modules for ease of development. troubleshooting and maintenance. If you really feel the FTP should be done in this proc, it would be easy enough to add a module (subroutine) to do that.
Holy crap Charlie! I just took your “sandy.tcl” proc as is and ran it in the engine without making any changes. It created a readable TIF!
Now I have to pick it apart and see what I’m doing wrong in my code.
😳 😳 😳
So, for the uuencode::uudecode command, it comes down to transposing the CR/LF mapping:
set DecryptWF [string map {\X0A\\X0D\ “n”} $DecryptWF]
instead of
set DecryptWF [string map {\X0D\\X0A\ “n”} $DecryptWF]
I guess when I combined the separate lines into one, I used the X0A line and tacked on the X0D.
This creates a readable TIF file:
package require uuencode
set WaveForm [lindex [split [hl7_get_field $data ZPD 3] ^] 2]
# Reinsert HL7 delimiter characters according to MUSE specs
set DecryptWF [string map {\F\ |} $WaveForm]
set DecryptWF [string map {\S\ ^} $DecryptWF]
set DecryptWF [string map {\T\ &} $DecryptWF]
set DecryptWF [string map {\R\ ~} $DecryptWF]
set DecryptWF [string map {\E\ \} $DecryptWF]
set DecryptWF [string map {\X0D\\X0A\ “n”} $DecryptWF]
set decodeWF [lindex [uuencode::uudecode $DecryptWF] 0 2]
msgset $mh $decodeWF
return “{CONTINUE $mh}”
However, even with mapping the CR/LF properly, I still can’t exec uudecode from the engine. I’ll continue working with Infor on this.
I will probably move forward with using the uuencode package for this interface.
Many thanks to all who offered suggestions, especially David Barr and Charlie Bursell. These guys went above and beyond! This group is an awesome resource!
I ran into this issue going from 6.1 to 6.2. Our 6.1 is on AIX and our new 6.2 is back to Linux.
We have been using this process on our previous Linux servers and CLV versions. Only now have we run into it being an issue.
It seems everyone is spot on regarding it being an issue with 6.2. Hopefully it has been reported.
We had PDF we were decoding and oddly enough deals with the same contents as Sandy’s.
I used a good chunk of Charlie’s logic from the Sandy TCL and was able to get it to work. I did not need a lot off what Charlie supplied. However, I like some of his other code that I did not really need, but preferred after seeing what he did 🙂
For me all I had to do was change from using this:
exec uudecode [filename or data here]
to using the field with the data and:
package require uuencode
package require base64
set decodeWF [lindex [uuencode::uudecode $DeCryptWF] 0 2]
Thanks toa ll of you for reporting and looking into this!