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

RE: Monitoring a folder

$
0
0

So you wish to have this functionality in a Windows Forms project is that correct? If you want this monitoring to be done in the background you will have to make this multithreaded by creating Worker thread, etc.

I could probably whip up a sample here that started the monitor thread and ran it until a button on the form was clicked. Is that what you are looking for?


RE: Consuming WCF in NAtive Code via Managed Code in Visual COBOL

$
0
0

Hi Chris,

I did the same what you suggested in the Managed Program which is instantiating & calling the WCF service.

Now i am getting the Error as "Cannot Register the Assembly ..\\ConsoleApplication2.dll. Synchronized Method in Value Type".

Please let me know where i am making the mistake.

Thanks

Charan

Consuming WCF in NAtive Code via Managed Code in Visual COBOL

$
0
0

Hi Chris,

The objective is to Consume the WCF Created in .NET 4.5 in Visual COBOL.(In Native Code VIA Managed Code)

To Do this I have followed following Steps:

1. Created an Managed Project in Visual COBOL, Added the Service Reference of .NET WCF. 

2. Selected the Property of Managed project as "Register for COM Interop". I am getting couple of Warning for the same. (Type Library exporter warning Generic Code may not exported to COM.)

3. Created an managed program to create an object of WCF Client Class and call the WCF methods.

3. Created an Native Project and added a Native Program.

4. Provide the Class Control section to point to the OLE object created by Managed Project.

5. Tried to Invoke the Managed Program of Managed Project from Native Program.

I am able to reach to the Managed Program (getting a display from there) But when managed program tries to call the WCF method , I am getting following error " Could not find the default endpoint element that references the contract "IService1". in the service model Client Configuration Section.

this might be because no configuration file was found for your application , or because no endpoint element matching this contract could be found in the client element".

Hope you are able to understand the problem, Let me know if you require any additional info. 

Let us know what can be possible problem in this approach.

Regards,

Charan

RE: Consuming WCF in NAtive Code via Managed Code in Visual COBOL

$
0
0

Not all assemblies can be registered for COM Interop. You must ensure that only COM compatible types are being passed in and out of the interface. I would suggest that you make your COM layer simple so it just accepts parameters calls the WCF service and then returns simple type parameters to the caller.

What does your ConsoleApplication2.cbl program look like?

RE: PDF printing very slow

$
0
0

When you are comparing the Net Express compiled program to the Visual COBOL compiled program are you running on the same computer? I am just wondering if the difference in speed is actually caused by moving to Visual COBOL or by moving to a new computer or OS?

If you can provide a demo program that works under Net Express but runs slowly under VC for the same code then please open up a support incident with Customer Care so that we can test the behavior and try to find a resolution for you.

What version of Visual COBOL are you running?

This is compiled as native code in Visual COBOL as well correct?

Thanks.

PDF printing very slow

$
0
0

Hi all,

Hope all is well.

I just have a query about printing to pdf. 

Basically, we moved from Net Express to Visual Studio 2010 a short while ago. Some of our programs stayed as native code. One of these prints to an Adobe pdf file using Courier New font but with mixed font sizes. The program worked fine in Net Express but is terribly slow to run in Visual Studio. What took a minute or two on the old system is taking 20 minutes in Visual Studio.

The issue is definitely due to the font size as changing everything to print the same font size means the Visual Studio program runs fine. It's not ideal if we have to do that which is why I was wondering if anyone knows of a solution? Many thanks if you can help!

Another thing I noticed with pdf printing in Visual Studio is blank line spacing seems to be greater than in Net Express, causing our report lines to "creep" down the page. It meant I had to adjust the page overflow lines. Again, I didn't expect to have to do that after porting the code to Visual Studio. 

