Skip to main content
Solved

.NET COBOL external dictionary

  • August 10, 2026
  • 4 replies
  • 79 views

Peter Restorick
Forum|alt.badge.img+2

In native COBOL we could define a dictionary and that could be set as external which allowed us to access it via our external filehandler. In .NET COBOL it seems it is no longer possible to define a dictionary as external.

Can anyone suggest an alternative given that the information that can be passed to an external filehandler is limited and controlled by the run-time?

Best answer by Chris Glazier

something like this:

       program-id. Program1 as "teststatic.Program1".
procedure division.
create type mydictionary::stringdict
write type mydictionary::stringdict from "item 0" key "key0"
call "subprog"
perform varying key k as string through type mydictionary::stringdict
declare s as string
read type mydictionary::stringdict into s key k
display "key = " & k & " value = " & s
end-perform
display "done"

goback.

end program Program1.
class-id mydictionary.
working-storage section.
01 stringdict dictionary[string, string] static property.
end class.

program-id. subprog.
procedure division.

write type mydictionary::stringdict from "item 1" key "key1".

end program subprog.

 

4 replies

Chris Glazier
Forum|alt.badge.img+4

Hi Peter,

Have you tried defining the dictionary as static?


Peter Restorick
Forum|alt.badge.img+2

Hi Chris,

 

Thanks for responding but ignorance is bliss here. Am I correct in saying I would have to define a separate class/dll which I can then reference from both the mainstream application and the external filehandler?

 


Chris Glazier
Forum|alt.badge.img+4
  • Moderator
  • Answer
  • August 11, 2026

something like this:

       program-id. Program1 as "teststatic.Program1".
procedure division.
create type mydictionary::stringdict
write type mydictionary::stringdict from "item 0" key "key0"
call "subprog"
perform varying key k as string through type mydictionary::stringdict
declare s as string
read type mydictionary::stringdict into s key k
display "key = " & k & " value = " & s
end-perform
display "done"

goback.

end program Program1.
class-id mydictionary.
working-storage section.
01 stringdict dictionary[string, string] static property.
end class.

program-id. subprog.
procedure division.

write type mydictionary::stringdict from "item 1" key "key1".

end program subprog.

 


Peter Restorick
Forum|alt.badge.img+2

Thanks Chris I will give this a try, appreciate your help