setting params when you define a dummy variable?

Nancy Palmquist nlp at vss3.com
Tue Apr 12 13:35:59 PDT 2005


Mike Schwartz wrote:

>      I have been doing some programming for a customer who usually 
> doesn’t put any length or edit type on their dummy variables.  For example:
> 
>  
> 
> Ky=”Smith” or ky=”10” * xy
> 
>  
> 
> Instead of:
> 
>  
> 
> Ky(30,*)=”Smith” or ky(15,.0)=”10” * xy
> 
>  
> 
>      There are a few places where they set the length or use an edit, 
> such as
> 
>  
> 
> Input qu(1,yesno) “Yes or no?”
> 
>  
> 
>  
> 
>      I thought there were some downsides to not setting a length or edit 
> type, like extra RAM memory wasted.  This is probably a “Ken Brody” 
> question and maybe even a good topic for the filePro room tonight, but 
> are there any other reasons why it might be good or bad not to put edit 
> types on dummy variables?
> 
>  
> 
>      For example, on math variables, I usually like to control the 
> precision, because I may be displaying or printing the variable later. 

You are right about RAM.  On undefined variables, filePro uses a new 
memory location each time the variable is assigned a value, instead of 
reusing the same location.  Most critical on Long reports that might 
then crash after enough records to eat up all the available memory.  I 
learned this one from experience.

Also, you are right about math.  Undefined variables are assumed 
literal.  So doing the following:

ab="5"
ac="6.2"
ac=ab/ac

might result, in some cases, in issues caused by changes from literal 
--> to decimal  -- > to binary.  I remember running tests on this and it 
might be possible also to have things like:

if: ab eq "0"	test false when you can clearly see the value of ab is 
equal to "0" but a literal zero not a numeric zero.

It can make things like numbers test wrong where they would right 
justify but literals do not.

"2" is not equal to "   2"

Stuff like that.

Also, you get no warning if you assign something to the variable that 
was already used, maybe for a different purpose.  If you assign length 
and edit, you will get a warning if you make a different assignment and 
hopefully you will then fix it.

Much bad juju if you don't give edit and length on all but the variables 
that you need to have none.  (sometimes could be good, not all the time.)

Nancy

-- 
Nancy Palmquist 		MOS & filePro Training Available
Virtual Software Systems	Web Based Training and Consulting	
PHONE: (412) 835-9417		   Web site:  http://www.vss3.com



More information about the Filepro-list mailing list