if Pos(Campo[z],'_')<>0 Then
You are searching for the occurrence of a char ( Campo[z] is a char ), in another char ( '_' is a char too; yes it could be treated as a string, but probably is treaded as char).
the error is probably, because pos expects a string as 2nd arg. Maybe a case for the fpc mailing list. Maybe it can be added to the rtl?
Anyway, in your case:
if Campo[z] = '_' Then