SMAT Reader

  • Creator
    Topic
  • #47702
    garry r fisher
    Participant

    Hi,

    I won’t bother you with the details but I needed to edit every transaction matching a pattern in a SMAT file before I could resend.

    This little utility uses the .idx to parse the .msg file and write the data to a simple text file. Its liberally commented so hopefully you should be able to make sense of it.

    Any suggestions email me on garry.fisher/at/isoftplc/dot/com

    regards

    Garry

Viewing 4 reply threads
  • Author
    Replies
    • #56488
      David Harrison
      Participant

      Garry,

      That’s handy. I’ve modified it to extract the timestamp to append to each message. Is there a neat way in tcl to convert epoch time (unix) to standard date and time also allowing for daylight saving?

      Dave

    • #56489
      Charlie Bursell
      Participant

      clock format

    • #56490
      Charlie Bursell
      Participant

      Just a tip.  There are many unique and useful utilities that you can write that use the SMAT files.  You just need to be aware of the format of the files.

      The .idx file contains lists of keyed lists.  Therefore it can best be read using the lgets command.  The lgets command will read a whole list at a time.  Since the list is just one element, to access it as a keyed list, simply remove it from the list context.  For example, consider a SMAT file with name of foo.idx:

      set fd [open foo.idx]     ;# Default mode is read only

      while {[lgets $fd klist] >= 0}  {

           set klist [lindex $klist 0]    ;# Remove from list format

           echo [keylkeys klist]

           # Add you own code here

      }

      The echo would yield:

      MID SRCMID TYPE SOURCECONN ORIGSOURCECONN DESTCONN ORIGDESTCONN TIME PRIORITY DATAFMT SAVECONTEXT OFFSET LENGTH

      For example to read the associated .msg file, just move to [keylget klist OFFSET] and read [keylget klist LENGTH] bytes.

      You can get any other data you want from the .idx file by using keyed list commands.  You could also set up searches, etc.  Its left to your own needs and imagination.  After all that’s why you get paid the big bucks  ðŸ˜›

      Hope this helps

      Charlie

    • #56491
      garry r fisher
      Participant

      Hi Charlie,

      Thanks for this. I knew it was a keyed list but I only wanted a specific field so I simply did a search.

      I’ll modify my script to use an lget as another example for the hordes to use:-)

      Garry

    • #56492
      garry r fisher
      Participant

      Hi,

      As promised a version of my SMAT reader that uses the keyed list commands.

      I’ve also used the .htc extension so that it runs in the hci environment.

      Regards

      Garry

Viewing 4 reply threads
  • The forum ‘Tcl Library’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,127
Forums
28
Topics
9,299
Replies
34,443
Topic Tags
288
Empty Topic Tags
10