Solved

string comparison in DCL

Posted on 2004-04-02
4
551 Views
Last Modified: 2012-05-04
any DCL expert out there.
I'm trying to compare string, but without case sensitive.
IE>  if ("fr" .eqs. "FR") then do something
0
Comment
Question by:matgold
  • 2
4 Comments
 
LVL 5

Expert Comment

by:jerry_jeremiah
ID: 10746974
I found this in the VMS Users Manual:

http://h71000.www7.hp.com/doc/72final/6489/6489pro_043.html

When you write an expression for an IF command, adhere to the following rules:

When you use symbols in IF statements, their values are automatically substituted. Do not use apostrophes (') as substitution operators unless you need to force iterative translation.

String comparison operators end in the letter S. For example, use operators such as .EQS., .LTS., and .GTS. to compare strings. By contrast, the operators .EQ., .LT., and .GT. are used for comparing integers.

When you test to see whether two strings are equal, the strings must use the same case in order for DCL to find a match. That is, the string "COPY" does not equal the string "copy" or the string "CoPy."

So I am not sure that it is possible unless you can find a library function that will do what you want.

Jerry
0
 
LVL 20

Accepted Solution

by:
jmcg earned 25 total points
ID: 10803568
String comparison operators in DCL are case sensitive.

To do a case-insensitive compare, you have to adopt a convention that all strings are converted to, say, uppercase, either at the time they are input or before they are used in a comparision. The lexical function F$EDIT is often used in DCL to prepare strings from user input or other sources. For instance:

line = f$edit(line, "TRIM,COMPRESS,UPCASE")

will prepare the string content of "line" by removing leading and trailing whitespace, compress whitespace internal to the string (although it's very smart and will not compress whitespace inside quotes), and convert any lowercase characters to uppercase.

Doc pointer to f$edit:

http://h71000.www7.hp.com/doc/731FINAL/9996/9996pro_028.html

(it's the last function described on that page).
0
 
LVL 5

Expert Comment

by:jerry_jeremiah
ID: 10804621
Good answer!

Jerry
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
if loop in java 3 129
sum67 challenge 35 93
fizzArray2 challenge 1 72
object oriented javascript web form 8 104
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now