Reply To: Perl over SMAT – The search begins

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Perl over SMAT – The search begins Reply To: Perl over SMAT – The search begins

#58203
Richard Hart
Participant

    Hopefully, the attached is a copy of the Perl script smatList.sh

    The ouput is 1000 records per file that, at the time, was the maxmum number of message a thread would accept before a ‘timeout’ error.

    Here is an example function that we used within a copy of smatList.sh (for our LAB messages) to produce an index ..

    sub GetData {

      local($myMsg) =  @_;

      local(@myMsg) = split(‘^M’, $myMsg);

      local($myRet, @myField, $myMrn, $myAcct, $myAccession, $myName, $myDob, $myGender);

    #print STDERR “Msg @myMsgn”;

      $myAccession = ”;

      $gMsg = ”;

      for $mySeg (@myMsg) {

          if (substr($mySeg, 0, 3) eq ‘PID’) {

              @myField = split(/|/, $mySeg, 20);

              $myMrn = $myField[3];

              $myName = $myField[5];

              $myDob = $myField[7];

              $myGender = $myField[8];

              $myAcct = $myField[18];

              if(!defined($myAcct)) {

                  $myAcct = ”;

              }

          }

          if (substr($mySeg, 0, 3) eq ‘PV1’) {

              @myField = split(/|/, $mySeg, 21);

              if($myAcct eq ”) {

                  $myAcct = $myField[19];

              }

          }

          if (substr($mySeg, 0, 3) eq ‘OBR’) {

              @myField = split(/|/, $mySeg, 9);

              $myDate = $myField[7];

              if(!isLabGen($myAcct) && substr($myDate, 0, Cool lt ‘20050905’) {

                  @myField = split(‘^’, $myField[3], 2);

                  $myAccession = $myField[0];

                  $gMsg = “$myMrn,$myName,$myDob,$myGender,$myAcct,$myAccession,$myDate,”;

    #print STDERR “GetData [$myAccession] [$gMsg]n”;

              }

              last;

          }

      }

    #print STDERR “Ret $myRetn”;

      return $myAccession;

    }