Solved

string comparison in DCL

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mirrorEnds challenge 6 145
Which programming language is best for beginning Object-oriented programming 11 153
isEverywhere  challenge 19 85
seriesUp challenge 7 191
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.
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 this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

735 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