There is no straight forward way of doing this in Xlate that I know of unless you want to implement some really convoluted XPM code. It would be easy in a Tcl Preproc like:
This assumes you are checking the second subfield of the second iteration. Feel free to modify if my assumptions are wrong
run {
# Get message
set mh [keylget args MSGID]
set msg [msgget $mh]
# Field separators
set fldSep [string index $msg 3] ;# Normally |
set subSep [string index $msg 4] ;# Normally ^
set iterSep [string index $msg 5] ;# Normally ~
# Segments
set segList [split $msg r]
# Need location to change
set pidLoc [lsearch -regexp $segList {^PID}]
# PID fields
set PID [split [lindex $segList $pidLoc] $fldSep]
# Field 3 split into iterations
set fld3 [split [lindex $PID 3] $iterSep]
# PID.3.2 split into subfields
set fld3_2 [split [lindex $fld3 1] $subSep]
# Check for V in PID.3.2.2
# If not there we are done just send the message on
if {[lindex $fld3_2 1] ne “V”} { return “{CONTINUE $mh}” }
# If here delete second iteration and modify PID
lvarpop fld3 1
set PID [lreplace $PID 3 3 [join $fld3 $iterSep]]
set segList [lreplace $segList $pidLoc $pidLoc [join $PID $fldSep]]
msgset $mh [join $segList r]
# Send it on
return “{CONTINUE $mh}”
}