Skip to main content
Question

Replacement of dictionary defined as external item in .NET

  • November 10, 2025
  • 2 replies
  • 15 views

Peter Restorick

I am converting code from native COBOL to .NET and am looking for suggestions whereby in native COBOL I am using a dictionary that is set as an external item so that it can be referenced by a number of programs (DLL’s) but as this is not supported in .NET so I am trying to figure out a viable alternative.

Any thoughts or suggestions?

2 replies

Chris Glazier
Forum|alt.badge.img+2
  • Moderator
  • 3697 replies
  • November 10, 2025

One method would be to create the dictionary object and store it as a static property within a class that is available to all other classes and share it that way.

Here is a simple example that uses a string as a shared object.

       program-id. Program1 as "testsharing.Program1".

data division.
working-storage section.

procedure division.
declare myobj1 = new type MyClass1
declare myobj2 = new type MyClass2

invoke myobj1::InstanceMethod1
display type sharedData::my-shared-object
invoke myobj2::InstanceMethod2
display type sharedData::my-shared-object
goback.

end program Program1.
class-id sharedData.
working-storage section.
01 my-shared-object property string static.
end class.
class-id MyClass1.
method-id InstanceMethod1.
procedure division.
set type sharedData::my-shared-object to "Hello from instance 1"
goback.
end method.
end class.
class-id MyClass2.
method-id InstanceMethod2.
procedure division.
set type sharedData::my-shared-object to "Hello from instance 2"
goback.
end method.
end class.

 


Peter Restorick
  • Author
  • New Participant
  • 2 replies
  • November 10, 2025

Thanks very much Chris