<?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 a new &amp;quot;OpenVMS function&amp;quot; in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6298367#M37285</link>
    <description>&lt;P&gt;Do not know about the lexical, but is it not possible to use subroutines&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ out :== write sys$output&lt;BR /&gt;$ call sub1 "potato"&lt;BR /&gt;$ calamar = "''ppp'"&lt;BR /&gt;$ out "calamar value is ''calamar'"&lt;BR /&gt;$ exit&lt;BR /&gt;$ sub1 : subroutine&lt;BR /&gt;$ ppp :== "''p1'"&lt;BR /&gt;$ exit&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jouk&lt;/P&gt;</description>
    <pubDate>Mon, 09 Dec 2013 14:12:15 GMT</pubDate>
    <dc:creator>Jansen_8</dc:creator>
    <dc:date>2013-12-09T14:12:15Z</dc:date>
    <item>
      <title>Creating a new "OpenVMS function"</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6298321#M37284</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have looked a lot of documentation but I am not able to find what I am looking for, probably 'cause I don't know how to call it. What I want to do is a new function like if it were a lexical. I need to use within a DCL a new function that returns a value. I mean, something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ out :== write sys$output&lt;/P&gt;&lt;P&gt;$ calamar = f$my_new_function("potato")&lt;/P&gt;&lt;P&gt;$ out "calamar value is ''calamar'"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible. If so, how can I do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Salva.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 13:12:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6298321#M37284</guid>
      <dc:creator>Yyrkoon_</dc:creator>
      <dc:date>2013-12-09T13:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new "OpenVMS function"</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6298367#M37285</link>
      <description>&lt;P&gt;Do not know about the lexical, but is it not possible to use subroutines&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ out :== write sys$output&lt;BR /&gt;$ call sub1 "potato"&lt;BR /&gt;$ calamar = "''ppp'"&lt;BR /&gt;$ out "calamar value is ''calamar'"&lt;BR /&gt;$ exit&lt;BR /&gt;$ sub1 : subroutine&lt;BR /&gt;$ ppp :== "''p1'"&lt;BR /&gt;$ exit&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jouk&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 14:12:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6298367#M37285</guid>
      <dc:creator>Jansen_8</dc:creator>
      <dc:date>2013-12-09T14:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new "OpenVMS function"</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6298525#M37286</link>
      <description>&lt;P&gt;What kind of problem do you want to solve?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can write a program to set a symbol by calling &amp;nbsp;lib$set_symbol. On VMS, programs are usually running in the current DCL context so a program is able to set a symbol for the current process. On recent versions of VMS, some utilities create and set symbols. Analyze/image with /select is an example.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 16:12:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6298525#M37286</guid>
      <dc:creator>H.Becker</dc:creator>
      <dc:date>2013-12-09T16:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new "OpenVMS function"</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6298973#M37287</link>
      <description>&lt;P&gt;It's not possible to&amp;nbsp;define a new lexical function.&amp;nbsp; It's also not possible to call a user-written function in&amp;nbsp;DCL and have it directly return a value (e.g.&amp;nbsp; A = B(C)).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Depending on the complexity of what you want to do (and perhaps what already exists elsewhere) your choices are&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(a)&amp;nbsp;call a DCL subroutine, returning a value in a global symbol&amp;nbsp;(see $ HELP CALL for details)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(b) execute a piped command and return a job logical (see $ HELP PIPE)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(c) call a separate command procedure and return a global symbol&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(d) run an executable image that sets a global symbol (see $ HELP RTL LIB$ LIB$SET_SYMBOL) or sets a process logical (see $ HELP RTL LIB LIB$SET_LOGICAL)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 22:33:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6298973#M37287</guid>
      <dc:creator>John McL</dc:creator>
      <dc:date>2013-12-09T22:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new "OpenVMS function"</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6299033#M37288</link>
      <description>&lt;P&gt;User written lexical functions have been on the wishlist for a long time, but they're unlikely to ever happen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can get close with syntax like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$&amp;nbsp;YOURFUNCTION&amp;nbsp;symbol =&amp;nbsp;parameter [parameter...] [/qualifier...]&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where "YOURFUNCTION" activates a program which uses the CLI routines to parse parameters and qualifiers, and LIB$SET_SYMBOL to&amp;nbsp;return the result. It happens that the CLI parser&amp;nbsp;will tack the "=" sign(s) to the end of the first parameter, regardless of spaces. That means you can define a local symbol if there is one, or global if two (or more). I have a few examples of such programs. Here is the CLI/documentation for one&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;MODULE FINDFILE_CLD
