Skip to main content

Hi,

Can I call a managed VB dll from Cobol Net Express?  If so, how?

Here is a sample of how playet, a VB 6 dll, would be called by NE Cobol:

$SET OOCTRL( P)                                                         
 
  identification division.                                                
                                                                          
      program-id.   CALLPLAY.                                             
        
  environment division.                                                   
  class-control.                                                          
      playet is class "$OLE$playet.clsLocation".                    
  configuration section.                                                  
  special-names.                                                          
      call-convention 8 is llnk.                                          
     
  data division.                                                          
  working-storage section.                                                
                                                                          
                                                      
  01 work-area.                                                           
     05  playserver       object reference.                               
                                                                          
  linkage section.                                                        
  01 crm-linkage.                                                         
     05  crm-street-address1          pic x(30).                          
     05  crm-CITY                     pic x(20).                          
     05  crm-state                    pic x(02).                          
     05  crm-zipcode                  pic x(05).                          
     05  crm-Result                   pic x(01).                          
 
  procedure division using reference crm-linkage.                         
 
  mainline.                                           
                          
                                                                          
       invoke playserver "inBounds" using crm-street-address1             
                                          crm-city                        
                                          crm-state                       
                                          crm-zipcode                     
                                          crm-result.                     
 *destroy an instance of playet, i.e. playserver                       
         invoke playserver "Finalize" returning playserver.               
       
  finalization.                                                  
                                                                       
     exit program.     

Hi,

Can I call a managed VB dll from Cobol Net Express?  If so, how?

Here is a sample of how playet, a VB 6 dll, would be called by NE Cobol:

$SET OOCTRL( P)                                                         
 
  identification division.                                                
                                                                          
      program-id.   CALLPLAY.                                             
        
  environment division.                                                   
  class-control.                                                          
      playet is class "$OLE$playet.clsLocation".                    
  configuration section.                                                  
  special-names.                                                          
      call-convention 8 is llnk.                                          
     
  data division.                                                          
  working-storage section.                                                
                                                                          
                                                      
  01 work-area.                                                           
     05  playserver       object reference.                               
                                                                          
  linkage section.                                                        
  01 crm-linkage.                                                         
     05  crm-street-address1          pic x(30).                          
     05  crm-CITY                     pic x(20).                          
     05  crm-state                    pic x(02).                          
     05  crm-zipcode                  pic x(05).                          
     05  crm-Result                   pic x(01).                          
 
  procedure division using reference crm-linkage.                         
 
  mainline.                                           
                          
                                                                          
       invoke playserver "inBounds" using crm-street-address1             
                                          crm-city                        
                                          crm-state                       
                                          crm-zipcode                     
                                          crm-result.                     
 *destroy an instance of playet, i.e. playserver                       
         invoke playserver "Finalize" returning playserver.               
       
  finalization.                                                  
                                                                       
     exit program.     

 double post


Hi,

Can I call a managed VB dll from Cobol Net Express?  If so, how?

Here is a sample of how playet, a VB 6 dll, would be called by NE Cobol:

$SET OOCTRL( P)                                                         
 
  identification division.                                                
                                                                          
      program-id.   CALLPLAY.                                             
        
  environment division.                                                   
  class-control.                                                          
      playet is class "$OLE$playet.clsLocation".                    
  configuration section.                                                  
  special-names.                                                          
      call-convention 8 is llnk.                                          
     
  data division.                                                          
  working-storage section.                                                
                                                                          
                                                      
  01 work-area.                                                           
     05  playserver       object reference.                               
                                                                          
  linkage section.                                                        
  01 crm-linkage.                                                         
     05  crm-street-address1          pic x(30).                          
     05  crm-CITY                     pic x(20).                          
     05  crm-state                    pic x(02).                          
     05  crm-zipcode                  pic x(05).                          
     05  crm-Result                   pic x(01).                          
 
  procedure division using reference crm-linkage.                         
 
  mainline.                                           
                          
                                                                          
       invoke playserver "inBounds" using crm-street-address1             
                                          crm-city                        
                                          crm-state                       
                                          crm-zipcode                     
                                          crm-result.                     
 *destroy an instance of playet, i.e. playserver                       
         invoke playserver "Finalize" returning playserver.               
       
  finalization.                                                  
                                                                       
     exit program.     

Do you get the other parameters back correctly?

