Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all 4356 articles
Browse latest View live

RE: VC 2.1 to 2.3

$
0
0

We created support incident 2878817 for this and I was able to reproduce the problem in a small cutdown managed app so I created an RPI for this and sent to development.

There appears to be a problem with the compiler in 2.3 or higher where it is generating incorrect code when there is a constructor containing and open statement and a GO TO. This results in an exception being thrown when the constructor is called that the CLR detected an invalid program.

The cutdown code looks like:

      class-id Amends.

      INPUT-OUTPUT SECTION.

      FILE-CONTROL.

         select test-file assign to "testfile.dat".

      DATA DIVISION.

      FILE SECTION.

      fd test-file.

      01 test-record  pic x(20).

      WORKING-STORAGE SECTION.

      01  XREPLY                       PIC X.

      method-id NEW.

      procedure division.

      IN010.

          OPEN INPUT test-file.

          IF XREPLY = "X" GO TO IN010.

          goback.

      end method.

      end class.

If I comment out either the OPEN statement or the IF statement then the problem does not occur.

If I rewrite the code to use perform instead of GO TO then it also works.

IN010.

          perform until exit

               OPEN INPUT test-file

               IF not XREPLY = "X"

                   exit perform

               end-if

          end-perform

          goback.

I will keep you updated through the support incident.

Thanks.


RE: Calling Windows API from managed COBOL

$
0
0

You can still call Windows APis from managed code and you can still use TYPEDEFs such as WORD, DWORD etc but there is a problem when trying to use them as defined in windows.cpy which is not meant for use with managed code.

I defined the required typedefs directly in the program and was able to make the call that you reference in your post. You do have to load the appropriate Windows .dll containing the API call. Please see the recent post which discussed this topic here:

Example in managed code:

      $set ilpinvoke"kernel32"
       program-id.  testapi.
       environment division.
       special-names.
       call-convention 74 is WAPI.

       working-storage section.
       77 DWORD  pic 9(9) comp-5 typedef.
       77 USHORT pic 9(4) comp-5 typedef.
       77 WORD   pic 9(4) comp-5 typedef.
       77 #BYTE   pic 9(2) comp-5 typedef.
       01 VersionInfoEx.
          03 dwEVersionInfoSize        pic 9(9) comp-5.
          03 dwEMajorVersion           DWORD.
          03 dwEMinorVersion           DWORD.
          03 dwEBuildNumberFull.
             05 dwEBuildNumber         USHORT.
             05 dwEMajorAndMinor       USHORT.
          03 dwEPlatformId             DWORD.
          03 szECSDVersion             pic x(128).
          03 wEServicePackMajor        WORD.
          03 wEServicePackMinor        WORD.
          03 wESuiteMask               WORD.
          03 wEProduktType             #BYTE.
             88 ver-nt-workstation        value h"01".
             88 ver-nt-server             value h"02" h"03".
             88 ver-nt-domain-controller  value h"02".
          03 wEReserved                #BYTE.
       procedure division.
          set dwEVersionInfoSize to length of VersionInfoEx
          call WAPI "GetVersionExA" using VersionInfoEx
          goback.
           
       

RE: Calling Windows API from managed COBOL

$
0
0

Actually, the problem with the Windows.cpy is that it is using a few data-names that are now COBOL reserved words.

This can be remedied so that you can use Windows.cpy in managed code by removing these as reserved words using the remove directive.

The following example will allow you to use windows.cpy in your .NET programs:

      $set ilpinvoke"kernel32"
      $if ilgen set
      $set remove"byte"
      $set remove"event"
      $set remove"internal"
      $set  change-message"1202 N"
      $set  change-message"1207 N"
      $set  change-message"1122 N"
      $end
       copy "windows.cpy".
      $if ilgen set
      $set  change-message"1202 W"
      $set  change-message"1207 W"
      $set  change-message"1122 W"
      $end
       
       program-id.  testapi.
       environment division.
       special-names.
       call-convention 74 is WAPI.

       working-storage section.
       01 VersionInfoEx.
          03 dwEVersionInfoSize        pic 9(9) comp-5.
          03 dwEMajorVersion           DWORD.
          03 dwEMinorVersion           DWORD.
          03 dwEBuildNumberFull.
             05 dwEBuildNumber         USHORT.
             05 dwEMajorAndMinor       USHORT.
          03 dwEPlatformId             DWORD.
          03 szECSDVersion             pic x(128).
          03 wEServicePackMajor        WORD.
          03 wEServicePackMinor        WORD.
          03 wESuiteMask               WORD.
          03 wEProduktType             BYTE.
             88 ver-nt-workstation        value h"01".
             88 ver-nt-server             value h"02" h"03".
             88 ver-nt-domain-controller  value h"02".
          03 wEReserved                BYTE.
       procedure division.
          set dwEVersionInfoSize to length of VersionInfoEx
          call WAPI "GetVersionExA" using VersionInfoEx
          goback.
           
       

