VRL File Header

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf VRL File Header

  • Creator
    Topic
  • #54378
    santiago guzman
    Participant

      How can I add a header to a VRL file. In other words I will be converting ADT messages into a VRL file and the file will be picked up every day at a certain time. But when a new file is created I always want it to start with a header, which list the name of the fields. For example:

      ADT_EVENT_ID|PATIENT_EPISODE_ID|MBR_PATIENT_ID|ADT_DTTM|POST_DTTM|PATIENT_ADT_EVENT_TYPE|TRNSFR_FROM_UNIT_ID|TRNSFR_TO_UNIT_ID|ROOM_BED_NEW|ROOM_BED_OLD|PATIENT_TYPE|PATIENT_TYPE_OLD|FACILITY_ID|

      00010|000990083206|0000000440628508|2014-08-18 00:15:00|2014-08-18 00:24:44|A||LABR|235A01||INPATIENT|INPATIENT|500|

      00011|000990047433|0000000441418487|2014-08-18 00:24:00|2014-08-18 00:25:04|T|9STH|9STH|912S01|952S02|INPATIENT|INPATIENT|500|

      03587|000990082216|0000000441450891|2014-08-18 12:48:00|2014-08-18 12:48:38|D|SSU|||SSU107|OUTPATIENT|OUTPATIENT|500|

      Can some one please help me set this up. Thanks in advance.

    Viewing 7 reply threads
    • Author
      Replies
      • #81227
        Robert Kersemakers
        Participant

          I have never done this myself, but I can think of a few ways to do this.

          Easiest would be to first output your original file (without header) to a temporary location. Then a few minutes before the daily pick-up, get the file in the temporary location, stick the header in front of it with a simple tcl and output the resulting file to where it should be picked up.

          Another way would be to write your own upoc. The upoc, when getting a message, will first check if there already is a file there. If not, then first output the header, followed by the message into the (new) file.

          If so, then only output/add the message to the existing file.

          Hope this gives you an idea of how to do it.

          Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

        • #81228
          Robert Kersemakers
          Participant

            Now I’m looking at the same problem and don’t find my own suggestions very helpful. What goes around…

            Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

          • #81229
            Jim Kosloskey
            Participant

              Depending on the requirements here is one way I have done something like this:

              – place a file in the directory where the message file will go which has the headers. Give the file a name which is unique. Also give the file properties which constrain who can delete it.

              – Have a Fileset/Local thread with a DirParse routine which assures the header file is first in the list.

              – In the File Deletion UPOC have a proc which assures the header file is NOT deleted.

              The Fileset/Local thread picking up the file(s) will scan the directory finding the header file and any other files. The DirParse routine will make sure the data in the header file is read first thus it will be processed first. The File Deletion proc will make sure the header file is there the next time.

              You can even check in the DirParse to make sure the header file is there and throw and error, etc. if it is not (although I would stack DirParse procs and each would be reusable).

              I am sure there are more ways to do this.

              email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

            • #81230
              Charlie Bursell
              Participant

                Easy enough.  Do it with UPoC protocol.  Set up as both read and write using same proc.

                In the write mode simply append to file each time.  Before append check to see if file exists.  If not copy a template file to file name being used before append.

                In read mode which is kicked off with a timer.  Move file to location where it will be picked up.

              • #81231
                Charlie Bursell
                Participant

                  Great minds think alike Jim  ðŸ˜€   The whole thing can be done in a UPoC protocol with a single proc using both read and write mode rather than a dirParse proc.    I thought this was for output?  DirParse for input

                • #81232
                  Jim Kosloskey
                  Participant

                    Charlie,

                    The solution I used is an old one (I think before UPOC protocol) and requires some additional threads.

                    IB thread –> Xlate — OB Thread (Fileset/Local to directory where header file already exists and is protected).

                    IB thread (Fileset/Local) picks up the files (including Header File) from the OB thread above. This is where the DirParse and File Delete Procs would be

                    –> OB thread (combined file Header and detail).

                    I also used an HRL with a system which had very low record count and small sized messages. Where the Header was the first VRL in the HRL and a repeating VRL for the detail. Not really practical for large files and/or large message sizes

                    email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                  • #81233
                    Charlie Bursell
                    Participant

                      Whatever works but seems like a lot for what could be done in a simple UPoC driver in about 10 lines of code  ðŸ˜€

                      We have had UPoC protocol since way back.

                    • #81234
                      Robert Kersemakers
                      Participant

                        Hi Jim/Charlie,

                        Thanks for the very useful suggestions. Am building as we speak. Much appreciated!

                        Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

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