What is the definition of crm-result in COBOL?

Thanks,


Hi,

Can I call a managed VB dll from Cobol Net Express?  If so, how?

Here is a sample of how playet, a VB 6 dll, would be called by NE Cobol:

$SET OOCTRL( P)                                                         
 
  identification division.                                                
                                                                          
      program-id.   CALLPLAY.                                             
        
  environment division.                                                   
  class-control.                                                          
      playet is class "$OLE$playet.clsLocation".                    
  configuration section.                                                  
  special-names.                                                          
      call-convention 8 is llnk.                                          
     
  data division.                                                          
  working-storage section.                                                
                                                                          
                                                      
  01 work-area.                                                           
     05  playserver       object reference.                               
                                                                          
  linkage section.                                                        
  01 crm-linkage.                                                         
     05  crm-street-address1          pic x(30).                          
     05  crm-CITY                     pic x(20).                          
     05  crm-state                    pic x(02).                          
     05  crm-zipcode                  pic x(05).                          
     05  crm-Result                   pic x(01).                          
 
  procedure division using reference crm-linkage.                         
 
  mainline.                                           
                          
                                                                          
       invoke playserver "inBounds" using crm-street-address1             
                                          crm-city                        
                                          crm-state                       
                                          crm-zipcode                     
                                          crm-result.                     
 *destroy an instance of playet, i.e. playserver                       
         invoke playserver "Finalize" returning playserver.               
       
  finalization.                                                  
                                                                       
     exit program.     

Not sure what the problem is now, but when I call the com routine (after instantiating it), I get 105 memory allocation error.  I have never gotten this before.


Hi,

Can I call a managed VB dll from Cobol Net Express?  If so, how?

Here is a sample of how playet, a VB 6 dll, would be called by NE Cobol:

$SET OOCTRL( P)                                                         
 
  identification division.                                                
                                                                          
      program-id.   CALLPLAY.                                             
        
  environment division.                                                   
  class-control.                                                          
      playet is class "$OLE$playet.clsLocation".                    
  configuration section.                                                  
  special-names.                                                          
      call-convention 8 is llnk.                                          
     
  data division.                                                          
  working-storage section.                                                
                                                                          
                                                      
  01 work-area.                                                           
     05  playserver       object reference.                               
                                                                          
  linkage section.                                                        
  01 crm-linkage.                                                         
     05  crm-street-address1          pic x(30).                          
     05  crm-CITY                     pic x(20).                          
     05  crm-state                    pic x(02).                          
     05  crm-zipcode                  pic x(05).                          
     05  crm-Result                   pic x(01).                          
 
  procedure division using reference crm-linkage.                         
 
  mainline.                                           
                          
                                                                          
       invoke playserver "inBounds" using crm-street-address1             
                                          crm-city                        
                                          crm-state                       
                                          crm-zipcode                     
                                          crm-result.                     
 *destroy an instance of playet, i.e. playserver                       
         invoke playserver "Finalize" returning playserver.               
       
  finalization.                                                  
                                                                       
     exit program.     

Never mind the 'memory alloc' issue.  I figured that out.  The other parms all come back correctly.  I put an 'X' in the crm-result and it comes back blank.  It is defined in as  05  crm-Result                   pic x(01).  


Hi,

Can I call a managed VB dll from Cobol Net Express?  If so, how?

Here is a sample of how playet, a VB 6 dll, would be called by NE Cobol:

$SET OOCTRL( P)                                                         
 
  identification division.                                                
                                                                          
      program-id.   CALLPLAY.                                             
        
  environment division.                                                   
  class-control.                                                          
      playet is class "$OLE$playet.clsLocation".                    
  configuration section.                                                  
  special-names.                                                          
      call-convention 8 is llnk.                                          
     
  data division.                                                          
  working-storage section.                                                
                                                                          
                                                      
  01 work-area.                                                           
     05  playserver       object reference.                               
                                                                          
  linkage section.                                                        
  01 crm-linkage.                                                         
     05  crm-street-address1          pic x(30).                          
     05  crm-CITY                     pic x(20).                          
     05  crm-state                    pic x(02).                          
     05  crm-zipcode                  pic x(05).                          
     05  crm-Result                   pic x(01).                          
 
  procedure division using reference crm-linkage.                         
 
  mainline.                                           
                          
                                                                          
       invoke playserver "inBounds" using crm-street-address1             
                                          crm-city                        
                                          crm-state                       
                                          crm-zipcode                     
                                          crm-result.                     
 *destroy an instance of playet, i.e. playserver                       
         invoke playserver "Finalize" returning playserver.               
       
  finalization.                                                  
                                                                       
     exit program.     

