Solved

string comparison in DCL

Posted on 2004-04-02
4
536 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

746 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

16 Experts available now in Live!

Get 1:1 Help Now