Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#212 Provide a way to direct object coercion

v3.1
closed
Mark Miesfeld
5
2012-08-14
2006-12-01
Anonymous
No

I am trying to pass an object as a parameter to to a method. It is a required parameter for the method, but my be "Nothing" in VB-speak. Passing .Nil gives error 92.909 One or more of the parameters could not be coerced. I should be able to cast .Nil to any object type when the interpreter cannot decide correctly. Directed Coercion.

I am using Rexx 3.1.1, built Nov 17 2006, on WinXP.

ref: http://publib.boulder.ibm.com/infocenter/cicsuc/v6r0m0/topic/com.ibm.cicsuc600.doc/ccllao0262.htm
"If you are not going to use a UOW, you must explicitly set it to 'Nothing' in VBScript."

Note from Mark Miesfeld:

~~~

Phil wrote:

This is the code I'm trying to change

~~
connect = .OLEObject~New("Ccl.Connect")
flow = .OLEObject~New("Ccl.Flow")
buffer = .OLEObject~New("Ccl.Buffer")
uow = .OLEObject~New("Ccl.Uow")
...
connect~Link(flow, "FOO", buffer, uow)
~~

This should work with .Nil as the uow, I think, but gets the 92.909
error:

connect~Link(flow, "FOO", buffer, .Nil)

or is there a way to force coercion, i.e. cast?

I'm working with the ooRexx .OLEObject implementation and will look
into this, this weekend.

As you probably know, the .OLEObject attempts to convert ooRexx objects
to the correct OLE type. It uses a "best guess" type of algorithm. A
current problem with the implementation is that, sometimes the guess is
wrong, but there is no way for the ooRexx programmer to override the
guess.

I have a fix for that problem and am currently testing it. Essentially
this would be your "way to force coercion." This fix, however, only
works if the ooRexx programmer knows what the OLE type is suppossed to
be. Normally the ooRexx programmer would know from documentation for
the OLE object she is trying to work with. If the programmer doesn't
know what the OLE type of the parameter is suppossed to be, then he
will be reduced to guessing. But, at least the programmer can tell
ooRexx to use his guess rather than the guess from the algorithm.

Anyhow, the best thing to do would be to go to the ooRexx project on
SourceForge and open a bug for this problem. I am actively working on
open .OLEObject bugs in the ooRexx project and if you open a bug I can
guarentee that it will get attention. Especially if you detail well
exactly what you are doing.

https://sourceforge.net/projects/oorexx

Go to the tracker section, then the bugs section.

--
Mark Miesfeld

Discussion

  • Mark Miesfeld
    Mark Miesfeld
    2006-12-01

    Logged In: YES
    user_id=191588
    Originator: NO

    Phil,

    That was quick. <grin>

    A couple of things.

    1.) Would you update this bug and assign it to miesfeld.

    2.) I see from a google search that you are working with a CICS client. This will make it hard for me to work with, to see if I can figure out what is happening, as I don't have that COM object. Would you e-mail me at: miesfeld@acm.org so we can work on this directly.

    3.) Have you tried not passing .nil and just passing the created UOW object?

    connect = .OLEObject~New("Ccl.Connect")
    flow = .OLEObject~New("Ccl.Flow")
    buffer = .OLEObject~New("Ccl.Buffer")
    uow = .OLEObject~New("Ccl.Uow")
    connect~Link(flow, "FOO", buffer, uow)

    I am curious as to whether that will work, and if it does, is there a reason why you can't do it that way?

    4.) If the UOW object is truely optional, it might work to just not pass anything. (I'm not hopeful on that, but you should at least try it.)

    connect = .OLEObject~New("Ccl.Connect")
    flow = .OLEObject~New("Ccl.Flow")
    buffer = .OLEObject~New("Ccl.Buffer")

    connect~Link(flow, "FOO", buffer)

    Thanks.

     


  • 2006-12-01

    Logged In: YES
    user_id=34378
    Originator: NO

    1) Since I entered the bug without signing on first, I'm not sure I can reassign it. :( At least I don't see how.
    2) I will email you.
    3) Yes, it does work with a valid UOW object. The presence/absence of the UOW changes the behavior of the host and I need to do it both ways depending on the situation.
    4) Skipping the parameter does not work, error 92.910 A required parameter was omitted.

     
  • Mark Miesfeld
    Mark Miesfeld
    2007-03-18

    Logged In: YES
    user_id=191588
    Originator: NO

    This is fixed by the addition of the OLEVariant class to the Windows OLE support in the svn commit / revision 166.

    Phil tested the preliminary version of this class and verified to me that it fixed his problem.

     


Anonymous


Cancel   Add attachments