- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Using PIPE to Open and Read a File
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-20-2006 02:05 PM
тАО04-20-2006 02:05 PM
Using PIPE to Open and Read a File
PIPE OPEN/READ/SHARE FILUN FNAME.TXT | READ FILUN FSTR | CLOSE FILUN | FILDAT=F$EXTRACT(73,6,FSTR) | IF "''FILDAT'" .NES. "060420" THEN EXIT 44
Please help - thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-20-2006 02:58 PM
тАО04-20-2006 02:58 PM
Re: Using PIPE to Open and Read a File
$ @COMPARE_STUFF
where compare_stuff.com contains the open/read/close
etc...?
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-20-2006 04:12 PM
тАО04-20-2006 04:12 PM
Re: Using PIPE to Open and Read a File
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-20-2006 04:41 PM
тАО04-20-2006 04:41 PM
Re: Using PIPE to Open and Read a File
Yes, you can use PIPE to do this, but since this is really a sequence of commands to be executed sequentially, rather than a cascade of pipes, you need to enclose the sequence in parentheses and use the ";" separator, rather than "|"
So,
$ PIPE (OPEN/READ/SHARE FILUN FNAME.TXT ; -
READ FILUN FSTR ; CLOSE FILUN ; -
FILDAT=F$EXTRACT(73,6,FSTR) ; -
IF FILDAT.NES."060420" THEN EXIT 44)
Note you must have a space on either side of every ";" character so DCL knows it's not a file version number delimiter. I've also used continuation characters and explicit line feeds to make it more readable, but it could just be one long command.
Note that since it's just the first line you're interested in, using a "real" pipe you can shorten the sequence to:
$ PIPE TYPE FNAME.TXT | -
(READ SYS$PIPE FSTR ; -
FILDAT=F$EXTRACT(73,6,FSTR) ; -
IF FILDAT.NES."060420" THEN EXIT 44)
Although it's less characters, it involves an extra process creation, so may be slower.
As others have pointed out, this could be done using a command procedure, but then the pipe command could be stored in a single symbol, thus making it independent of a file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-21-2006 04:14 AM
тАО04-21-2006 04:14 AM
Re: Using PIPE to Open and Read a File
Thomas - thanks for that.
John - your response was quite helpful and the first one worked perfectly. Thank You VERY MUCH!!!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-21-2006 05:52 AM
тАО04-21-2006 05:52 AM
Re: Using PIPE to Open and Read a File
Check out: $pipe ( show proc )
It would be kinda nice if DCL understood the parenthesis syntax without a pipe & subprocess:
$(command-1; command-2; ... )
Might I suggest:
$ perl -e "exit 44 if ('060420' ne substr <>,73,6)" fname.txt
hth,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2006 05:47 AM
тАО04-24-2006 05:47 AM
Re: Using PIPE to Open and Read a File
$ PIPE OPEN/READ/SHARE FILUN FNAME.TXT ; -
READ FILUN FSTR ; CLOSE FILUN ; -
FILDAT=F$EXTRACT(73,6,FSTR) ; -
IF FILDAT.NES."060420" THEN EXIT 44
You might want to use && in place of the first two ;s since if you can't open or read the file then the rest can't be done either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2006 07:43 AM
тАО04-24-2006 07:43 AM
Re: Using PIPE to Open and Read a File
it is not the parentheses that give rise to the subproces, it is the PIPE command that does that.
So, your solution also creates a subprocess.
fwiw,
Proost.
Have one on me (perhaps in May in Nashua>)
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2006 09:05 AM
тАО04-24-2006 09:05 AM
Re: Using PIPE to Open and Read a File
Check out:
$Help pipe description
or try:
$show proc
$ pipe open x x.tmp ; read x y ; show process ; show symb y
Jess,
Thanks for that entry. You are right. I only ever used pipe to pipe into a next process, but that's only one of its features. I learned something new today!
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2006 10:14 PM
тАО04-24-2006 10:14 PM
Re: Using PIPE to Open and Read a File
Hein, that makes 2 who learned! Until now I took "PIPE = create subprocess" for granted.
Thanks, Jess!
Proost.
Have one on me (maybe in May in Nashua?)
jpe