reformatting x12 file for payer

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf reformatting x12 file for payer

  • Creator
    Topic
  • #47763
    Nora Katz
    Participant

    I am working on reformatting a x12 file for a payer using Cloverleaf and I have been able to make changes in information to individual lines in the file.  What I need to do now is copy 2 lines from the 2420A loop into the 2310B.  And, I have been able to do it for the first occurrance, but have not been able to make it loop and do it for the rest of the file.

    Does anyone have code that shows me how to do this?

    Thanks.

Viewing 4 reply threads
  • Author
    Replies
    • #56648
      Brian Davis
      Participant

      Nora,

      What transaction set are you working with? 834, 837, 835?

      You mentioned that you get this on the first occurance, but not the rest of the file. First occourance of what? First 2310A or 2420B?

      Not knowing how your Iterates are set up, I would try to iterate into the 2420A loop from within the 2310B loop. This way you will get every 2420A for each 2310B segment.

    • #56649
      Nora Katz
      Participant

      Brian,

      I’m working with 837.  The file that I am working with is missing the 2310B section.  (The file contains 2310A and 2310D).  2310B is the section I am trying to recreate by copying 2420A and inserting it into the area where 2310B should occur.  

      I am working the file thru a tcl procedure.  I wasn’t sure how to attack the problem.  I suppose I could read thru the file, and for every occurrance of 2420A, save the information in a list/array.  Then, I can read thru the file again, and for each occurrance of 2310D, I can insert the next item on the list/array just in front of thethe 2310D loop, and append the new file into another list.

      I’m more fluent in C++ than in Tcl, are there any advantages/disadvantages to using lists vs arrays?  Are Arrays in Tcl the same as in C++?

    • #56650
      Brian Davis
      Participant

      Nora,

      Since you are coding this in tcl, your solution may be easier. Remember, you are in contorol when you write records out to files.

      You build your 1000 loop and write it out. Build your 2000 loop and write it out. Build your 2300 loop and write it out. Build your 2310 loop and write it out. Here is where your hole is. Build your 2400, 2410, 2420 loops and hold them. Build your 2310 loop and write it out. Now write out the loops you had stored up.

      This is very simplistic, but I hope you can see my point.

    • #56651
      Bob Schmid
      Participant

      😯

      How is the loop number determined ????

    • #56652
      Charlie Bursell
      Participant

      It is determined by iterating over the number of loops

      X.12 in Tcl can be tricky since there can be loops within loops within loops, etc.,

      The best way to tackle it is to use namespaces and children of namespaces.

      A lot easier than back in the early days when I would do it with keyed lists sometimes nested 25 or more layers deep  🙁

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

Forum Statistics

Registered Users
5,127
Forums
28
Topics
9,299
Replies
34,443
Topic Tags
288
Empty Topic Tags
10