Reply To: Generating NTE segments based on the value of OBX|3

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Generating NTE segments based on the value of OBX|3 Reply To: Generating NTE segments based on the value of OBX|3

#57745
Rentian Huang
Participant

It takes a few tests for me to figure out some tricky errors. try this code, it works on my testing tool.

Hope this works on yours.

Sam   8)

Code:



ITERATE: OBX  %g1
IF: IF OBX-3 eq “FT”

CALL:
Source:
$%g1
1(0).1(0).1(%g1).OBX.00573
Destination:
@null

# Generate a new NTE segment with NTE|3 copied over from OBX|5.
# Also, generate multilpe NTE segments if OBX|5 has a character
# length of > 80 (inbound system has a limit of 80 characters for NTE|3 field).

set var [lindex $xlateInVals 0]
set OBX5 [lindex $xlateInVals 1]

set addr {1(0).1(0).1(group).NTE(count).00098}
regsub group $addr $var addr

if {[string length $OBX5] > 80} {
set pos 0; set cnt 0
while {$pos < [string length $OBX5]} { regsub count $addr $cnt addr xpmstore $xlateId $addr c [string range $OBX5 $pos [expr $pos + 79]] regsub "NTE..." $addr {NTE(count)} addr incr pos 80; incr cnt } } elseif {[string length $OBX5] > 0} {
regsub count $addr 0 addr
xpmstore $xlateId $addr c $OBX5
}

Forum Statistics

Registered Users
5,115
Forums
28
Topics
9,291
Replies
34,426
Topic Tags
286
Empty Topic Tags
10