Locate offending "type mismatch" variable when running a script

Is there an easy to find the offending variable producing a "type mismatch" error when a script is run?

There's not a "way" to do this, but there is a way of looking at things that could make it easier. What I would do is to make a variable for EVERY piece of data in your script where you think the problem might be and use the debugger to see the data types associated with the error. For example, instead of:
Call uidoc.FieldSetText( "fname", otherDoc.otherField(0) )

Do this:

VarTemp = otherDoc.otherField(0)
Call uidoc.FieldSetText( "fname", VarTemp )

When you do that, you could step through the debugger and view the variables to see what DataType is assigned to VarTemp. Then you know if it is not text that is where your error is. If the error is on assignment to a variable and you have "option declare" or "option explicit" in place, then use a temporary variant variable to determine the data type that you were trying to stuff into the variable.

I hope this helps you.

This was first published in November 2001

Dig Deeper on Domino Resources - Part 7

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:




  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...