I added to the FIL to detect the major word to see if it was PIERCE. Previously it was ignoring what the major word was and just seeing if there was an ON in the scalar value. Below is the good code in case anyone cares.
Thanks for the help guys.
$$ this routine will start the ROUTER PROCESS ENABLE G58
CIMFIL/ON,PIERCE
T4TH=POSTF(7,4)
CASE/T4TH
WHEN/ICODEF(ON) $$ Always want to turn pierce on when told to
INSERT/'M58$'
WHEN/ICODEF(OFF)
RSLT=POSTF(14) $$ Read the next command line to see if it turns pierce back on
RSLT=POSTF(20) $$ Save this read cL record
T5TH=POSTF(7,4)
T6TH=POSTF(7,3)
IF(T6TH.EQ.ICODEF(PIERCE)) THEN
IF(T5TH.EQ.ICODEF(ON)) THEN
$$INSERT/'DETECTED REPEAT$'
ELSE
$$INSERT/'NO REPEAT DETECTED$'
INSERT/'M59$'
RSLT=POSTF(21)
RSLT=POSTF(13)
ENDIF
ELSE
$$INSERT/'NO PIERCE$'
INSERT/'M59$'
RSLT=POSTF(21)
RSLT=POSTF(13)
ENDIF
ENDCAS
CIMFIL/OFF