Skip to main content
Solved

NET COBOL Dictionary to store a group level entity

  • March 23, 2026
  • 4 replies
  • 53 views

Peter Restorick
Forum|alt.badge.img+2

Hi.

In native COBOL I have an OO Dictionary that stores entries of the following group level item and this is incredibly fast and suits my purposes perfectly.

I’ve converted this program to .NET COBOL and am really struggling to get this to perform anywhere close to native COBOL because of the overhead converting the PIC entries to a string when outputting to and retrieving from the dictionary.

Do you have any suggestions that may help me to get the process to be performant? 

       01 def-fieldtouse.
          03 def-any-output       pic x.    
          03 def-num-cols         pic x(2) comp-5.     
          03 def-next                 pic 9(18).
          03 def-filename          pic x(100).
          03 def-col-array.
             05 def-columns occurs 800.
               07 def-col-name   pic x(100).
               07 def-col-type     pic x(15).
 

 

Best answer by Chris Glazier

Hi Peter,

I was just beginning to look into this when I saw your new post.

I tested with the Byte[] also, setting it to the group and vice versa before and after and it is quite fast.

I do not foresee any problem with doing it this way, but then again, you are breaking new ground, and I do not know of any other customer who has tried this.

 

4 replies

Chris Glazier
Forum|alt.badge.img+3

Hi Peter,

Can you show me the code that you are using to store and retrieve the data in both native and .NET?

 

Thanks


Peter Restorick
Forum|alt.badge.img+2

Hi Chris, 

Apologies for the late response but I have built two sample solutions as attached. Both insert 5,000 entries into the dictionary and then update 10,000 times and read 10,000 times… the NET version takes just under 11 seconds to complete and the native version takes around 1.5 seconds or just under 10 times quicker which is significant.

Hope you can assist.


Peter Restorick
Forum|alt.badge.img+2

Hi Chris,

Whilst waiting to see if you had any suggestions I changed my dictionary from string,string to string,object and instead of moving the group level item in directly I firstly move it into a byte array and then store the byte array as an object.

The timings I got with this appear to be marginally quicker than the native dictionaries. 

So I guess my question to you is whether doing something like this is a good idea or whether I am opening myself up to other issues further on down the line.

 

Peter


Chris Glazier
Forum|alt.badge.img+3
  • Moderator
  • Answer
  • March 25, 2026

Hi Peter,

I was just beginning to look into this when I saw your new post.

I tested with the Byte[] also, setting it to the group and vice versa before and after and it is quite fast.

I do not foresee any problem with doing it this way, but then again, you are breaking new ground, and I do not know of any other customer who has tried this.