<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calling COBOL sub-program from C in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/calling-cobol-sub-program-from-c/m-p/3876223#M34935</link>
    <description>Salut JF, Comment ca va?!&lt;BR /&gt;&lt;BR /&gt;1) Cobol use LIB$INITIALIZE, but I believe that will all happen automagically at image activation following magic psect contribution. No need for a caller to prep.&lt;BR /&gt;&lt;BR /&gt;2)  Cobol itself basically (sic) only works with fixed length strings. And program parameters, described in the LINKAGE SECTION, must all be passed by reference.&lt;BR /&gt;&lt;BR /&gt;Of course one can play games and call passing a descriptor, but receiving it as a reference to a descriptor structure, which gives access to length, type, address. &lt;BR /&gt;&lt;BR /&gt;If you are still at freedom to define your parameters then do the cobol folks a favor and you just pass a reference to the string (address of first byt) and seperately the address of an int holding the length.&lt;BR /&gt;&lt;BR /&gt;On the cobol side you'll want to look at "refence modification" and STRING or INSPECT (if you opt for null terminated strings).&lt;BR /&gt;&lt;BR /&gt;Check out some of (my) examples in topic 1052374 &lt;BR /&gt;&lt;BR /&gt;( &lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1052374" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1052374&lt;/A&gt; )&lt;BR /&gt;&lt;BR /&gt;Hth,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
    <pubDate>Sat, 07 Oct 2006 21:34:43 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2006-10-07T21:34:43Z</dc:date>
    <item>
      <title>Calling COBOL sub-program from C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/calling-cobol-sub-program-from-c/m-p/3876221#M34933</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I need to call Cobol sub-program from C.&lt;BR /&gt;&lt;BR /&gt;As I'm not an Cobolexpert I have 2 questions:&lt;BR /&gt;&lt;BR /&gt;1. Is there any specific COBOL initialisation run time routine to call from the C progam (like you have to do for C when C is not the main program)?&lt;BR /&gt;&lt;BR /&gt;2. The C main program need to pass some string using a descriptor, the length of the string may vary, how to declare this in the COBOL sub-program?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;JF</description>
      <pubDate>Sat, 07 Oct 2006 11:24:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/calling-cobol-sub-program-from-c/m-p/3876221#M34933</guid>
      <dc:creator>Jean-François Piéronne</dc:creator>
      <dc:date>2006-10-07T11:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calling COBOL sub-program from C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/calling-cobol-sub-program-from-c/m-p/3876222#M34934</link>
      <description>I know nothing, but have you looked at the&lt;BR /&gt;"HP COBOL User Manual"?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/doc/82final/6297/6297pro.html" target="_blank"&gt;http://h71000.www7.hp.com/doc/82final/6297/6297pro.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;In particular, Chapter 12, "Interprogram&lt;BR /&gt;Communication":&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/doc/82final/6297/6297pro_088.html#interpro_com_chap" target="_blank"&gt;http://h71000.www7.hp.com/doc/82final/6297/6297pro_088.html#interpro_com_chap&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;specifically Section 12.6, "Calling HP COBOL&lt;BR /&gt;Programs from Other Languages (Alpha, I64)":&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/doc/82final/6297/6297pro_092.html#other_lang_sec" target="_blank"&gt;http://h71000.www7.hp.com/doc/82final/6297/6297pro_092.html#other_lang_sec&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Chpater 13 seems to cover going in the other&lt;BR /&gt;direction, too.&lt;BR /&gt;&lt;BR /&gt;If the COBOL subprogram already exists,&lt;BR /&gt;wouldn't you want to write the C code to&lt;BR /&gt;accomodate the existing COBOL&lt;BR /&gt;argument-passing method, rather than&lt;BR /&gt;changing the declarations in the COBOL&lt;BR /&gt;subprogram?  (And if the COBOL subprogram&lt;BR /&gt;does not already exist, why would you be&lt;BR /&gt;writing it COBOL?)</description>
      <pubDate>Sat, 07 Oct 2006 13:04:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/calling-cobol-sub-program-from-c/m-p/3876222#M34934</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2006-10-07T13:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calling COBOL sub-program from C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/calling-cobol-sub-program-from-c/m-p/3876223#M34935</link>
      <description>Salut JF, Comment ca va?!&lt;BR /&gt;&lt;BR /&gt;1) Cobol use LIB$INITIALIZE, but I believe that will all happen automagically at image activation following magic psect contribution. No need for a caller to prep.&lt;BR /&gt;&lt;BR /&gt;2)  Cobol itself basically (sic) only works with fixed length strings. And program parameters, described in the LINKAGE SECTION, must all be passed by reference.&lt;BR /&gt;&lt;BR /&gt;Of course one can play games and call passing a descriptor, but receiving it as a reference to a descriptor structure, which gives access to length, type, address. &lt;BR /&gt;&lt;BR /&gt;If you are still at freedom to define your parameters then do the cobol folks a favor and you just pass a reference to the string (address of first byt) and seperately the address of an int holding the length.&lt;BR /&gt;&lt;BR /&gt;On the cobol side you'll want to look at "refence modification" and STRING or INSPECT (if you opt for null terminated strings).&lt;BR /&gt;&lt;BR /&gt;Check out some of (my) examples in topic 1052374 &lt;BR /&gt;&lt;BR /&gt;( &lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1052374" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1052374&lt;/A&gt; )&lt;BR /&gt;&lt;BR /&gt;Hth,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Sat, 07 Oct 2006 21:34:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/calling-cobol-sub-program-from-c/m-p/3876223#M34935</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-10-07T21:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calling COBOL sub-program from C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/calling-cobol-sub-program-from-c/m-p/3876224#M34936</link>
      <description>Steven,&lt;BR /&gt;&lt;BR /&gt;Thanks for the pointer. I had take a look at the documentation  "HP COBOL User Manual" but probably too quickly because I have miss section 12.6 which is what I'm looking for.&lt;BR /&gt;&lt;BR /&gt;The program COBOL exist as a program, but not as a subprogram so a rewrite in C is not a option but update are required.&lt;BR /&gt;&lt;BR /&gt;JF</description>
      <pubDate>Sun, 08 Oct 2006 04:58:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/calling-cobol-sub-program-from-c/m-p/3876224#M34936</guid>
      <dc:creator>Jean-François Piéronne</dc:creator>
      <dc:date>2006-10-08T04:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calling COBOL sub-program from C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/calling-cobol-sub-program-from-c/m-p/3876225#M34937</link>
      <description>Salut Hein,&lt;BR /&gt;&lt;BR /&gt;merci pour la reponse.&lt;BR /&gt;&lt;BR /&gt;Thanks for the example reference, would be very useful.&lt;BR /&gt;&lt;BR /&gt;As the COBOL parameters are not, currently, defined I will follow your advise and split the descriptors (dynamic string) in two part (length and string pointer). Seem to be the best option.&lt;BR /&gt;&lt;BR /&gt;The last time I have wrote a COBOL program was probably 25 years ago...&lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;&lt;BR /&gt;JF&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 08 Oct 2006 05:09:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/calling-cobol-sub-program-from-c/m-p/3876225#M34937</guid>
      <dc:creator>Jean-François Piéronne</dc:creator>
      <dc:date>2006-10-08T05:09:16Z</dc:date>
    </item>
  </channel>
</rss>

