{"id":525,"date":"2010-02-13T23:56:01","date_gmt":"2010-02-13T22:56:01","guid":{"rendered":"http:\/\/www.gennard.net\/blog\/?p=525"},"modified":"2010-02-13T23:56:01","modified_gmt":"2010-02-13T22:56:01","slug":"cobol-dotnet-reflection","status":"publish","type":"post","link":"http:\/\/www.gennard.net\/blog\/2010\/02\/cobol-dotnet-reflection\/","title":{"rendered":"Reflection and COBOL"},"content":{"rendered":"<p>For the last couple of months I have working on Visual Studio 2010 and this include Microsoft CLR v4 and I was recently asked how to write a test that determines at runtime which CLR is being used and what assemblies it uses.   I replies would use reflection.   So I dropped my friend a mega simple demo&#8230; and here it is.<\/p>\n<p><code lang=\"cobol\" width=\"800\" lines=\"-1\" nowrap=\"0\"><br \/>\n       $set ilusing\"System.Reflection\"<\/p>\n<p>        01 myAssembly type \"Assembly\".<br \/>\n        01 usedAssemblyName type \"AssemblyName\".<\/p>\n<p>        set myAssembly to type \"Assembly\"::\"GetExecutingAssembly\"<\/p>\n<p>        display \"My exe is \" myAssembly::\"FullName\"<br \/>\n        display \"and is using CLR \" myAssembly::\"ImageRuntimeVersion\"<br \/>\n        display \"and is loaded from \" myAssembly::\"Location\"<br \/>\n        display \"the initial method of this program was \"<br \/>\n          myAssembly::\"EntryPoint\"::\"Name\"<\/p>\n<p>        display \"This assembly references -> \"<br \/>\n        perform varying usedAssemblyName<br \/>\n             through myAssembly::\"GetReferencedAssemblies\"<br \/>\n              display \"-> \" usedAssemblyName<br \/>\n        end-perform<\/p>\n<p><\/code><\/p>\n<p>And the output of the program is: <\/p>\n<p><code lang=\"text\" width=\"800\" lines=\"-1\" nowrap=\"0\"><br \/>\nMy exe is clrver, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null<br \/>\nand is using CLR v2.0.50727<br \/>\nand is loaded from d:clrver.exe<br \/>\nthe initial method of this program was _MF_ENTRYThis assembly references -><br \/>\n-> mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089<br \/>\n-> MicroFocus.COBOL.Runtime, Version=3.6.0.0, Culture=neutral,<br \/>\nPublicKeyToken=0412c5e0b2aaa8f0<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For the last couple of months I have working on Visual Studio 2010 and this include Microsoft CLR v4 and I was recently asked how to write a test that determines at runtime which CLR is being used and what &hellip; <a href=\"http:\/\/www.gennard.net\/blog\/2010\/02\/cobol-dotnet-reflection\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5,32],"tags":[208,209,77,129,162],"_links":{"self":[{"href":"http:\/\/www.gennard.net\/blog\/wp-json\/wp\/v2\/posts\/525"}],"collection":[{"href":"http:\/\/www.gennard.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gennard.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gennard.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gennard.net\/blog\/wp-json\/wp\/v2\/comments?post=525"}],"version-history":[{"count":0,"href":"http:\/\/www.gennard.net\/blog\/wp-json\/wp\/v2\/posts\/525\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.gennard.net\/blog\/wp-json\/wp\/v2\/media?parent=525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gennard.net\/blog\/wp-json\/wp\/v2\/categories?post=525"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gennard.net\/blog\/wp-json\/wp\/v2\/tags?post=525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}