The lines below are an example of the native code we are using to handle printing. The first part is where we are setting the font size and family. We are printing to Adobe Acrobat 8.

               CALL "PC_PRINTER_SET_FONT" USING BY REFERENCE WS-HANDLE
                                          BY REFERENCE WS-FONT-FAMILY
                                          BY VALUE WS-FONT-SIZE
                                          BY VALUE WS-FONT-STYLE
                                          RETURNING WS-STATUS-CODE.
           IF WS-STATUS-CODE NOT = 0
               MOVE "UNABLE TO SET PRINTER FONT" TO LINK-MESSAGE
               GO TO PX999.
       PX300.
           CALL "PC_PRINTER_WRITE" USING BY REFERENCE WS-HANDLE
                                         BY REFERENCE WS-PRINT-BUFFER
                                         BY VALUE WS-PRINT-BUFFER-LEN
                                         RETURNING WS-STATUS-CODE.

Many thanks if you have any ideas of what to do. I tried looking at whether a Namespace needs to be added (or COM object), plus searched high and low on Google without any hits.

John

   

RE: PDF printing very slow

$
0
0

Many thanks for the quick reply Chris.

I am using the same PC and OS for both Net Express and Visual Cobol (version is 2.1 but am planning to install Cobol Server in the next week or so). The program is compiled as native code.

