Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
No replies
Tom123123123
Tom123123123
1 Post
ACCEPTED ANSWER

Pinned topic HIPAA/X12 - Looping

‏2013-04-26T13:10:48Z |

For each CLM segment in my HIPAA X12/837 file, I'd like to be able to produce an output of 1 to many records.

I'd like to generate a record for each NM1 segment, in each 2000 Loop.

When I pass through this set of data, everything works fine:

HL*1**20*1
NM1*85*2*TEST HOSPITAL*****XX*1111111111
N3*123 TEST STREET
N4*JONES*IN*9999911111
REF*EI*999999999
HL*2*1*22*0
SBR*P*18*111111111******BL
NM1*IL*1*TEST*JOE*Y***MI*101010101
N3*12345 STREET
N4*MAGIC*IN*111111
DMG*D8*19900101*M
NM1*PR*2*MY PAYER*****PI*12345
N3*ED STREET*PO BOX 34567
N4*CITY*IL*12312
CLM*100500*40.8***85:A:1**A*Y*Y

I get 3 rows of data that have this output:

Row 1 = NM1 85 information + CLM01
Row 2 = NM1 IL information + CLM01
Row 3 = NM1 PR infomration + CLM01

That is what I want to see.  Each item being linked to the CLM01 informatoin.

My issue comes, when I have the "QC" segment in my file, which looks like this:

HL*1**20*1
NM1*85*2*TEST HOSPITAL*****XX*1111111111
N3*123 TEST STREET
N4*JONES*IN*9999911111
REF*EI*999999999
HL*2*1*22*0
SBR*P*18*111111111******BL
NM1*IL*1*TEST*JOE*Y***MI*101010101
NM1*PR*2*MY PAYER*****PI*12345
HL*3*2*23*0
PAT*01
NM1*QC*1*TEST*JANE*X
N3*600 SAMPLE
N4*CITY*IL*12312
DMG*D8*195611111*M
CLM*100500*40.8***85:A:1**A*Y*Y

When this happens, I'm still getting my rows of data, but now it looks like this:

Row 1 = NM1 85 information - CLM01 is not present
Row 2 = NM1 IL information - CLM01 is not present
Row 3 = NM1 PR information- CLM01 is not present
Row 4 = NM1 QC information + CLM01 is present

I want to get all four rows, but ensure the CLM01 is present on each row of output data.  Right now, when I get that "QC" segment, which comes out of another 2000 loop, the CLM information is not held on the earlier records.  So, records 1-3 are incomplete above, because they do not contain the "CLM01" information.

Any idea on how to hold that CLM information until I start processing the next CLM record, when the "QC" is present?