- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: DCL logical operator
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
тАО06-17-2010 10:16 AM
тАО06-17-2010 10:16 AM
if (f$search("ABC.DAT") .nes. "") .and. f$attribute("ABC.DAT","EOF") .ne. 0)
then
! do something
endif
this code doent work when file in not present. f$attribute throws error.
Why is second expression evaluated when first is not true ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2010 10:34 AM
тАО06-17-2010 10:34 AM
SolutionBecause DCL is an interpretive "language", the entire line is parsed at the same time with symbol substitutions done "in-line". In this case, both expressions are equated to "temporary" symbols and then evaluated for the equivalences and logic tests.
In a case like this the statement should be in the following format:
IF f$search("abc.dat") .eqs. "" then skip_it
ELSE
IF F$attribute...
then
!do something
endif
ENDIF
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2010 10:44 AM
тАО06-17-2010 10:44 AM
Re: DCL logical operator
The DCL interpreter processes the whole command for symbol substitutions (in a couple of phases), and then figures out what to do with the results.
DCL is an old-school and comparatively ancient command interpreter, and DCL procedures can thus have all sorts of interesting and even self-modifying behaviors. Which is why DC interpreter tends to process the whole command.
The definition of DCL syntax (for what that is) doesn't particularly lend itself to compilation, either.
There are other interesting behaviors you may encounter on your journey, such as specific cases where the contents of DCL comments can be executed. Not ignored.
Regardless of how it works or how you might think it should work, DCL processing is also comparatively unlikely to change in any significant fashion, given its existing and massive installed-base problem. The comment case was an old bug in DCL, and code became dependent on it, so DCL was changed (back) to allow the cases that were used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2010 11:02 AM
тАО06-17-2010 11:02 AM
Re: DCL logical operator
Thanks Hoff for further insight and interesting fact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2010 11:06 AM
тАО06-17-2010 11:06 AM
Re: DCL logical operator
just to be clear, you really used f$file() right?
The behaviour stands, but just to be clear.
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2010 01:24 PM
тАО06-17-2010 01:24 PM
Re: DCL logical operator
Note that your expectation of shortcut logical evaluation depends on the rules of the language. Even for compiled languages, there are numerous different rules which may be applied.
Some languages always shortcut, some never shortcut, some have different operators for complete or shortcit evaluation, and others (notably Fortran) are defined to allow the compiler to rearrange a logical expression as it sees fit.
In situations such as yours, where the validity of one term in the expression is dependent on another, or where side effects of evaluating one term may affect another, you need to be careful that your assumptions match the rules of the language.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2010 07:42 PM
тАО06-17-2010 07:42 PM
Re: DCL logical operator
>>if (f$search("ABC.DAT") .nes. "") .and. f$attribute("ABC.DAT","EOF") .ne. 0)
Couple of things about this
* There is nothing like f$attribute. I guess you meant f$file_attributes
* There is syntax error in the above line. the second expression is missing a
bracket. It should rather be
$if (f$search("ABC.DAT") .nes. "") .and. (f$file_attribute("ABC.DAT","EOF") .ne. 0)
>>Why is second expression evaluated when first is not true ?
You would expect this to work in a C program for example.
But as others have already explained, DCL parsing stuff does not work like that.
You have to modify your program based on how DCL works. Something like -
$ if (f$search("ABC.DAT") .eqs. "") then GOTO skip_file
$ if f$file_attribute("ABC.DAT","EOF") .ne. 0
$ then
$ ! Handle file ...
$ endif
$
$ skip_file:
$ !skip file handling
$ ...
Hope this helps.
Regards,
Murali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2010 06:16 PM
тАО06-18-2010 06:16 PM
Re: DCL logical operator
Looks like you are new to the forum.
Check the following link which says how to thank the forum -
http://forums11.itrc.hp.com/service/forums/helptips.do?#28
Regards,
Murali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-20-2010 10:27 AM
тАО06-20-2010 10:27 AM