RE: Calling Windows API from managed COBOL

RE: Mapping events in COM object

$
0
0

Can you please clarify what you mean by COM here?

Is the C# class really registered as COM or is it a .NET class that is instantiated and invoked from within the managed COBOL class? How do you call into the C# class from managed COBOL?

Do you wish to handle the events fired in the C# class from within the managed COBOL piece which can then callback into native or do you wish to handle the events directly in native code?

You mention Dialog System. Are you still using Dialog System in your native application?

There are some examples in the Samples Browser under the Dialog System category that show how some of this functionality can be used. For example there is a demo that has a DS Window that hosts a .NET grid control and its events are trapped in the native control program using native OO syntax for using ActiveX control. One of the other examples shows how you can pass a native entry point to a managed class thru COM Interop and then call back into this entry point directly from managed code.

The following is an article from Microsoft that might also help.

support.microsoft.com/.../811645

Thanks,

RE: VC 2.1 to 2.3

VC 2.1 to 2.3

$
0
0

Hi

We are upgrading an application from Visual Cobol 2.1 on Windows XP to Visual Cobol 2.3 on Windows 10.  The application consists of windows forms projects and native code programs compiled as managed code.  We have been using VS 2010 Shell on Windows XP.  A couple of queries:

I installed VS 2015 Community on a new Windows 10 pc and registered for the 30 day trial of VC 2.3.  In the link sent back, Step 1 - Useful Download Details, states that there are two versions of Visual Cobol available to download, VC for VS 2012 and VC for VS 2013, yet under the Software/Licenses section at the bottom VC for VS 2015 is also available for download, so this is the one I chose.  Are the instructions on the link out of date?  I assume it was safe to download VC for VS 2015 if VS 2015 Community is installed?

The target framework for the VC 2.1 version of the app is either .NET framework 4 Client Profile for the windows forms projects, or .NET framework 4 for the non windows forms projects.  In VC 2.3 on Windows 10 should we be chaning the target framework toa more recent version, or is it safe to leave as is?  Is it better to use the latest version of the .NET framework.  I cretaed a new windows forms app on the Windows 10 pc and by default to target framework was set to 4.5.2.  All versions of .NET up to 4.6.1 are installed on this pc.

Thank you.

inherits from superclasse with data.

$
0
0

My superclasse have a FD, like this:

.

.

.

End class-object.

Object.
Input-Output Section.
File-Control.
SELECT arqSYSCONF ...

File Section.
FD arqSYSCONF ...

Object-Storage Section.
01 InstanceData pic x(032).

*/////////////////////////////////////////////////////////////

The FD causes a problem in InstanceData.

I move "ajSauro" to InstanceData and in the class that inherits superclasse, the value of InstanceData is an unexpected value.

If I remove SELECT and FD, then it is OK.

Anybody have a soluction to this?

Hug

Antonio João

NextExpress + Dialog System.


How to Convert Pdf to Base64 and Back to Pdf

$
0
0

