×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

aphanumeric to integer?

aphanumeric to integer?

aphanumeric to integer?

(OP)
Hello!

I'd like to have an IF Statement:
IF DATE LE &TODATE AND GE &FROMDATE

Unfortunately all the variables and the field DATE are alphanumeric and I get the error:

(FOC280) COMPARISON BETWEEN COMPUTATIONAL AND ALPHA VALUES IS NOT ALLOWED

What can I do here?

Thanx
Eva

RE: aphanumeric to integer?

Try this if it's in a DEFINE or COMPUTE;

IF (DATE LE '&TODATE') AND (DATE GE '&FROMDATE')

the () are not required, but clarify the logic. If this is a screening statement in a TABLE, try:

WHERE (DATE LE '&TODATE') AND (DATE GE '&FROMDATE');

or

IF DATE FROM '&FROMDATE' TO '&TODATE'

HTH

RE: aphanumeric to integer?

(OP)
Hi HTH,

unfortunately it doesn't work...

Eva

RE: aphanumeric to integer?

You need to post more of your code. Run the FOCEXEC with ECHO=ON and post the code which is echoed back to your screen.

EX focexec ECHO=ON

RE: aphanumeric to integer?

(OP)
Hi kiddpete,

I oversaw something you wrote:
IF DATE FROM '&FROMDATE' TO '&TODATE'
This worked! But I wonder why this works and the other suggestion doesn't.... Maybe you know why.

And: thanx for your help!
Eva

RE: aphanumeric to integer?

What are the contents of &FROMDATE and &TODATE, and what is the format of DATE? That may answer the question.

RE: aphanumeric to integer?

(OP)
They're all alphanumeric. I guess that's why you have to put the variable into ' and ' . But the rest.. I don't know.

RE: aphanumeric to integer?

No, tell me the actual content of &FROMDATE and &TODATE and the length of DATE. Is &FROMDATE 20031231, 12/31/2003, or whatever it is.

RE: aphanumeric to integer?

(OP)
Hi kiddpete,

all of the variables and the field DATE have the format 20030228. The field DATE is an A8.

Eva

RE: aphanumeric to integer?

I'm drawing a blank. I don't see why all three forms don't work, but if the 'FROM TO' formulation works, go with it.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close