- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Fortran IAND equivalent command in VMS DCL
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-22-2006 02:02 PM
тАО05-22-2006 02:02 PM
Is there an equivalent VMS DCL command of Fortran IAND? I am trying to figure out how to check in DCL if a bit mask has been set for a database field. The database field has been exported to a text file and I extract the database field from the text string.
Here is the sample Fortran code that I want to copy over in DCL/VMS .COM file.
logical*4 function bit_check (arg1,arg2)
implicit none
integer*4 arg1,arg2
bit_check = 0 .ne. IAND (arg1,arg2)
return
end
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2006 02:09 PM
тАО05-22-2006 02:09 PM
Re: Fortran IAND equivalent command in VMS DCL
The operator is ".AND."
Example:
$ X = 5
$ Y = 7
$ WRITE SYS$OUTPUT X .AND. Y
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2006 02:48 PM
тАО05-22-2006 02:48 PM
Re: Fortran IAND equivalent command in VMS DCL
Thanks for the quick reply! Although I am not getting the result that I need.
I need to be able to check an integer symbol if it has a particular bit mask turned on.
$ open infile test.tab
$ read infile inrecord
$ flags = f$extract(104,12,inrecord)
$ show sym flags
FLAGS = " 320"
$ flag1 = 1
$ flag2 = 2
$ flag3 = 4
$ flag4 = 8
$ flag5 = 16
$ flag6 = 32
$ flag7 = 64
$ flag8 = 128
$ flag9 = 256
$ numflags = f$integer(flags)
$ show sym numflags
NUMFLAGS = 320 Hex = 00000140 Octal = 00000000500
$ if flag7 .AND. numflags then write sys$output "flag7 is on"
$ if flag9 .AND. numflags then write sys$output "flag9 is on"
The flags value of 320 is a combination of flag7 (64) and flag9 (256).
What am I doing wrong? Or is this even possible in DCL?
Thanks again!
Kind regards,
Nelson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2006 03:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2006 03:54 PM
тАО05-22-2006 03:54 PM
Re: Fortran IAND equivalent command in VMS DCL
$ if flag9 .AND. numflags then write sys$output "flag9 is on"
The expression will be true if flag7 = numflags.
If numflags is 320 then then it will never be true. 64 is 1000000. 320 is 101000000.
You are confusioning vectors with masks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2006 04:03 PM
тАО05-22-2006 04:03 PM
Re: Fortran IAND equivalent command in VMS DCL
F$CVSI
Converts the specified bits in the specified character string to
a signed number.
Format
F$CVSI(start-bit,number-of-bits,string)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2006 04:34 PM
тАО05-22-2006 04:34 PM
Re: Fortran IAND equivalent command in VMS DCL
Your .AND. will result in the test flag being set, but that is not bit 0.
But if the value (320 has either flag7 or flag9 set then an AND with that delivers a non-zero value. Thus, as David write test for non-zero:
$ flag7 = 64
$ x = 320
$ y = x.and.flag7
$ show symb y
Y = 64 Hex = 00000040 Octal = 00000000100
$ if y then write sys$output "true"
$ z = (x.and.flag7).ne.0
$ show symb z
Z = 1 Hex = 00000001 Octal = 00000000001
$ if z then write sys$output "true"
true
$
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2006 05:29 PM
тАО05-22-2006 05:29 PM
Re: Fortran IAND equivalent command in VMS DCL
> being on or off.
Same as in Fortran, right? Which is why the
test in the Fortran code was "0 .ne.[...]"
Come to think of it, who still uses IAND()
in Fortran? Logical operators (like .AND.)
have been in common use for decades.
In other words, logical operations in DCL
look and act a lot like logical operations in
Fortran, unless your Fortran dates back to
1966.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-22-2006 05:40 PM
тАО05-22-2006 05:40 PM
Re: Fortran IAND equivalent command in VMS DCL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-23-2006 02:56 PM
тАО05-23-2006 02:56 PM
Re: Fortran IAND equivalent command in VMS DCL
$ @cvui 320
320=101000000
flag7 is on
flag9 is on
$ @cvui 444
444=110111100
flag3 is on
flag4 is on
flag5 is on
flag6 is on
flag8 is on
flag9 is on