Fran,

This problem would be best handled by creating a support incident with Customer Care. You can put my name in the description and I will handle it.

If you could provide us with an actual example that we can test with we should be able to solve this problem quickly...

The VB program would not have to actually do anything other than receive the parameters, modify the parameters and then return to COBOL.

Thanks.


Hi,

Can I call a managed VB dll from Cobol Net Express?  If so, how?

Here is a sample of how playet, a VB 6 dll, would be called by NE Cobol:

$SET OOCTRL( P)                                                         
 
  identification division.                                                
                                                                          
      program-id.   CALLPLAY.                                             
        
  environment division.                                                   
  class-control.                                                          
      playet is class "$OLE$playet.clsLocation".                    
  configuration section.                                                  
  special-names.                                                          
      call-convention 8 is llnk.                                          
     
  data division.                                                          
  working-storage section.                                                
                                                                          
                                                      
  01 work-area.                                                           
     05  playserver       object reference.                               
                                                                          
  linkage section.                                                        
  01 crm-linkage.                                                         
     05  crm-street-address1          pic x(30).                          
     05  crm-CITY                     pic x(20).                          
     05  crm-state                    pic x(02).                          
     05  crm-zipcode                  pic x(05).                          
     05  crm-Result                   pic x(01).                          
 
  procedure division using reference crm-linkage.                         
 
  mainline.                                           
                          
                                                                          
       invoke playserver "inBounds" using crm-street-address1             
                                          crm-city                        
                                          crm-state                       
                                          crm-zipcode                     
                                          crm-result.                     
 *destroy an instance of playet, i.e. playserver                       
         invoke playserver "Finalize" returning playserver.               
       
  finalization.                                                  
                                                                       
     exit program.     

Just wanted to update the status of this problem as now being resolved.

The problem appeared to be in the VB.NET code but customer wasn't sure how to debug it.

The steps to debugging a managed VB.NET .DLL that is being called as a COM server from a Net Express native program is as follows:

--------------

In your NX application place an accept statement or if you already have a user interface on it then that will work also.

You just need to be able to run the client and have it wait so that we can attach a debugger to it.

Then run the NX client until it is waiting.

Start Visual Studio with your VB.NET project open.

Place a breakpoint in your VB code.

From Visual Studio debug menu select attach to process.

Make sure the debugger type is set to managed code for the .NET framework version of your VB application.

Scroll down the list of processes until you see the name of the NX program and then select it.

Go back to the NX client and continue processing until it calls the VB.

At this point you will be debugging the VB code in Visual Studio.


Hi,

Can I call a managed VB dll from Cobol Net Express?  If so, how?

Here is a sample of how playet, a VB 6 dll, would be called by NE Cobol:

$SET OOCTRL( P)                                                         
 
  identification division.                                                
                                                                          
      program-id.   CALLPLAY.                                             
        
  environment division.                                                   
  class-control.                                                          
      playet is class "$OLE$playet.clsLocation".                    
  configuration section.                                                  
  special-names.                                                          
      call-convention 8 is llnk.                                          
     
  data division.                                                          
  working-storage section.                                                
                                                                          
                                                      
  01 work-area.                                                           
     05  playserver       object reference.                               
                                                                          
  linkage section.                                                        
  01 crm-linkage.                                                         
     05  crm-street-address1          pic x(30).                          
     05  crm-CITY                     pic x(20).                          
     05  crm-state                    pic x(02).                          
     05  crm-zipcode                  pic x(05).                          
     05  crm-Result                   pic x(01).                          
 
  procedure division using reference crm-linkage.                         
 
  mainline.                                           
                          
                                                                          
       invoke playserver "inBounds" using crm-street-address1             
                                          crm-city                        
                                          crm-state                       
                                          crm-zipcode                     
                                          crm-result.                     
 *destroy an instance of playet, i.e. playserver                       
         invoke playserver "Finalize" returning playserver.               
       
  finalization.                                                  
                                                                       
     exit program.     

Hi Frand,

please send me a Mail... to Bernd.riemke@riemke-it.de

I can help you...