DEFINE VERB FINDFILE
ROUTINE DOFINDFILE
!
! Program to search for files given multiple filespecs, defaults and related filespecs
! Optionally parses resultant file into multiple fields
!
! Syntax:
!
!   FINDFILE &amp;lt;sym&amp;gt; [= ]  &amp;lt;filespec&amp;gt;[,...] [&amp;lt;defaultspec&amp;gt;[,...] [&amp;lt;relatedspec&amp;gt;[,...]]]
!                  [== ]
!     = is optional syntax single = is local, == implies global
!
!   Parameters
!
PARAMETER P1, LABEL=SYM,      VALUE(REQUIRED,NOCONCATENATE)
!     &amp;lt;sym&amp;gt; is a symbol to be defined with the resuling filename
!
PARAMETER P2, LABEL=FILE   , VALUE(LIST,NOCONCATENATE,TYPE=$FILE,REQUIRED)
!     primary filespec(s)in precendence order    F1,F2,...Fn
!
PARAMETER P3, LABEL=DEFAULT, VALUE(LIST,NOCONCATENATE,TYPE=$FILE)
!     default filespec(s)in precendence order    D1,D2,...Dn
!
PARAMETER P4, LABEL=RELATED, VALUE(LIST,NOCONCATENATE,TYPE=$FILE)
!     related filespec(s)in precendence order    R1,R2,...Rn
!
! Searches until a file is found. Sequence as follows:
!
!     F1,D1,R1
!     F1,D1,R2
!     ...
!     F1,D1,Rn
!     F1,D2,R1
!     F1,D2,R2
!     ...
!     F1,D2,Rn
!     F2,D1,R1
!     F2,D1,R2
!     ...
!     F2,D1,Rn
!     F2,D2,R1
!     F2,D2,R2
!     ...
!     F1,D2,Rn
!     F2,D1,R1
!     F2,D1,R2
!     ...
!     Fn,Dn,Rn
!
QUALIFIER LOCAL
QUALIFIER GLOBAL
DISALLOW ANY2 (LOCAL,GLOBAL)
!     /LOCAL  (D)
!     /GLOBAL
!       Specifies the symbol table
!
QUALIFIER IFERROR VALUE(REQUIRED)
!     /IFERROR=message (to be written if not found)
!
QUALIFIER QUIET   DEFAULT
!     /NOQUIET to output error messages
!
QUALIFIER DEBUG
!    Displays debug information while executing
!
QUALIFIER SEARCH  DEFAULT
!    Use /NOSEARCH to parse filespec only (first valid filespec will be returned)
!
QUALIFIER NORMALISE,       DEFAULT
!     /NORMALISE changes any &amp;lt;&amp;gt; brackets into []. Use /NONORMALISE to preserve &amp;lt;&amp;gt; in filespecs
!
QUALIFIER CONCEAL,       DEFAULT
!     /CONCEAL retains concealed logical names. Use /NOCONCEAL to translate concealed logical names
!
QUALIFIER SHOW,             VALUE
!     /SHOW[="string"]            - display name and resulting value with string
!
QUALIFIER PARSE   VALUE(TYPE=FILE_FIELDS,LIST)
!     /PARSE=(field list)
!
QUALIFIER OUTPUT VALUE(REQUIRED)
!     /[NO]OUTPUT=file
!
!       Select file specification fields to include in the output. By default all are included
!       If any fields are specified, only those are include. Use NOfield to omit fields.
!
!    For example
!       /PARSE=(DEVICE,DIR,NAME) =&amp;gt; dev:[dir]name
!       /PARSE=NOVER             =&amp;gt; dev:[dir]name.typ
!       /PARSE=(NAME,TYPE)       =&amp;gt; name.typ
!       /PARSE=NODEV             =&amp;gt; [dir]name.typ;ver
!       /PARSE=VER               =&amp;gt; ;ver
!
!    Note that NODE will only be non-null if it was explicitly included in the input file specification
DEFINE TYPE FILE_FIELDS
  KEYWORD NODE,      NEGATABLE
  KEYWORD DEVICE,    NEGATABLE
  KEYWORD DIRECTORY, NEGATABLE
  KEYWORD NAME,      NEGATABLE
  KEYWORD TYPE,      NEGATABLE
  KEYWORD VERSION,   NEGATABLE
!&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2013 00:17:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6299033#M37288</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2013-12-10T00:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new "OpenVMS function"</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6299409#M37289</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks to all you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will manage to solve my problem somehow using your ideas.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2013 08:11:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/creating-a-new-quot-openvms-function-quot/m-p/6299409#M37289</guid>
      <dc:creator>Yyrkoon_</dc:creator>
      <dc:date>2013-12-10T08:11:39Z</dc:date>
    </item>
  </channel>
</rss>

