Check that file exists: Difference between revisions
added PL/I
Walterpachl (talk | contribs) (added PL/I) |
|||
Line 969:
}
}</lang>
=={{header|PL/I}}==
<lang pli>*Process source or(!);
/*********************************************************************
* 20.10.2013 Walter Pachl
* 'set dd:f=d:\_l\xxx.txt,recsize(300)'
* 'tex'
*********************************************************************/
tex: Proc Options(main);
Dcl fid Char(30) Var Init('D:\_l\tst.txt');
Dcl xxx Char(30) Var Init('D:\_l\nix.txt');
Dcl r Char(1000) Var;
Dcl f Record input;
On Undefinedfile(f) Goto label;
Open File(f) Title('/'!!fid);
Read file(f) Into(r);
Put Skip List('First line of file '!!fid!!': '!!r);
Close File(f);
Open File(f) Title('/'!!xxx);
Read file(f) Into(r);
Put Skip List(r);
Close File(f);
Label: Put Skip List('File '!!xxx!!' not found');
End;</lang>
Output:
<pre>
First line of file D:\_l\tst.txt: Test line 1
File D:\_l\nix.txt not found
</pre>
=={{header|Pop11}}==
|