[Info-vax] /END=label

Tim Sneddon tsneddon at panix.com
Mon Aug 27 22:48:16 EDT 2018


Stephen Hoffman <seaohveh at hoffmanlabs.invalid> wrote:
> On 2018-08-27 06:56:47 +0000, Marc Van Dyck said:
> 
>> One last question - for now - maybe...
>> 
>> In the DCL READ command, there is a qualifier /END that branches the 
>> current procedure to a label if an end of file condition has been 
>> reached.
>> 
>> Is there a - possibly undocumented - way to implement something similar 
>> in a user-written program implemented as a DCL command ?
> 
> Try lib$do_command, though I shudder at suggesting that, and haven't 
> tried that for this usage.  Emit a GOTO command, if that wasn't 
> obvious.  And I haven't tried this particular abomination.
> 

Okay, so I will out myself...I've done this before and it does work.  I
rummaged and found the test I wrote some years ago to test it.

Here is the DCL:

  bender_VTA32> type goto_test.com
  $ set verify
  $ set noon
  $
  $ go_to == "$sys$disk:[]go_to"
  $
  $ go_to works
  $
  $doesnt_work:
  $ say "This does not work"
  $ goto bail_out
  $
  $works:
  $ say "This does work"
  $ goto bail_out
  $
  $bail_out:
  $ set noverify

Here is the PL/I program:

  bender_VTA32> type go_to.pli
  go_to: proc options(main);
  %include $libdef;
  %include $stsdef;
  %include lib$do_command;
  %include lib$get_foreign;
  %include lib$signal;

      dcl label var char(32);

      sts$value = lib$get_foreign(label);
      if (sts$success) then
          sts$value = lib$do_command('GOTO ' || label);

      call lib$signal(sts$value);
  end;

And the evidence that such a crime is possible:

  bender_VTA32> pli go_to
  bender_VTA32> @goto_test
  $ set noon
  $
  $ go_to == "$sys$disk:[]go_to"
  $
  $ go_to works
  $works:
  $ say "This does work"
  This does work
  $ goto bail_out
  $bail_out:
  $ set noverify

So, there you have it :-)

Regards, Tim.



More information about the Info-vax mailing list