There is no way you can say that the Count() function is causing the problem.
Element 1 of STAGECOM.ARR contains InLink.TheString (by now a variable named Pin%%V0S1P1.Column%%5); this is moved into register #11 (named $R11) for the Count() function. The value of the stage variable svCRLF (by now a variable named V0S1.Stagevar%%22) is mapped into the second element of STAGECOM.ARR and is moved into register #12 (named $R12) for the Count() function. $R11 and $R12 are used as the arguments to the Count() function, the result of which is loaded into register #13 (named $R13) which is subsequently used in the Ereplace() function.
To answer the original question, if the additional CRLF is at the end of the data then you can simply return a shorter string:
Code: Select all
Left(InLink.TheString, Len(InLink.TheString-2))
This is unrelated to "invalid data type"; this usually arises from invalid use of file or subroutine variables. You would need to post the entire VLIST report for us to comment further.
BTW the expression Field(OCONV(DATE(), "D4-YMD[4,2,2]") : " " : OCONV(TIME(), "MTS:") : ".000", ".", 1, 1) is doing too much work. There is no "." in the first argument of the Field() function. Oconv(Date(),"D-YMD[4,2,2]") : " " : Oconv(Time(), "MTS:") would suffice. If you require the date and time to be unchanging, prefer @DATE to Date() and @TIME to Time() and, for maximum efficiency, calculate it once only, in initializing a stage variable, perhaps called svNowAsTimestamp.