[View:https://www.youtube.com/watch?v=DZQOG3RdTJ4:550:0]

RE: Mapping events in COM object

$
0
0

I read your answer, studied many various codes and try to make it by myself but I failed. So...

The problem is that I want to create the ribbon object instead of window menu and toolbar into my application windows created by Dialog-System. So as I mentioned in previous post I wrote a native COBOL class for my application that serves as an interface (here it's not meant as COM object interface!) between the application and my own COM object written in managed COBOL. So this native COBOL class calls methods in the managed COBOL COM object class and this COM class inherits from the C# class (the C# object is just a .NET class, not regularly registered COM) of the ribbon object. I don't know if it's the best way how to do it but the ribbon object is created correctly just as I want. So creation is ok. And here starts the problem because I don't know if or when to use delegates of events, how to join it with my "IInterfaceEvent" or if an event could be caught without the delegates etc. I certainly took a look at the examples you mentioned in the Samples Browser but I didn't find what I needed. May be I should mention that I cannot interfere into the already created Dialog-System screensets - everything must be processed outside these screensets. As for the question whether I want to handle the events within the managed COBOL code or directly outside into the native COBOL code, better way is the managed code. But I certainly want to learn both ways. While I was taking a look at the example with window hosting the grid control, I noticed that in the event interface were defined some numeric ID values for all the events and in the native code these IDs were used for mapping those events to entry-points using "SetEventToEntry" method. That's ok but I still don't understand how the delegates, the "Fire..." methods and the declarations in the event interface are connected and HOW IT WORKS. And finally, I don't want to use entry-points but methods and doesn't matter if overriden, using delegates etc.

Select Case

$
0
0

This works in Oraedit, but now I'm trying to add it to cobol (as embedded) and can't even get it to compile...  


    EXEC SQL
        SELECT case   
            when TO_CHAR(C.HOLLYDATE,'MM-DD-YYYY') =  
                 TO_CHAR(SYSDATE,'MM-DD-YYYY')
              and C.STARTTIME <= to_char(sysdate,'HH24:MI')     
                 and C.STOPTIME  >= to_char(sysdate,'HH24:MI')
               then  'TRUE'
               ELSE 'FALSE'
      END HOLIDAY
           from dual a, HOLIDAY C  
                where TO_CHAR(C.HOLLYDATE,'MM-DD-YYYY') =
                      TO_CHAR(SYSDATE,'MM-DD-YYYY')
     END-EXEC.   
    
2 cobch0803 000400 encountered the symbol "then" when expecting one of the following:

1 cobch0149 no sql directives have been set

RE: Select Case

$
0
0

What SQL precompiler are you using, OpenESQL or Pro*COBOL? This code is Oracle PL/SQL code and will not be recognized by OpenESQL as being valid. I am not sure if it is supported by Pro*COBOL but it isn't clear to me what this statement would be returning to your program as there are no host variables included in the statement.

RE: inherits from superclasse with data.

$
0
0

What version of Net Express are you using?

Can you please post a full example of what you mean including the class that inherits this class?

Thanks

RE: Connection Name Not Found - 19702

$
0
0

What does your CONNECT statement look like and what database are you connection to?

Are you stating that you connect successfully in a called subprogram and you can access the database fine but then when you do an exit program to return to the main program you get a -19702 error on another sql statement?

Do you cancel the subprogram after returning?

RE: Connecting to MySQL

$
0
0

Hi Linden,

I am glad that you found the video to be useful to you.

The default project type for native projects is x86 which is 32-bit. This means that the ODBC DSN that you need to use must also be 32-bit. You can create this using the ODBC Datasource Administrator (32-bit) which can be found under the start menu Micro Focus Visual COBOL->Data Tools-->Data Connections group.

The version of the ODBC driver that you use depends on the type of data you wish to access in your program, If you are storing data as Unicode characters, (2 byte characters) then you would need to use the Unicode version of the driver and access these fields using PIC N host variables. If you are using single byte ANSI characters (PC character set) only then you can use the ANSI driver and return the data into PIC X host variables.

For OpenESQL you are required to have an ODBC driver and your DSN installed on each workstation on which the application will be running.

There are a number of other videos in the same series as the ODBC one that you watched which cover various aspects of OpenESQL such as cursors, dynamic SQL, OpenESQL Assistant etc.


RE: Connecting to MySQL

$
0
0

Thanks Chris for your full answer as always. Regards, Linden

RE: CellEndEdit event.

$
0
0

the parameters are the object that raised the event (default is sender) and the data passed from that even (default is e)

your function call should look like invoke myGrid_CellEndEdit(sender, e).

RE: use a c sharp class in visual cobol

$
0
0

the error is COBCH0845 can't find the namespace....

RE: Creating reports? - got any good ideas?

$
0
0

Noting better then list&label from combit, www.combit.net

Listings, cards, labels, charts, barcode, and many more

I can give you a demonstration or you can download a trial version by combit

My programm to integrate this tool is written in cobol, working wifhout problem with all visual cobol versions

RE: Creating reports? - got any good ideas?

$
0
0

Thank you for your suggestion greiner.

Viewing all 4356 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>