variable already exists

Discussions about editing and cleaning data
Post Reply
AriSilva
Posts: 263
Joined: July 22nd, 2016, 3:55 pm

variable already exists

Post by AriSilva » September 18th, 2019, 2:19 pm

Look at the following code snipet:

PROC PPO73_NASCIMENTO
string x = maketext("%08d", $);
string x1 = x[1:4];
string x2 = x[5:2];
string x3 = x[7:2];

The compiler issues an error "The symbol name 'x1' is already in use", but there is no x1 variable whatsoever.
But if I write xx1 it works.
Is it prohibited in the language, having variables x and x1?
Best
Ari

aaronw
Posts: 208
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: variable already exists

Post by aaronw » September 18th, 2019, 5:59 pm

I copied and pasted the few lines you gave and it compiles for me, so you can definitely declare x and x1. When I declare x1 globally I get the error. Attach your project if you would like me to take a look.

AriSilva
Posts: 263
Joined: July 22nd, 2016, 3:55 pm

Re: variable already exists

Post by AriSilva » September 21st, 2019, 1:06 pm

Thnaks Aaron,
Forget that, my fault.
One of my associates broke my rule of naming dictionary variables and used x1, x2, and x9.
The rule is
lnn_tttt
where l is a letter
nn is a number (could be any number of digits
ttt is a text with a minimum of 4 letters (can be more)
I really emphasize that, but... s..happens
Best
Ari

Post Reply