HLR to input a csv file

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf HLR to input a csv file

  • Creator
    Topic
  • #50189
    John Hervatin
    Participant

      I have an input .csv file called AB.csv with this content:

         10,1,2

         10,4,8

      I want to convert this to an output .csv file that would combine information from the two input records, like this:

         1,2,4,8

      To do that, I tried the following:

      A VRL called AB.vrl with the following fields (all fields with their default values; and with the default Global Properties) :

         Type

         A

         B

      An HRL called AB.hrl

         { AB: AB.vrl } While AB.Type = 10

              Type

              A

              B

      A VRL called AB12.vrl for the output

         A1

         A2

         B1

         B2

      An Xlate called AB_to_AB12.xlt that uses AB.hrl as the input format and AB12.vrl as output, and a single Copy instruction with the assignments:

         AB(0).A –> A1

         AB(1).A –> A2

         AB(0).B –> B1

         AB(1).B –> B2

      The four fields in the output record would then be expected to be  1,2,4,8

      But the XLT test gives this with

    Viewing 5 reply threads
    • Author
      Replies
      • #65143
        Jim Kosloskey
        Participant

          John,

          I have never tried what you are describing but what happens if in the Xlate you use 4 copies, one for each field and each iteration of that field?

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

        • #65144
          John Hamilton
          Participant

            When you pull up HRL to define it.

            Go to the options-> global.  

            It will bring up a series of options to define you fields and records.

            Mess with that and the testing tool using the HRL testing tab  before you do your translation. At least that is where this issue has gotten me before.  

            Let me know I have some other idea but I think this is where you need to go.

          • #65145

            How are you reading in the file? fileset:Local? In the NetConfig there under protocol properties, there is an option called “Style”. This allows you to specify how Cloverleaf reads in the file. For example, you can read the file in one line at a time (nl) which creates one message per line or you can read in the file all at once (single) which creates one message containing the entire file. Take a look at those options; they may help you out.

            -- Max Drown (Infor)

          • #65146
            John Hervatin
            Participant

              Thank you for your replies so far.

              Jim:  I believe my Xlate already does what you asked me to do.  It performs the following copies:

                AB(0).A –> A1

                AB(1).A –> A2

                AB(0).B –> B1

                AB(1).B –> B2

              So, if the input file has

                 10,1,2

                 10,4,8

              I expect

                AB(0).A = 1

                AB(1).A = 4

                AB(0).B = 2

                AB(1).B = 8

              In the HRL Test, with the “EOF Terminated” option, I get

              Please Wait ……

              Command Issued: hcihrltest -a  -d 1 -f eof ABnl.hrl /hci/qdx5.5/integrator/editest/data/AB.csv

              Command output:

              MESSAGE 1

              Field Number:          1

              Field Name:             AB

              — Begin VRL Segment AB —  

              Length of Repeat Field:         16

              Repeat Field Offset from Field: 0

              Type: ch >10<   A: ch >1<   B: ch >2<0xa>10< —- End VRL Segment AB —-  

              So, Cloverleaf doesn’t know that the 0xa following the 2 terminates that field.

              Now, is 0xa the new line character??  I tried configuring the HRL with Global Properties Termination = n, but with the same HRL test output.

              What exactly does Cloverleaf see when reading this file?  How could one find out?

              I suspect that the file consists of this string:

                 10,1.2<0xa>10,4,8<0xa>

              Or is 0xa the value of r ?

              Max, I intend to use the Fileset:Local / single configuration, but that does not come into play in the XLT test

            • #65147
              John Hamilton
              Participant

                For you properties setting try “x0a”.

              • #65148
                John Hervatin
                Participant

                  Thank you, John.  At first I thought you made a typo with your “x0a” because the testing tool displayed that character as “0xa”.  When I changed my VRL with that assumption, there was no change.  But when I tried “x0a” as the Termination character in the Global Properties, it resolved my problem.

                  The HRL test now gives:

                  Please Wait ……

                  Command Issued: hcihrltest -a  -d 1 -f eof ABr.hrl /hci/qdx5.5/integrator/editest/data/AB.csv

                  Command output:

                  MESSAGE 1

                  Field Number:          1

                  Field Name:             AB

                  — Begin VRL Segment AB(0) —  

                  Length of Repeat Field:         7

                  Repeat Field Offset from Field: 0

                  Type: ch >10<   A: ch >1<   B: ch >2< —- End VRL Segment AB(0) —-   — Begin VRL Segment AB(1) —   Length of Repeat Field:         7 Repeat Field Offset from Field: 7 Type: ch >10<   A: ch >4<   B: ch >8<

                  and the XLT test gives:

                  Please Wait ……

                  Command Issued: hcixlttest -d 1 -f eof AB_to_1234.xlt /hci/qdx5.5/integrator/editest/data/AB.csv

                  Command output:

                  MESSAGE 1

                  A1: ch >1< A2: ch >4< B1: ch >2< B2: ch >8<

                  Thanks for your help!

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