Solved

string comparison in DCL

Posted on 2004-04-02
4
591 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
fizzArray  challenge 1 115
pre4 challenge 19 116
groovy example issue 10 114
Problem to page 4 105
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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