Greetings,
Jim,
We have built one X12 270/271 Eligibility interface running under CIS5.4.1 Rev2 on AIX5.2. Per our X12 expert who used to teach this stuff X12 is a standard that is enforced (!) unlike HL7 where (in my opinion) the only standard is how you spell HL7. Ok… opinion aside…
As far as I know you need the ISA/GS/…GE/IEA envelope which the canned Cloverleaf package X12lib expects. The ISA and GS segments are placed in Metadata field USERDATA so that you may perform routing/translation work on the ST sets. Later on there is a join step which wraps the ST with the envelope and creates the GE and IEA using the values from the ISA and GS (not much in these segments).
So… your envelope hits a pre xlate tcl proc; you translate each ST; then the whole kit and kaboodle is put back together again at post xlate.
Sample pre-xlate logic:
# load X12lib package
package require X12lib
#
# X12lib returns one msg handle per transaction (ST/SE)
# we should only get one ST/SE per inbound msg, but
# this can handle many, just in case
# The ISA, IEA, GS, GE segments are saved in USERDATA.
#
foreach STmh [X12lib::splitX12 $mh ST] {
lappend dispList “CONTINUE $STmh”
} ;# end of foreach STmh
#
# since this is the last transaction, add a SEQ key
# in USERDATA that will indicate this is the last
# transaction in the batch
set userdata [msgmetaget $STmh USERDATA]
keylset userdata SEQ END
msgmetaset $STmh USERDATA $userdata
# kill the original inbound message
lappend dispList “KILL $mh”
Sample post X12 xlate logic:
# load the X12lib package
package require X12lib
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
# get sepchars from metadata
set sepchars [msgmetaget $mh SEPCHARS]
keylget sepchars SEGMENT segsep
# append transaction to tmp buffer
lappend buffer [msgget $mh]
#
# extract USERDATA metadata and look for the SEQ key
# if it exists, this is the last transaction in the set
# so rebuild it with X12lib::joinX12
# this is just in case a provider sends more then one
# transaction per batch
#
set seq “”
set userdata [msgmetaget $mh USERDATA]
keylget userdata SEQ seq
if {[string equal $seq END]} {
msgset $mh [join $buffer $segsep]
X12lib::joinX12 $mh
set buffer “”
} else {
return “{KILL $mh}”
}
lappend dispList “CONTINUE $mh”
}
Sample metadata:
msgSepChars : {FIELD “x2a”} {COMPONENT “x5e”} {SEGMENT “x7e”}
msgNumRetries : 0
msgGroupId : 0
msgDriverControl :
msgRecordFormat :
msgRoutes :
msgUserData : {ISA {ISA 00 { } 00 { } ZZ {999999 } ZZ {999999 } 080109 0805 U 00401 000938820 0 P ^}} {GS {GS HS 999999 999999 20080109 0805 938820 X 004010X092A1}} {SEQ END} {SENTFORPOST 1199887553}
Note: key=SENTFORPOST is my doing; not X12 split/join.
Note: values all 9s to mask our entity code and that of payer.
I hope that this helps you out as I am also much of a novice myself in the X12 universe. We did contract help from Quovadx to get this sucker up and running.
Enjoy.