Hi All,

I am trying to call 2 subroutines using the same session in UniObject .NET but 
have an issue when the second subroutine Inserts a larger common block.

I call the first subroutine without any issues. But when I call the second 
subroutine I get the following error.

[IBM U2][UODOTNET - UNICLIENT][ErrorCode=30105] Unable to load the subroutine 
on the server

I only have this issue in .NET and not in VB6.
I believe that the .net UniSession is storing the Common Block variables and 
when I try to call another subroutine with a different common block it fails to 
load.

I have read in another post on the web that people have created a Common Block 
loading subroutine to load all Common Blocks when they create the session.
This way when ever they call any subroutine they know the common block does not 
increase.

This seems a like a hack to me.

I am worried that when ever a developer creates a new Common Block that they 
have to remember to update the Common Block loading Subroutine.
Also we have thousands of Subroutines that may or may not include some common 
blocks.
If a subroutine has the same variable name as a variable used in common block 
it does not insert will its value change.

The other hack is to close and open the session every time I want to call a 
subroutine.
But once again this is not suitable for my application.


Here is my common blocks in universe
--------------------- BP AH.COMMON1 -----------------------------------
    COMMON AHCOMMON1
--------------------------------------------------------------------------------

--------------------- BP AH.COMMON2 -----------------------------------
   COMMON AHCOMMON2
--------------------------------------------------------------------------------

Here are my two subroutines.
--------------------- BP SR.AHTEST.CALL1 ---------------------------------
      SUBROUTINE SR.AHTEST.CALL1
      $INSERT AH.COMMON1
      RETURN
END
--------------------------------------------------------------------------------

--------------------- BP SR.AHTEST.CALL2 ---------------------------------
      SUBROUTINE SR.AHTEST.CALL2
      $INSERT AH.COMMON1
      $INSERT AH.COMMON2
      RETURN
END
--------------------------------------------------------------------------------

Here is the C# .net code
--------------------- C# .NET ------------------------------------------------
            UniSession ahsession = UniObjects.OpenSession("HOST", "USERNAME", 
"PASSWORD", "ACCOUNT", "uvcs");


            UniSubroutine ahsub1 = 
ahsession.CreateUniSubroutine("SR.AHTEST.CALL1", 0);
            ahsub1.Call(); // No Error on this call

            UniSubroutine ahsub2 = 
ahsession.CreateUniSubroutine("SR.AHTEST.CALL2", 0);
            try
            {
                ahsub2.Call(); // Throws and exception 
            }
            catch (UniSubroutineException ex)
            {
                MessageBox.Show(ex.Message); //Displays [ErrorCode=30105] 
Unable to load the subroutine on the server

            }
            MessageBox.Show("Done");
--------------------------------------------------------------------------------

If I write the same code in VB6 using the UniObject for VB6 I get no errors
--------------------- C# .NET ------------------------------------------------

    Dim objSession As Object
    Set objSession = CreateObject("UniObjects.unioaifctrl")
    objSession.UserName = "USERNAME"
    objSession.Password = "PASSWORD"
    objSession.AccountPath = "ACCOUNT"
    objSession.HostName = "HOST"
     objSession.Connect
        
    Dim ahsub1 As Object
    Set ahsub1 = objSession.Subroutine("SR.AHTEST.CALL1", 0)
    ahsub1.Call
 
    Dim ahsub2 As Object
    Set ahsub2 = objSession.Subroutine("SR.AHTEST.CALL2", 0)
    ahsub2.Call
 
    MsgBox ("Done")
--------------------------------------------------------------------------------



Adrian Halid
Senior Analyst/Programmer
 
IT Vision Australia Pty Ltd (ABN: 34 309 336 904)
PO Box 881, Canning Bridge WA 6153
Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153
P:  (08) 9315 7000      F:  (08) 9315 7088
E:  adrian.ha...@itvision.com.au        W: http://www.itvision.com.au
    
___________________________________________________________  
                          
NOTICE : This e-mail and any attachments are intended for the addressee(s) only 
and may
contain confidential or privileged material. Any unauthorised review, use, 
alteration,
disclosure or distribution of this e-mail (including any attachments) by an 
unintended recipient
is prohibited. If you are not the intended recipient please contact the sender 
as soon as
possible by return e-mail and then delete both messages.
___________________________________________________________

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to