The interesting thing is the slow printing problem only arises with mixed font sizes (the font family doesn't change). The program first prints an address on a statement in Courier New font 14-point then the rest of the statement lines in Courier New 10-point.  

I'll load up a demo program to the Customer Care site either this afternoon or tomorrow morning.  

Thanks again,

John

RE: Monitoring a folder

$
0
0

Chris, thank you for help, that's exactly what I need, this process will run and when new files in the folder it shows to the user that there are new things for him there.


RE: Monitoring a folder

$
0
0

I have found a pretty good demo in C# and have rewritten it in Visual COBOL. I have published a new KB article here that has the demo attached to it.

Please give it a try and let me know if this is what you were looking for,

Thanks

RE: Consuming WCF in NAtive Code via Managed Code in Visual COBOL

$
0
0

I think that we might have discovered a problem in the area of calling a WCF Service when passing certain types of parameters by value in and out of the interface. The error message that we are receiving is similar to the one you are receiving.

Can you confirm what your service methods are using as parameters? The problem that we found occurs when trying to pass a data only object by value as a parameter in order to pass a COBOL group item. If we change this to set a byte array (type Byte occurs any) to the group item on the client side and then pass the byte array instead then it works ok.

If you would like to create a support incident with customer care and put it to my attention, I would be glad to take a look at your scenario to see if it is indeed the same problem?

Thanks.

RE: Monitoring a folder

$
0
0

Perfect, that's what I needed, but thank you very much.

System.IO.FileStream

$
0
0

Hi,

Does any one have a Visual Cobol example of how to read a text file one character at a time using the System.IO.FileStream method so I can display the data in a TextBox ?

Thanks in advance for any assistance.

Kind regards

Neil.

RE: System.IO.FileStream

$
0
0

Here is an example that creates a new file one byte at a time using FileStream and then reads it back one byte at a time using FileStream::ReadByte to verify what was written.

      $set ilusing"System.IO" 
       program-id. Program1 as "streambyteread.Program1".

       data division.
       working-storage section.
       78 filename    value "C:\temp\newfile.txt".
       procedure division.

           *> Create random data to write to the file. 
           declare dataArray as type Byte occurs 1000
           invoke new Random::NextBytes(dataArray)

           perform using fileStream as type FileStream = new FileStream(fileName, type FileMode::Create)
              *> Write the data to the file, byte by byte. 
              perform varying i as binary-long from 0 by 1 until i = dataArray::Length
                 invoke fileStream::WriteByte(dataArray[i])
              end-perform
              *> Set the stream position to the beginning of the file.
              invoke fileStream::Seek(0, type SeekOrigin::Begin)
              *> Read and verify the data. 
              perform varying i as binary-long from 0 by 1 until i = fileStream::Length
                 if dataArray[i] not = fileStream::ReadByte()
                    display "Error writing data."
                    goback
                 end-if
              end-perform
              display "The data was written to " & fileStream::Name & " and verified."
           end-perform
           goback.
           
       end program Program1.

RE: MessageBoxResult

$
0
0

Hi Oscar,

The MessageBoxResult enumeration is used in WPF applications.

If you are creating a Windows Forms application then you should be using DialogResult instead:

         evaluate type MessageBox::Show("new message", "caption", type MessageBoxButtons::OKCancel)

            when type DialogResult::OK

               continue

         end-evaluate

MessageBoxResult

$
0
0

Good morning,
I'm new to the forum, a query because the method does not appear MessageBoxResult?
Any doubt I am to order.
regards,

Oscar Velasquez G.
Panama


RE: What options are there for embedded SQL access in COBOL?

$
0
0

Your link to the information appears to be a broken link.

What options are there for embedded SQL access in COBOL?

$
0
0

[Migrated content. Thread originally posted on 20 February 2012]

Using embedded SQL statements in a COBOL program is a fairly common thing to do but even if you've been doing this for a while, it's not always clear what options are available. Here's a quick summary of what you can do and when you need to opt for one approach over another.

Generally speaking, there are 2 approaches to accessing a database from a COBOL program that contains embedded SQL statements:

1. Use the Database vendor’s pre-compiler. The pre-compiler takes as input the COBOL source file and outputs another file that is compiled by the Micro Focus COBOL compiler.

2. Use Micro Focus OpenESQL technology.


There are some upsides and drawbacks to using the a pre-compiler:

1. The pre-compiler can offer extra performance over OpenESQL but this is generally negligible.

2. The pre-compiler allows you to access non-standard DB-specific extensions.

3. Compilation is a two stage process. Pre-compiler and then COBOL compilation.

4. The debugging experience isn’t integrated – the developer debugs the pre-compiler output and not the actual embedded SQL originally coded.

5. Pre-compilers do not currently support managed code, JVM or .NET.


COBSQL -- Micro Focus provides a technology called COBSQL which improves the developer experience when using pre-compilers. Points 3 and 4 are much improved using this technology.


OpenESQL provides ubiquitous database access. No database vendor pre-compiler is required. Again, upsides and drawbacks:

1. OpenESQL is database agnostic, COBOL programs can be switched to use a new database with no changes.

2. OpenESQL is the only technology which allows ADO.NET and JDBC access by COBOL programs.

3. Performance may be slightly reduced over pre-compilers but this is generally negligible.

4. OpenESQL may not support non-standard ANSI SQL extensions that some database vendors provide. So it is possible that moving to ESQL from a pre-compiler will require updating the code to replace these extensions.

Certification
Database vendors take responsibility for certifying their pre-compilers with Micro Focus technology. However, Micro Focus also tests all the major databases, DB2 LUW, Oracle and SQLServer.

For other databases, vendors that provide ODBC access to their database can be accessed with Micro Focus OpenESQL technology. There are on occasion nuances we encounter with the ODBC implementations of some vendors, when we discover these we usually rectify within OpenESQL.

How to do Popup list from Master-Slave tables

$
0
0

Hi,

I'm looking for an example that shows the best way to do a popup list that allows the user to choose  a detail(slave) record that they can then edit.


I'm writing small program that allows a user to create a manifest in a master table and then the user can add items to the manifest in a detail/slave table.

Is there a recommended way of doing this?  Would you know of a good example that you could refer me to?


Thanks. Any help is greatly appreciated.

Best,

Peter

RE: How to do Popup list from Master-Slave tables

$
0
0

Hi C,

I hope you're having a good summer. Any suggestions on doing popups with green screen? If not, I'll work it out, I just thought I'd ping you one more time.

Thanks.

RE: System.IO.FileStream

$
0
0

Hi Chris,

Thanks for that.

Between what you gave me above and what I found on the internet I came up with the following code. Do you think this is the most efficient way of reading a flat file using FileStream?

Viewing all 4356 articles
Browse latest View live