<?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: DCL Scripting in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172799#M43630</link>
    <description>If the symbols are short, cram them into the existing parameters.  &lt;BR /&gt;&lt;BR /&gt;Multiplex one or more the available P1 through P8. &lt;BR /&gt;&lt;BR /&gt;You can use f$element and such to process a | or , or # separated list within a parameter, and reconstitute the parameters.&lt;BR /&gt;&lt;BR /&gt;Another option is to use a small temporary file, say MY_XYZ_pid.TMP or some other unique value, and write out the parameters there.  You can use a format such as:&lt;BR /&gt;&lt;BR /&gt;$ MY_FOO=xyz&lt;BR /&gt;$ MY_BAR=pdq&lt;BR /&gt;$ MY_THIS=here&lt;BR /&gt;&lt;BR /&gt;The sneaky trick is that you can then @ the file, and use the values.  (AUTOGEN uses a form of this.)  This isolates you from previous runs and dreck left around in the global symbol tables, and allows you to isolate and test and verify the procedures.&lt;BR /&gt;&lt;BR /&gt;If you do this, I'd suggest use of a prefix on the soon-to-be symbols such as MY_ or PARAM_ (or whatever) to visually identify the source of the symbols.&lt;BR /&gt;&lt;BR /&gt;You can also open the file and process the values directly using implicit parameter labeling.  Parameter P1 could be the first line read, and Pn the last.  SMOP.&lt;BR /&gt;&lt;BR /&gt;I'd not pass stuff around using global symbols or shared logical names.  That's a very inviting, but much harder to keep a lid on it all.  The dependencies get far tougher to locate.&lt;BR /&gt;&lt;BR /&gt;OPEN, CLOSE, READ and WRITE are standard DCL commands, and there are a gazillion examples around.  I would encourage a look at the OpenVMS User's Guide and other materials that introduce DCL programming, as well.  When working with DCL, you'll receive a larger benefit than the time that was originally spent skimming the manuals.&lt;BR /&gt;&lt;BR /&gt;And one wrinkle:&lt;BR /&gt;&lt;BR /&gt;Before you OPEN a file, always issue a CLOSE /NOLOG on the channel.  This because DCL can hold a file open, and will pick up where it left off if several OPEN commands are aimed at the same file.  CLOSE /NOLOG avoids this.&lt;BR /&gt;&lt;BR /&gt;Here's a trivial file read loop:&lt;BR /&gt;&lt;BR /&gt;$ CLOSE/NOLOG iochan&lt;BR /&gt;$ OPEN/READ iochan SYS$SCRATCH:XYZ.TMP&lt;BR /&gt;$LOOP:&lt;BR /&gt;$ READ/END=EOF iochan data&lt;BR /&gt;$ WRITE SYS$OUTPUT "Data &amp;lt;''data'&amp;gt;"&lt;BR /&gt;$ GOTO LOOP&lt;BR /&gt;$DONE:&lt;BR /&gt;$ EXIT&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;&lt;BR /&gt;Stephen Hoffman&lt;BR /&gt;HoffmanLabs LLC&lt;BR /&gt;</description>
    <pubDate>Thu, 03 Apr 2008 14:26:08 GMT</pubDate>
    <dc:creator>Hoff</dc:creator>
    <dc:date>2008-04-03T14:26:08Z</dc:date>
    <item>
      <title>DCL Scripting - command procedure</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172793#M43624</link>
      <description>&lt;P&gt;What is the best way to read an input file that contains various records of configuration information, then assign each record as a replacement varable within a subsequent command procedure. An example would be great!Thanks, Brett&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 14:14:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172793#M43624</guid>
      <dc:creator>Brett_59</dc:creator>
      <dc:date>2020-10-29T14:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172794#M43625</link>
      <description>Brett,&lt;BR /&gt;&lt;BR /&gt;This is a little too much appeal to my psychic powers!&lt;BR /&gt;&lt;BR /&gt;Could you give an example file with ~ records, and jow you would like them changed?&lt;BR /&gt;&lt;BR /&gt;As I read this, one interpretation could be a simple EDIT with global replace, another would be designing a complete text processor.&lt;BR /&gt;&lt;BR /&gt;More detail, please!&lt;BR /&gt;&lt;BR /&gt;Proost.&lt;BR /&gt;&lt;BR /&gt;Have one on me.&lt;BR /&gt;&lt;BR /&gt;jpe</description>
      <pubDate>Wed, 02 Apr 2008 18:32:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172794#M43625</guid>
      <dc:creator>Jan van den Ende</dc:creator>
      <dc:date>2008-04-02T18:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172795#M43626</link>
      <description>Brett,&lt;BR /&gt;&lt;BR /&gt;Having done implementations along this line quite a few times, some more detail about precisely what is being attempted would be helpful.&lt;BR /&gt;&lt;BR /&gt;In one case, I implemented an application analog to SYSGEN, with a fairly complete implementation of the computations to completely define users' queues, defaults, etc.&lt;BR /&gt;&lt;BR /&gt;- Bob Gezelter, &lt;A href="http://www.rlgsc.com" target="_blank"&gt;http://www.rlgsc.com&lt;/A&gt;</description>
      <pubDate>Wed, 02 Apr 2008 18:59:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172795#M43626</guid>
      <dc:creator>Robert Gezelter</dc:creator>
      <dc:date>2008-04-02T18:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172796#M43627</link>
      <description>&lt;!--!*#--&gt;&lt;BR /&gt;Brett, you'll need to provide some more concrete examples about what you are tryign to do, what the input might roughly look like, where/how the data obtained will be used.&lt;BR /&gt;&lt;BR /&gt;Maybe you can just execute the config information, notably when written as "$ param = value"&lt;BR /&gt;Or when written as "param = value" using:&lt;BR /&gt;&lt;BR /&gt;$loop:&lt;BR /&gt;$read/end=... file record&lt;BR /&gt;$'record&lt;BR /&gt;$goto loop&lt;BR /&gt;&lt;BR /&gt;However, that is very uncontrolled and error prone.&lt;BR /&gt;&lt;BR /&gt;So I turned up my mind reading power setting to the very max and came up with this....&lt;BR /&gt;&lt;BR /&gt;Let's say you have a script needing a bunch of parameters like test_xxx = yyy&lt;BR /&gt;&lt;BR /&gt;Create a file test.ini containing:&lt;BR /&gt;&lt;BR /&gt;$ type test.ini&lt;BR /&gt;! here are the config overides&lt;BR /&gt;sleep = 12&lt;BR /&gt;scratch = some_device:&lt;BR /&gt;&lt;BR /&gt;Now read that in a loop and do some basic validation. Like making sure there is an equal sign. Decide whether to ignore, or report bad lines.&lt;BR /&gt;&lt;BR /&gt;Make the script for example be:&lt;BR /&gt;$ type test.com&lt;BR /&gt;$!default settings&lt;BR /&gt;$test_aap = "noot"&lt;BR /&gt;$test_scratch = "sys$login:"&lt;BR /&gt;$test_mies = 12345&lt;BR /&gt;$test_sleep = 999&lt;BR /&gt;$&lt;BR /&gt;$param_file = f$search("test.ini")&lt;BR /&gt;$if param_file.nes.""&lt;BR /&gt;$then&lt;BR /&gt;$close/nolog params&lt;BR /&gt;$open/error=init_done params 'param_file&lt;BR /&gt;$init_loop:&lt;BR /&gt;$ read/end=init_done params record&lt;BR /&gt;$ record = f$edit(record,"UNCOMMENT,COLLAPSE")&lt;BR /&gt;$ if record.nes.""&lt;BR /&gt;$ then&lt;BR /&gt;$  name = f$elem(0,"=",record)&lt;BR /&gt;$  value = f$elem(1,"=",record)&lt;BR /&gt;$  if value.eqs."" then goto init_loop&lt;BR /&gt;$  if f$type(value).eqs."INTEGER"&lt;BR /&gt;$  then&lt;BR /&gt;$    test_'name = 'value&lt;BR /&gt;$  else&lt;BR /&gt;$    test_'name = value&lt;BR /&gt;$  endif&lt;BR /&gt;$ endif&lt;BR /&gt;$ goto init_loop&lt;BR /&gt;$init_done:&lt;BR /&gt;$close/nolog params&lt;BR /&gt;$&lt;BR /&gt;$show symb test_*&lt;BR /&gt;$exit&lt;BR /&gt;&lt;BR /&gt;And you'll get: &lt;BR /&gt;&lt;BR /&gt;$ @test&lt;BR /&gt;  TEST_AAP = "noot"&lt;BR /&gt;  TEST_MIES = 12345   Hex = 00003039  Octal = 00000030071&lt;BR /&gt;  TEST_SCRATCH = "some_device:"&lt;BR /&gt;  TEST_SLEEP = 12   Hex = 0000000C  Octal = 00000000014&lt;BR /&gt;&lt;BR /&gt;No you can make that as fancy as needed.&lt;BR /&gt;Like you coudl test for existance (or not) for a symbol to be set. Check for quotes, or not. Check for presence in an (indexed) file. Protect against empty strings, Protect against bad names, and so on.&lt;BR /&gt;&lt;BR /&gt;Or you could have sub-sections, say delimited by [section_name].&lt;BR /&gt;Example of that below.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;$&lt;BR /&gt;$ typ test.ini&lt;BR /&gt;! here are the config overides&lt;BR /&gt;[process_1]&lt;BR /&gt;sleep = 12&lt;BR /&gt;scratch = some_device:&lt;BR /&gt;[process_2]&lt;BR /&gt;sleep = 13&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$&lt;BR /&gt;$ type test.com&lt;BR /&gt;$!default settings&lt;BR /&gt;$test_aap = "noot"&lt;BR /&gt;$test_scratch = "sys$login:"&lt;BR /&gt;$test_mies = 12345&lt;BR /&gt;$test_sleep = 999&lt;BR /&gt;$section = ""&lt;BR /&gt;$&lt;BR /&gt;$param_file = f$search("test.ini")&lt;BR /&gt;$if param_file.nes.""&lt;BR /&gt;$then&lt;BR /&gt;$close/nolog params&lt;BR /&gt;$open/error=init_done params 'param_file&lt;BR /&gt;$init_loop:&lt;BR /&gt;$ read/end=init_done params record&lt;BR /&gt;$ record = f$edit(record,"UNCOMMENT,COLLAPSE")&lt;BR /&gt;$ if record.nes.""&lt;BR /&gt;$ then&lt;BR /&gt;$ if f$extr(0,1,record).eqs."[" then section = f$extr(1,f$loc("]",record)-1,record) + "_"&lt;BR /&gt;$  name = f$elem(0,"=",record)&lt;BR /&gt;$  value = f$elem(1,"=",record)&lt;BR /&gt;$  if value.eqs."=" then goto init_loop&lt;BR /&gt;$  if f$type(value).eqs."INTEGER"&lt;BR /&gt;$  then&lt;BR /&gt;$    test_'section''name' = 'value&lt;BR /&gt;$  else&lt;BR /&gt;$    test_'section''name' = value&lt;BR /&gt;$  endif&lt;BR /&gt;$ endif&lt;BR /&gt;$ goto init_loop&lt;BR /&gt;$init_done:&lt;BR /&gt;$close/nolog params&lt;BR /&gt;$&lt;BR /&gt;$show symb test_*&lt;BR /&gt;$exit&lt;BR /&gt;$&lt;BR /&gt;$ @test&lt;BR /&gt;  TEST_AAP = "noot"&lt;BR /&gt;  TEST_MIES = 12345   Hex = 00003039  Octal = 00000030071&lt;BR /&gt;  TEST_PROCESS_1_SCRATCH = "some_device:"&lt;BR /&gt;  TEST_PROCESS_1_SLEEP = 12   Hex = 0000000C  Octal = 00000000014&lt;BR /&gt;  TEST_PROCESS_2_SLEEP = 13   Hex = 0000000D  Octal = 00000000015&lt;BR /&gt;  TEST_SCRATCH = "sys$login:"&lt;BR /&gt;  TEST_SLEEP = 999   Hex = 000003E7  Octal = 00000001747&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Apr 2008 19:20:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172796#M43627</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-04-02T19:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172797#M43628</link>
      <description>Some options:&lt;BR /&gt;&lt;BR /&gt;- using an implementation environment other than DCL?  (DCL has its place, but it's also a comparatively blunt weapon.)&lt;BR /&gt;&lt;BR /&gt;- using XML or another format suited for the data transfer and data manipulation.  (There are tools around to deal with XML for you.)&lt;BR /&gt;&lt;BR /&gt;- reading the data in using a standard DCL "read until EOF" loop (as Hein shows in his reply, and as examples are available elsewhere), and defining a logical name or a global symbol for the data?&lt;BR /&gt;&lt;BR /&gt;- through more formal assistance with your DCL coding requirements?&lt;BR /&gt;&lt;BR /&gt;- with a look at the OpenVMS User's Guide or (if you can find a copy) my Writing Real Programs in DCL?&lt;BR /&gt;&lt;BR /&gt;- by re-architecting the particular problem here to avoid this cascading requirement?  Could be use of an indexed file, or otherwise.  (Inter-procedural dependencies using global symbols and logical names to propogate data can tend to lead to odd errors, as the approach is non-reentrant, subtle, and comparatively tough to clean up on errors.)&lt;BR /&gt;&lt;BR /&gt;I'm sure I've missed an option or three...&lt;BR /&gt;&lt;BR /&gt;Stephen Hoffman&lt;BR /&gt;HoffmanLabs LLC&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Apr 2008 19:52:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172797#M43628</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2008-04-02T19:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172798#M43629</link>
      <description>I currently have a job scheduler that passes 8 parameters to a command procedure, which assigns the values as symbols to eliminate any hard coding. The problem is that I need to increase the number of parameters being passed to the command procedure, which exceeds the limit of the job scheduler.&lt;BR /&gt;&lt;BR /&gt;What I would like to do is modify the command procedure to initially read in a file that contains parameter information (12 records) and then use the values within the command procedure.&lt;BR /&gt;Example of command procedure:&lt;BR /&gt;$ username   = P1&lt;BR /&gt;$ business_model_instance   = P2&lt;BR /&gt;$ warehouse_model_instance  = P3&lt;BR /&gt;$ bit_string  = P4&lt;BR /&gt;$ environment = P5&lt;BR /&gt;$ ods_admin = P6&lt;BR /&gt;$ warehouse_admin = P7&lt;BR /&gt;&lt;BR /&gt;! Production or Development?&lt;BR /&gt;$!&lt;BR /&gt;$ @wipdss_base_root:[config]wipdss_env.com 'environment&lt;BR /&gt;&lt;BR /&gt;Thanks, Brett</description>
      <pubDate>Thu, 03 Apr 2008 13:52:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172798#M43629</guid>
      <dc:creator>Brett_59</dc:creator>
      <dc:date>2008-04-03T13:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172799#M43630</link>
      <description>If the symbols are short, cram them into the existing parameters.  &lt;BR /&gt;&lt;BR /&gt;Multiplex one or more the available P1 through P8. &lt;BR /&gt;&lt;BR /&gt;You can use f$element and such to process a | or , or # separated list within a parameter, and reconstitute the parameters.&lt;BR /&gt;&lt;BR /&gt;Another option is to use a small temporary file, say MY_XYZ_pid.TMP or some other unique value, and write out the parameters there.  You can use a format such as:&lt;BR /&gt;&lt;BR /&gt;$ MY_FOO=xyz&lt;BR /&gt;$ MY_BAR=pdq&lt;BR /&gt;$ MY_THIS=here&lt;BR /&gt;&lt;BR /&gt;The sneaky trick is that you can then @ the file, and use the values.  (AUTOGEN uses a form of this.)  This isolates you from previous runs and dreck left around in the global symbol tables, and allows you to isolate and test and verify the procedures.&lt;BR /&gt;&lt;BR /&gt;If you do this, I'd suggest use of a prefix on the soon-to-be symbols such as MY_ or PARAM_ (or whatever) to visually identify the source of the symbols.&lt;BR /&gt;&lt;BR /&gt;You can also open the file and process the values directly using implicit parameter labeling.  Parameter P1 could be the first line read, and Pn the last.  SMOP.&lt;BR /&gt;&lt;BR /&gt;I'd not pass stuff around using global symbols or shared logical names.  That's a very inviting, but much harder to keep a lid on it all.  The dependencies get far tougher to locate.&lt;BR /&gt;&lt;BR /&gt;OPEN, CLOSE, READ and WRITE are standard DCL commands, and there are a gazillion examples around.  I would encourage a look at the OpenVMS User's Guide and other materials that introduce DCL programming, as well.  When working with DCL, you'll receive a larger benefit than the time that was originally spent skimming the manuals.&lt;BR /&gt;&lt;BR /&gt;And one wrinkle:&lt;BR /&gt;&lt;BR /&gt;Before you OPEN a file, always issue a CLOSE /NOLOG on the channel.  This because DCL can hold a file open, and will pick up where it left off if several OPEN commands are aimed at the same file.  CLOSE /NOLOG avoids this.&lt;BR /&gt;&lt;BR /&gt;Here's a trivial file read loop:&lt;BR /&gt;&lt;BR /&gt;$ CLOSE/NOLOG iochan&lt;BR /&gt;$ OPEN/READ iochan SYS$SCRATCH:XYZ.TMP&lt;BR /&gt;$LOOP:&lt;BR /&gt;$ READ/END=EOF iochan data&lt;BR /&gt;$ WRITE SYS$OUTPUT "Data &amp;lt;''data'&amp;gt;"&lt;BR /&gt;$ GOTO LOOP&lt;BR /&gt;$DONE:&lt;BR /&gt;$ EXIT&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;&lt;BR /&gt;Stephen Hoffman&lt;BR /&gt;HoffmanLabs LLC&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Apr 2008 14:26:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172799#M43630</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2008-04-03T14:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172800#M43631</link>
      <description>@ Hoff:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;$ READ/END=EOF iochan data&lt;BR /&gt;$ WRITE SYS$OUTPUT "Data &amp;lt;''data'&amp;gt;"&lt;BR /&gt;$ GOTO LOOP&lt;BR /&gt;$DONE:&lt;BR /&gt;&amp;lt;&amp;lt;&amp;lt;&lt;BR /&gt;&lt;BR /&gt;Slight, but relevant nitpickings:&lt;BR /&gt;&lt;BR /&gt;At END_OF_FILE you specify to proceed to lable EOF.&lt;BR /&gt;&lt;BR /&gt;But instead of EOF: you expect DONE: to provide the loop exit.&lt;BR /&gt;Secondly, it is considered real bad habit to NOT close a file after finishing with it!&lt;BR /&gt;&lt;BR /&gt;fwiw&lt;BR /&gt;&lt;BR /&gt;Proost.&lt;BR /&gt;&lt;BR /&gt;Have one on me.&lt;BR /&gt;&lt;BR /&gt;jpe&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Apr 2008 14:55:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172800#M43631</guid>
      <dc:creator>Jan van den Ende</dc:creator>
      <dc:date>2008-04-03T14:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172801#M43632</link>
      <description>Ok, so I'm composing DCL in a 48x18 window without a test run.</description>
      <pubDate>Thu, 03 Apr 2008 14:56:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-scripting-command-procedure/m-p/4172801#M43632</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2008-04-03T14:56:37Z</dc:date>
    </item>
  </channel>
</rss>

