- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Pipe result to DCL symbol
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
тАО05-10-2005 05:02 AM
тАО05-10-2005 05:02 AM
sea file.txt/noout/stat|sea sys$input matched
I would like to get the number of hits from the seach directly into a symbol without writting a temp file, and reading it back in.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 05:11 AM
тАО05-10-2005 05:11 AM
Re: Pipe result to DCL symbol
you can't directly put the result into a symbol from PIPE, as the piped commands run in subprocesses and you can't pass a symbol back from a subprocess. You need to use a logical as a workaround.
here is an example:
$ pipe sea login.com/noout/stat x |search sys$pipe matched| ( read sys$pipe x ; y=F$ELEMENT(2," ",F$EDIT(x,"TRIM,COMPRESS"))
$ count = F$TRNLNM("COUNT")
$ sho sym count
COUNT = "18"
$ deass/job count
Volker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 05:30 AM
тАО05-10-2005 05:30 AM
Re: Pipe result to DCL symbol
To do that for the search statistics, write a DCL command-file, which basically does:
$ line = ""
$loop:
$read/end=done sys$pipe line
$if f$extract(0,16,line).eqs."Records matched:" then goto done
$goto loop
$done:
$ define/job myresult "''line"
$ exit
$! or extract the matched number from line and define that in logical name.
Then call it like:
$PIPE search/stat/window=0 myfile mystring | @commandfile
$mysymbol=f$trnlnm(myresult)
$deass/job myresult
$if mysymbol.eqs."" then goto errorhandling
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 05:46 AM
тАО05-10-2005 05:46 AM
Re: Pipe result to DCL symbol
but add at the end of the pipe command:
; define/job count &y)
to make it complete.
And in general, use a command-file in a pipe
to define a logical, if You expect something different than a number or a single "word":
the content of &y must be a legal parameter 2
(and no more) for the define command.
Therefore parse and make sure it is legal (by simply enclosing it in "" quotes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 06:14 AM
тАО05-10-2005 06:14 AM
Re: Pipe result to DCL symbol
thanks for the correction. It worked on my OpenVMS system, so the rest of the command line must have got lost in the cut & paste exercise ;-(
Volker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 06:17 AM
тАО05-10-2005 06:17 AM
Re: Pipe result to DCL symbol
Volkers solution appears to miss the DEFINE/JOB in the sub shell.
I tried a few times, but failed to add that readily in the onle liner, notably because command line editing gets nasty after 132 chars or so.
I would suggest you check out PERL.
This give you regular expressions to boot!
It can solve the problem in the same process with a single image activation:
$ cre tmp.tmp
aap
getjpi
noot
GETJPI
mies
$
$ perl -ne "$ENV{COUNT}=++$match if (/getjpi/i)" < tmp.tmp
$
$ show log count
"COUNT" = "2" (LNM$PROCESS_TABLE)
-n = loop though sys$input
-e = immediate program text follows
< = take sys$input from specified file
%ENV is an associative array magically mapped onto logical name spaces (and more!)
/getjpi/ is the match string I happen to have used.
/getjpi/i makes it case insensitive
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2005 06:32 AM
тАО05-10-2005 06:32 AM
Solution$ pipe sea login.com/noout/stat x |search sys$pipe matched| ( -
_$ read sys$pipe x ; y=F$ELEMENT(2," ",F$EDIT(x,"TRIM,COMPRESS")) -
_$ ; def/job count &y )
$ sho log count
"COUNT" = "18" (LNM$JOB_821A4BC0)
Volker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2005 04:29 AM
тАО05-11-2005 04:29 AM