- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Can you do a F$EXTRACT on a PIPE output
Operating System - OpenVMS
1753288
Members
5835
Online
108792
Solutions
Forums
Categories
Company
Local Language
юдл
back
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
юдл
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
тАО10-14-2010 07:59 AM
тАО10-14-2010 07:59 AM
Re: Can you do a F$EXTRACT on a PIPE output
>> I should have mentioned I wanted it to loop.
Then you can not just use a 'one liner'.
You'll need a helper command file, or a better programming language.
For example, with tmp.com being
-----
$open/read pipe sys$pipe
$loop:
$read/end=done pipe rec
$write sys$output f$ext(37,17,rec)
$goto loop
$done:
----------
$ pipe search/match=and tmp.tmp 8148, 5.00 | @tmp
I suppose you could generate the helper on the fly, and delete. I sometimes 'embed' it in the main procedure, calling itself with a label to jump to.
------ $!test.com
$if p1.nes."" then goto 'p1
$pipe ... | @'f$env("procedure") print_it
:
$exit
$print_it:
$open/read ...
$loop:
$ ...
$goto loop
--------
But if you go that route, why not have the DCL script do the loop/search?
(Possible answer... too much data to process efficiently by DCL )
-----
$close/nolog tmp
$open/read tmp tmp.tmp
$loop:
$read/end=done tmp rec
$if f$len(rec).eq.f$loc("8148",rec) .or. f$len(rec).eq.f$loc("5.0",rec) then goto loop
$write sys$output f$ext(37,17,rec)
$goto loop
$done:
$close tmp
-------------
Or just using perl:
$ perl -lne "print $1 if /5.00\s+(8148.{10})/" tmp.tmp
But surely that little table is not the end goal.
And possible those 5.0 and 8148 are not really string constants.
So what are the prior and next steps?
What is the real problem you are trying to solve?
pipe's may or might not be useful in solving the real problem.
Perl or awk may or might not be more useful
Hein
Then you can not just use a 'one liner'.
You'll need a helper command file, or a better programming language.
For example, with tmp.com being
-----
$open/read pipe sys$pipe
$loop:
$read/end=done pipe rec
$write sys$output f$ext(37,17,rec)
$goto loop
$done:
----------
$ pipe search/match=and tmp.tmp 8148, 5.00 | @tmp
I suppose you could generate the helper on the fly, and delete. I sometimes 'embed' it in the main procedure, calling itself with a label to jump to.
------ $!test.com
$if p1.nes."" then goto 'p1
$pipe ... | @'f$env("procedure") print_it
:
$exit
$print_it:
$open/read ...
$loop:
$ ...
$goto loop
--------
But if you go that route, why not have the DCL script do the loop/search?
(Possible answer... too much data to process efficiently by DCL )
-----
$close/nolog tmp
$open/read tmp tmp.tmp
$loop:
$read/end=done tmp rec
$if f$len(rec).eq.f$loc("8148",rec) .or. f$len(rec).eq.f$loc("5.0",rec) then goto loop
$write sys$output f$ext(37,17,rec)
$goto loop
$done:
$close tmp
-------------
Or just using perl:
$ perl -lne "print $1 if /5.00\s+(8148.{10})/" tmp.tmp
But surely that little table is not the end goal.
And possible those 5.0 and 8148 are not really string constants.
So what are the prior and next steps?
What is the real problem you are trying to solve?
pipe's may or might not be useful in solving the real problem.
Perl or awk may or might not be more useful
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2010 01:57 PM
тАО10-14-2010 01:57 PM
Re: Can you do a F$EXTRACT on a PIPE output
Niall,
PIPE is great, but can often get too convoluted to be worthwhile. Pipe stages through command procedures to write more complex code.
You'd think that doing everything in memory would outperform writing to disk, but counterintuitively, PIPE is usually MUCH slower (but you avoid generating temp files and the need to clean up). For complex text processing a Perl script will usually be simpler and faster.
Regarding /ERROR or dealing with errors in general. Don't forget there are "&&" (if success) and "||" (if error) separators. Unfortunately you need to explicitly return status, if your mainline needs to know the result.
Examples:
$ PIPE (SHOW JUNK && SHOW TIME || EXIT &$STATUS.OR.%X10000000)
$ SHOW SYM $STATUS
$STATUS == "%X10038060"
or
$ PIPE (SHOW JUNK || EXIT &$STATUS.OR.%X10000000 && SHOW TIME ; SHOW PROCESS ; SHOW SYSTEM)
[.OR. with STS$M_INHIB_MSG to prevent duplicate error message when exiting the pipe.]
PIPE is great, but can often get too convoluted to be worthwhile. Pipe stages through command procedures to write more complex code.
You'd think that doing everything in memory would outperform writing to disk, but counterintuitively, PIPE is usually MUCH slower (but you avoid generating temp files and the need to clean up). For complex text processing a Perl script will usually be simpler and faster.
Regarding /ERROR or dealing with errors in general. Don't forget there are "&&" (if success) and "||" (if error) separators. Unfortunately you need to explicitly return status, if your mainline needs to know the result.
Examples:
$ PIPE (SHOW JUNK && SHOW TIME || EXIT &$STATUS.OR.%X10000000)
$ SHOW SYM $STATUS
$STATUS == "%X10038060"
or
$ PIPE (SHOW JUNK || EXIT &$STATUS.OR.%X10000000 && SHOW TIME ; SHOW PROCESS ; SHOW SYSTEM)
[.OR. with STS$M_INHIB_MSG to prevent duplicate error message when exiting the pipe.]
A crucible of informative mistakes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2010 01:19 AM
тАО10-15-2010 01:19 AM
Re: Can you do a F$EXTRACT on a PIPE output
Thanks all for your responses.
- « Previous
-
- 1
- 2
- Next »
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP