Parsing SMAT files

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Parsing SMAT files

  • Creator
    Topic
  • #52344
    Jerry Tilsley
    Participant

      All,

      We used to use CIS 5.5 Rev 2 and have some utilities written that could parse the smat files by looking for the MSH at the beginning of the lines.  But a month ago we moved to a new server with CIS5.8 in production, but never did test our tools with that version since I never had the need to parse the files in test.  Now I am finding that the meta data being included in the smat files is killiing my tools.  Any suggestions on how to overlook the meta data in the smat files?

      Thanks,

      Jerry

    Viewing 4 reply threads
    • Author
      Replies
      • #73875
        Scott Folley
        Participant

          With any of the SMAT files, a tool from the command line would really want to look at the index file as I suspect you are aware since that is where the addition of the message metadata is.

          Try this on for size:

          Code:


          #!/quovadx/cis5.8/integrator/bin/hcitcl

          set indexData [ read_file smatfile.idx ]

          set testmessage [ lindex $indexData 0 ]
          foreach value [ keylkeys testmessage ] {
             puts “value:$value”
          }

          That will give you a good starting point for getting at the data in the index file.  As you can see, you need to treat it as a list of keyed lists with special attention to the OFFSET key and the LENGTH key because those tell you the starting point and the length of the data for that message within the message file.

        • #73876
          Jerry Tilsley
          Participant

            Ok, so I did get this to work with TCL which is great so problem is solved.  Only issue I have to figure out now is how to convert this same idea over C# since some tools I have are coded in that, but that is outside the scope here.  Thanks for the help though, it has me point in the correct direction.

          • #73877
            James Cobane
            Participant

              Along this thread, I have a utility that I created and use (smat_to_nl, which I’ve attached).  The one issue I run into with 5.8 is I get the error (below) when I try to use the msgmapdata option (i.e. to convert EBCDIC to ASCII).  This is the same type of error I would get on a thread until I specifed the Encoding type of ‘binary’.  My question is what additionally do I need to do now when using the msgmapdata command under 5.8?

              Error msg sequence error (max?)

                 while executing

              “msgmapdata $mh $tablename”

                 (“while” body line 12)

                 invoked from within

              “while { [lgets $infileidxID line] >= 0 } {

                             lassign $line line

                             keylget line OFFSET recoffset

                             keylget line LENGTH reclength

                             seek $infilemsgID $r…”

                 (file “/qvdx/cis5.8/integrator/usercmds/smat_to_nl” line 60)

              Any info is appreciated.

              Thanks,

              Jim Cobane

              Henry Ford Health

            • #73878
              Scott Folley
              Participant

                I may be wrong because I don’t really use the msgmapdata command but the reference says that you need to use the adddatamap command to create the data map initially.  If you have recently converted from an older version maybe that data map is not available.

              • #73879
                James Cobane
                Participant

                  The data map is there, as it is used on several threads that connect with some Mainframes, so that isn’t the issue.  But, I tackled this from a different angle and used some of the ‘encoding’ functionality within Tcl and got it working.  I’ve attached the updated version.

                  Thanks,

                  Jim Cobane

                  Henry Ford Health

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