Question
· Oct 27, 2017

Recordmap within a BPL

I have a text file that is fixed width delimited and am using a BPL to process this file, ultimately performing a transform from the text file to an HL7 message. I created a DTL, mapping from the recordmap to the HL7. In my BPL, I am performing some loops and other logic (that all is working). My issue is what to do when I perform the Transform.

I thought I could just call the transform and pass in the string as the source and a HL7 Message as the target. This results in an OREF error. I assume because the processing of the text file to the recordmap is not occurring. I assume I have to perform this processing in a code block of the BPL, but do not know how to do this. Does anyone have any ideas?

I tried calling the PutRecord method of my recordmap class, passing in a stream containing my text, but that did not work. "set context.Stream1 = ##class(User.DBI1J601).PutRecord(context.Stream)"

I don't really know where to start and hope someone out there does.

Discussion (1)0
Log in or sign up to continue

First, make sure you are reading the file through a Recordmap service, this will parse the file correctly into the recordmap.  Second,  are you processing the file as one record at a time or as an entire file (batch).  If as a batch then you need to declare a batch class in the record mapper and read the file utilizing a recordmap batch service.

Inside of the BPL, in the context area change the class of the request to be either the recordmap record class, or the recordmap batch class, depending on which you are using.

As for the Transformation, the source is now declared to be either the recordmap record class or the recordmap batch class, the target is then the HL7, and you pass in the "request" as the source and a context HL7 message class variable as the target.