hcidbdump delete multiple records(not a range)

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf hcidbdump delete multiple records(not a range)

  • Creator
    Topic
  • #49867
    Cesario Perez
    Participant

      I am trying to use the hcidbdump -r -m -D command where I need to delete by multiple message ids and not a sequential range, in one statement. And/or delete records for a destination thread that may contain a string value of ex: “BADTABLE” in the message context. Any ideas?

    Viewing 13 reply threads
    • Author
      Replies
      • #63936
        Todd Lundstedt
        Participant

          If you know the MIDs, you can loop through them..

          AIX ksh…

          for i in list of MIDs; do hcidbdump -r -D -m $i ; done

        • #63937
          Cesario Perez
          Participant

            Todd, I tried that and that is better than what I was doing. How about a shot at the other situation where I want to delete all records which contain a selected string value in the hl7 message? Come on dude.. you are on a roll.

          • #63938
            Cesario Perez
            Participant

              Todd I forgot to say Thanks Alot!!

            • #63939
              Russ Ross
              Participant

                I’m dealing with an on-call issue and waiting so I did a test to pass the time and give you some direction hopefully and learn something usefull myself.

                In my test I pulled all the message IDs for all the A04 messages in the recovery data base.

                Just switch A04 with what you want to search for.

                I also created temp# files with each step so you can get a feel for what is being done along the way and can check the files to gain confidence.

                Here is my quicky KSH script I called rkr_search_db.ksh

                Code:

                #!/usr/bin/ksh

                myString=”A04″

                rm -f temp*

                hcidbdump -r -L | egrep “msgMid|$myString” >temp1

                cat temp1
                   | perl -pi -e ‘s/^.*msgMid/nmsgMid/g’
                   | perl -pi -e ‘s/]n/] /g’
                   >temp2

                cat temp2 | egrep “msgMid.*message” >temp3

                cat temp3 | awk ‘{print $3}’ >temp4

                cat temp4

                For some reason when I copied/pasted this into a script and ran it I found out clovertech is still having issues.

                I discovered clovertech web page is adding an extra artifical blank space to the end of every line.

                Go ahead and highlight something to copy and you will see every line has an extra space artifically added to the end of each line.

                hcihd helped me figure this out when I copied/pasted the script straight from clovertech and it would not work until I got rid of the extra space at the end of each line as follows

                perl -pi -e ‘s/ n/n/g’ my_script.ksh

                Unfortunately, that is a problem with copying code from clovertech so be sure to get rid of the extra space off the end of each line of code.

                Russ Ross
                RussRoss318@gmail.com

              • #63940
                Cesario Perez
                Participant

                  Mr. Ross,

                  This code is heading right on target of what I am looking for. I have ran it by editing by message trigger P03 and by a patient name which I know exists in some of the recovery records. This code definitely locates the records I need. Ultimately this code will be replaced by including the -D parameter for the deletion of records. I am receiving the error below… but as expected I know i have to troubleshoot this. Thanks alot.

                  cat: 0652-050 Cannot open  .

                  /hci/data/scripts/hcidbdumpstring.ksh[10]: 0403-057 Syntax error at line 10 : `|’ is not expected.

                • #63941
                  Cesario Perez
                  Participant

                    Russ,

                    I guess I did not really identify a space insert at the end of each line when I entered hcihd . So out of curiousity I entered .. perl -pi -e ‘s/ n/n/g’ my_script.ksh and reran the script and I got much better results. Sorry about claiming further work on the code… my bad.

                  • #63942
                    Todd Lundstedt
                    Participant

                      Cesario,

                      I would not recommend just including the -D, as that will delete all recovery messages.  You will need to add an addtional hcidbdump command, similar to the for-loop I suggested, using that tempfile as input to the list of MIDs.

                      Also, use caution with your search string.  If you are looking for patients by name (SMITH^JOHN), you will get records with doctors, or guarantors, or whatever named John Smith, too.  I highly recommend you create a TCL or some other script that identifies the msgID of a message where the contents of a specific field match the string you are searching for.

                    • #63943
                      Cesario Perez
                      Participant

                        Todd,

                        I agree that I would probably use the temp3 and temp4 files for validation and conditional deletion of records. I came up with a need for this when testing systems seems to mess up with alot of undesired or “messed” up records pending to be sent to a system If I ever used something like this production I would 100% sure of having a very unique id method. If anything in prod that I have ever seen a need for like this would be by ex: patient id. or message type or a definte error string like “BADTABLEREAD”. I sure appreciate everyones ideas and concerns.

                      • #63944
                        Rob Abbott
                        Keymaster

                          Russ Ross wrote:


                          For some reason when I copied/pasted this into a script and ran it I found out clovertech is still having issues.

                          I discovered clovertech web page is adding an extra artifical blank space to the end of every line.

                          *snip*

                          Unfortunately, that is a problem with copying code from clovertech so be sure to get rid of the extra space off the end of each line of code.

                          Russ, I’m not sure what you’re doing, but I’m unable to reproduce this.

                          I’ve pasted code here that I copied from a PuTTY session on a unix machine:

                          Code:

                          riscy:[505]~> cat test.txt
                          line one
                          line two
                          line three
                          riscy:[506]~>

                          I don’t see any extra lines as I do in the code you provided.  Perhaps something is going on with your terminal emulator or your copy/paste method?

                          If this is a huge problem for you, you can always attach your code as a file.

                          Rob Abbott
                          Cloverleaf Emeritus

                        • #63945
                          Russ Ross
                          Participant

                            Rob:

                            Thanks for investigating because this is a problem at least for me and Cesario.

                            This may have been happening all along and it did not show up for me until I used the line continuation character

                            Russ Ross
                            RussRoss318@gmail.com

                          • #63946
                            Rob Abbott
                            Keymaster

                              I see what you mean Russ.  My apologies, I read you incorrectly; I was seeing extra linebreaks not an extra space at end of line.  Not sure what we can do about that but I’ll investigate.

                              Rob Abbott
                              Cloverleaf Emeritus

                            • #63947
                              Rob Abbott
                              Keymaster

                                I think I’ve squashed this bug, please let me know if things look OK.

                                Rob Abbott
                                Cloverleaf Emeritus

                              • #63948
                                Russ Ross
                                Participant

                                  Test posting my script to see if copy/paste no longer adds extra space to each line of code

                                  Code:

                                  #!/usr/bin/ksh

                                  myString=”A04″

                                  rm -f temp*

                                  hcidbdump -r -L | egrep “msgMid|$myString” >temp1

                                  cat temp1
                                     | perl -pi -e ‘s/^.*msgMid/nmsgMid/g’
                                     | perl -pi -e ‘s/]n/] /g’
                                     >temp2

                                  cat temp2 | egrep “msgMid.*message” >temp3

                                  cat temp3 | awk ‘{print $3}’ >temp4

                                  cat temp4

                                  Russ Ross
                                  RussRoss318@gmail.com

                                • #63949
                                  Russ Ross
                                  Participant

                                    Rob:

                                    I was now able to copy/paste from clovertech without having an extra space artifically added to the end of each line.

                                    Now the script ran as is without having to massage it after doing a copy/paste from clovertech.

                                    I was even able to copy/paste the original post successfully, which indicates your fix worked for previously existing post, too.

                                    Thanks for fixing this behavior.

                                    Russ Ross
                                    RussRoss318@gmail.com

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