<?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: Creating functions for use in HP COBOL on OpenVMS in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165179#M41907</link>
    <description>Hi John,&lt;BR /&gt;&lt;BR /&gt;A very worthwhile question, and one that I have wondered about since intrinsic functions appeared. Iguess the answer has to be in the evolving COBOL language standards and the whether (how soon) John Reagan can incorporate adherence to those standards into HP/COBOL. Sadly, I see huge obstacles on the horizon :-(&lt;BR /&gt;&lt;BR /&gt;Already, there are many COBOL features common elsewhere that are not supported in VAX/HP/COBOL "Set Reference of ws-var TO ws-pointer" (or something like it) being one that I wish for.&lt;BR /&gt;&lt;BR /&gt;As far as "creating" cobol functions goes, there is nothing to stop you. You can then call them as a function from something like SQL with no problems. (Just not "as a funtion" from COBOL)&lt;BR /&gt;&lt;BR /&gt;Cheers Richard Maher&lt;BR /&gt;&lt;BR /&gt;PS. If you wish to return something other than a [big]integer as a function result from COBOL then just specify it as the first parameter in your sub-program (ie: you don't use the GIVING phrase for a String function result)</description>
    <pubDate>Sun, 22 Mar 2009 23:56:08 GMT</pubDate>
    <dc:creator>Richard J Maher</dc:creator>
    <dc:date>2009-03-22T23:56:08Z</dc:date>
    <item>
      <title>Creating functions for use in HP COBOL on OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165174#M41902</link>
      <description>&lt;!--!*#--&gt;Is it possible to write fuctions for use in HP COBOL, VMS 8.3 like the intrinsic functions supplied with HP COBOL?  For instance, COMPUTE MYVALUE = FUNCTION MYFUNCTION(WRK-MYPARAM).  If so, can these be coded with any Language like COBOL (the only one I know...).  Thanks for pointing me to any references on the subject, and/or for your recommendations.&lt;BR /&gt;&lt;BR /&gt;There are cases where it makes more readable code to use a function syntax than it does for calling other programs (i.e., CALL 'MYPROG' USING...).&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;John &lt;BR /&gt;john dot farmer at genworth dot com&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Mar 2009 20:19:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165174#M41902</guid>
      <dc:creator>John T. Farmer</dc:creator>
      <dc:date>2009-03-20T20:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating functions for use in HP COBOL on OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165175#M41903</link>
      <description>&amp;gt;There are cases where it makes more readable code to use a function syntax than it does for calling other programs (i.e., CALL 'MYPROG' USING...).&lt;BR /&gt;&lt;BR /&gt;I would stick with what you know, CALL.&lt;BR /&gt;It seems debatable whether functions are more readable for your simple COMPUTE.&lt;BR /&gt;Of course in C, C++ or etc., using functions in expressions is nice.</description>
      <pubDate>Fri, 20 Mar 2009 21:49:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165175#M41903</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-03-20T21:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating functions for use in HP COBOL on OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165176#M41904</link>
      <description>I don't think so. Just a those 50 odd, fixed intrinsic functions. No named, or linker resolved , functions like the 'call'.&lt;BR /&gt;So you are stuck with the CALL USING ... GIVING &lt;SOME elementary="" integer=""&gt;.&lt;BR /&gt;&lt;BR /&gt;Now those called subroutines can be coded in any language, not just Cobol itself. That's the beauty of OpenVMS! Feel free to write your subroutines in C or MACRO or Fortran.&lt;BR /&gt;Cobol is happy to call out, passing by descriptor, reference or value. Cobol itself is NOT happy to be called by anything but a memory reference, but there are tricks around that.&lt;BR /&gt;&lt;BR /&gt;The biggest common (expectation) problem using multiple languages is that each have their own native file io methods. You can not mix BASIC channels with Fortran LUNs or C file handles. But otherwise... just about anything goes.&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;/SOME&gt;</description>
      <pubDate>Fri, 20 Mar 2009 23:14:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165176#M41904</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2009-03-20T23:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating functions for use in HP COBOL on OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165177#M41905</link>
      <description>John,&lt;BR /&gt;&lt;BR /&gt;  As Hein says, you can mix languages on OpenVMS very easily, BUT COBOL can have a peculiar problem calling routines in other languages. Since COBOL has far more data types than most other languages, you have to work a bit harder to make sure your arguments are correct. There are many data types in COBOL that the likes of C and C++ will not recognise.&lt;BR /&gt;&lt;BR /&gt;  THE biggest issue when calling any routine is making sure arguments agree in position, data type and passing mechanism. You'll need to consult the table Table 13-4 COBOL Implementation of the OpenVMS Data Types (OpenVMS) in the Cobol Users Manual to make sure you've declared the arguments correctly.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 22 Mar 2009 22:16:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165177#M41905</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2009-03-22T22:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating functions for use in HP COBOL on OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165178#M41906</link>
      <description>John provided the textbook answer.  I usually coded up an examine program and an example target (both using the same language), then stepped into the call sequence using the debugger, and looked around.  From the descriptor codes and the header files, I could work backwards into the descriptor-related documentation in the calling standard manual.  Brute-force and hugely ugly and hopefully an absurd way to go after this case, but I also found more than a few cases where a compiler used an unexpected (to me) descriptor.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 22 Mar 2009 23:27:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165178#M41906</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2009-03-22T23:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating functions for use in HP COBOL on OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165179#M41907</link>
      <description>Hi John,&lt;BR /&gt;&lt;BR /&gt;A very worthwhile question, and one that I have wondered about since intrinsic functions appeared. Iguess the answer has to be in the evolving COBOL language standards and the whether (how soon) John Reagan can incorporate adherence to those standards into HP/COBOL. Sadly, I see huge obstacles on the horizon :-(&lt;BR /&gt;&lt;BR /&gt;Already, there are many COBOL features common elsewhere that are not supported in VAX/HP/COBOL "Set Reference of ws-var TO ws-pointer" (or something like it) being one that I wish for.&lt;BR /&gt;&lt;BR /&gt;As far as "creating" cobol functions goes, there is nothing to stop you. You can then call them as a function from something like SQL with no problems. (Just not "as a funtion" from COBOL)&lt;BR /&gt;&lt;BR /&gt;Cheers Richard Maher&lt;BR /&gt;&lt;BR /&gt;PS. If you wish to return something other than a [big]integer as a function result from COBOL then just specify it as the first parameter in your sub-program (ie: you don't use the GIVING phrase for a String function result)</description>
      <pubDate>Sun, 22 Mar 2009 23:56:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165179#M41907</guid>
      <dc:creator>Richard J Maher</dc:creator>
      <dc:date>2009-03-22T23:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Creating functions for use in HP COBOL on OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165180#M41908</link>
      <description>Hoff,&lt;BR /&gt;That's pretty much what I do when the going gets tough. Can't argue with bits &amp;amp; bytes. They are what there are.&lt;BR /&gt;&lt;BR /&gt;Richard&amp;gt;&amp;gt; whether (how soon) John Reagan can incorporate adherence to those standards into HP/COBOL. Sadly, I see huge obstacles on the horizon :-(&lt;BR /&gt;&lt;BR /&gt;I suspect you are right. Ain't gonna happen. What you see is what you get.&lt;BR /&gt;&lt;BR /&gt;Richard&amp;gt; VAX/HP/COBOL "Set Reference of ws-var TO ws-pointer" (or something like it) being one that I wish for.&lt;BR /&gt;&lt;BR /&gt;Amen. Something, anything, to de-refence.&lt;BR /&gt;I resort to silly stuff like: &lt;BR /&gt;&lt;BR /&gt;01  fab_pt                      POINTER.&lt;BR /&gt;01  gbc_pointer                 POINTER.&lt;BR /&gt;:&lt;BR /&gt;    CALL "DCOB$RMS_CURRENT_FAB" GIVING FAB_PT&lt;BR /&gt;    ADD 72 TO FAB_PT GIVING GBC_POINTER.&lt;BR /&gt;:&lt;BR /&gt;    CALL "OTS$MOVE3" USING BY VALUE 2, BY REFERENCE GBC, BY VALUE GBC_POINTER.&lt;BR /&gt;:&lt;BR /&gt;Yuck!&lt;BR /&gt;&lt;BR /&gt;Richard&amp;gt;&amp;gt; S. If you wish to return something other than a [big]integer as a function result from COBOL then just specify it as the first parameter in your sub-program &lt;BR /&gt;&lt;BR /&gt;Right. Thanks for reminding us / pointing that out!&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 23 Mar 2009 02:15:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165180#M41908</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2009-03-23T02:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating functions for use in HP COBOL on OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165181#M41909</link>
      <description>Thanks for all the replies.  Was worth a shot.  Will continue CALLing routines in COBOL to get the job done.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;John F.</description>
      <pubDate>Mon, 23 Mar 2009 13:24:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165181#M41909</guid>
      <dc:creator>John T. Farmer</dc:creator>
      <dc:date>2009-03-23T13:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating functions for use in HP COBOL on OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165182#M41910</link>
      <description>For anyone else that comes across this thread don't forget COBOL's: -&lt;BR /&gt;&lt;BR /&gt;- CALL ws-identifier&lt;BR /&gt;- (VMS') lib$callg&lt;BR /&gt;- Nested sub-programs &lt;BR /&gt;- IS COMMON&lt;BR /&gt;- variables with GLOBAL scope&lt;BR /&gt;&lt;BR /&gt;This functionality/flexibility can also help with COBOL program design.&lt;BR /&gt;&lt;BR /&gt;Cheers Richard Maher</description>
      <pubDate>Mon, 23 Mar 2009 21:05:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-functions-for-use-in-hp-cobol-on-openvms/m-p/5165182#M41910</guid>
      <dc:creator>Richard J Maher</dc:creator>
      <dc:date>2009-03-23T21:05:35Z</dc:date>
    </item>
  </channel>
</rss>

