Solved

string comparison in DCL

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adobe Customization Wizard XI issues 26 238
maxBlock challenge 30 130
XML::LibXML and Xpath syntax How do I get attribute of sibling 2 140
groupSumClump challenge 9 116
Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
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.
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.

823 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