Created
October 1, 2019 23:06
-
-
Save RomanHargrave/e1bcd3848845c1c7d6f20bfbd5e6dc41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$! | |
$! Demo of WTF semantics | |
$! | |
$ | |
$! assume that the first line in this file is ' KEY' | |
$ open/read fh EXAMPLE:[EXAMPLE]FILE.DAT | |
$ | |
$! this should not reach EOF before finding a match, setting the global symbol 'line' and returning 1 | |
$ call this_always_returns_two fh "KEY" | |
$ | |
$! the below will print '%X00030001' if reached; | |
$! however, before that can happen, the entire program will terminate with status '%X00000002' | |
$ write sys$output "status: ''$status'" | |
$ | |
$ exit | |
$ | |
$ this_always_returns_two: subroutine | |
$ check_record: | |
$ read/end_of_file=eof P1 chk_line | |
$ if f$extract(1,6,chk_line) .eqs. "''P2'" | |
$ then | |
$ line == chk_line | |
$ return 1 | |
$ else | |
$ goto check_record | |
$ endif | |
$ eof: | |
$ return 2 | |
$ endsubroutine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment