- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Could command search return a status of 1 if nomat...
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
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
тАО08-25-2010 06:04 PM
тАО08-25-2010 06:04 PM
$ search 'log_file' "-w-", "-acconflict" /match=xor /out='tmp_file'1
$ sh sym $status
$ if $status .eq. 1
$ then
$ search 'tmp_file'1 "-w-", "-nosuchfile" /match=xor /out='tmp_file'2
$ search SOS_BACKUP_LOG:ALPHASYS-2508.LIS "-w-", "-acconflict" /match=xor /out=
SOS_BACKUP_LOG:BACKUP.TMP1
%SEARCH-I-NOMATCHES, no strings matched
$ sh sym $status
$STATUS = "%X00000001"
$ if $status .eq. 1
$ then
$ search SOS_BACKUP_LOG:BACKUP.TMP1 "-w-", "-nosuchfile" /match=xor /out=SOS_
BACKUP_LOG:BACKUP.TMP2
%SEARCH-I-NULLFILE, file DISK1:[SOS_BACKUP.LOG]BACKUP.TMP1;1 contains no records
%SEARCH-I-NOMATCHES, no strings matched
$
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 06:15 PM
тАО08-25-2010 06:15 PM
Re: Could command search return a status of 1 if nomatch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 06:30 PM
тАО08-25-2010 06:30 PM
Re: Could command search return a status of 1 if nomatch
it doesn't matter if it is a string or integer. DCL will try to convert the symbol to integer first.
My question is if nomatches occurs during search. The exit status should not be "%X00000001" but "%X08D78053".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 06:56 PM
тАО08-25-2010 06:56 PM
Solution$ sh sym $status
$STATUS = "%X00000001"
When I do it from a command procedure I get
$STATUS == "%X08D78053"
Note the == compared to your =. Are you accessing a local symbol $STATUS rather than the global symbol.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 06:56 PM
тАО08-25-2010 06:56 PM
Re: Could command search return a status of 1 if nomatch
The program output that you have provided is strange.
I tried a similar program and was got $STATUS as "%X08D78053".
I tried this on V84 Integrity.
Which OpenVMS version are you using ?
Regards,
Murali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 07:21 PM
тАО08-25-2010 07:21 PM
Re: Could command search return a status of 1 if nomatch
John,
You found the problem.
There is a local assignment in the calling procedure.
$STATUS = F$TRNLNM("ERROR_STAT")
I will fix that.
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 07:21 PM
тАО08-25-2010 07:21 PM
Re: Could command search return a status of 1 if nomatch
The LOCAL symbol $status presumably with some old status value is hiding/masking/whatever-you-want-to-call-it the global symbol $status which holds the current status.
Try this:
$ tmp.com
$ create tmp.tmp
$ $status = $status
$ show symb/glo $status
$ show symb/loc $status
$ sear tmp.tmp blah
$ show symb/glo $status
$ show symb/loc $status
$ exit
$ @tmp
hth,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 07:31 PM
тАО08-25-2010 07:31 PM
Re: Could command search return a status of 1 if nomatch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2010 11:08 PM
тАО08-25-2010 11:08 PM
Re: Could command search return a status of 1 if nomatch
There are some other issues in the code you posted...
Ignoring any overloading of the symbol name "$status", let's look at this snippet:
>$ search 'log_file' "-w-", "-acconflict" /match=xor /out='tmp_file'1
>$ sh sym $status
>$ if $status .eq. 1
You should think of $STATUS and $SEVERITY being set at the end of *any* command, thus your code risks testing the status of the SHOW SYMBOL command, rather than of the SEARCH command.
As it happens, a *successful* SHOW SYMBOL command does not change $STATUS, but that's an inconsistency in DCL, most likely intended to make sequences like yours work.
However, the general case is $STATUS is changed after every command. If, for example, you wrote:
$ search 'log_file' "-w-", "-acconflict" /match=xor /out='tmp_file'1
$ WRITE SYS$OUTPUT "SEARCH status=",$status
$ IF $STATUS.EQ. 1
you would be testing $STATUS from the WRITE command.
You're much safer copying the $STATUS from the command of interest into a local variable:
$ search 'log_file' "-w-", "-acconflict" /match=xor /out='tmp_file'1
$ stat=$status
$ SHOW SYM stat
$ IF stat.EQ. 1
Another issue.
In testing OpenVMS status values (better described as OpenVMS Condition Codes), it's never a good idea to do a direct comparison. That's because $STATUS is really a record of bit fields, parts of which may or may not be set without affecting the meaning of the value. See the OpenVMS Programming Concepts manual for detail about how condition codes are formed and how to correctly interpret them.
For some purposes it's better to look at $SEVERITY than $STATUS. It will tell you if the result is Warning, Success, Error, Informational or Fatal. If you need more detail, you should mask off the field of interest. Here are the (hex) masks for the bit fields:
STS$M_SUCCESS =%X1
STS$M_SEVERITY =%X7
STS$M_MSG_NO =%XFFF8
STS$M_CODE =%X7FF8
STS$M_FAC_SP =%X8000
STS$M_FAC_NO =%XFFF0000
STS$M_COND_ID =%XFFFFFF8
STS$M_CONTROL =%XF0000000
STS$M_CUST_DEF =%X8000000
STS$M_INHIB_MSG =%X10000000
AND the mask with $STATUS to test that field. For example:
$ IF stat.AND.STS$M_SUCCESS
$ THEN
$ good status
$ ELSE
$ bad status
$ ENDIF
or if you want to test for a specific message number,
$ SEARCH$_NOMATCHES=%X8050
$ IF (stat.AND.STS$M_MSG_NO).EQ.SEARCH$_NOMATCHES
$ THEN
$ nomatches
$ ELSE
$ something else
$ ENDIF