Why am I getting a syntax error?

Jeff Harrison jeffaharrison at yahoo.com
Wed Feb 8 12:03:53 PST 2006


--- Dan Coutu <coutu at snowy-owl.com> wrote:

> Jeff Harrison wrote:
[snip]
> > Perhaps the problem is that there are trailing
> spaces
> > within the variable.
> >
> > Try the following instead:
> >
> > lookup fil=(Filename{"") r=(RecordNo) -ex
> >
> > Jeff Harrison
> > jeffaharrison at yahoo.com
> >   
> I believe this is the problem. The question is: why
> are there trailing 
> spaces in the first place? Here's some detail that
> helps with background.
> 
> ::declare global FileName(20,*):
> ::declare global RecordNo(8,.0):
> ::declare global MyData(999,*):
> ... open a file, then read a line from it
> ::bc(8,.0) = readline(DataFile, MyData):
> ::tc(8,.0) = instr(MyData, "=") ' left and right
> sides separated by an 
> equal sign:
> ::FileName = mid(MyData, "1", tc-"1"):
> ::RecordNo = mid(MyData,
> tc+"1",dlen(""{MyData{"")-tc):
> 
> So if the source line is
> 
> customer=39403
> 
> Then I'd expect that FileName would contain
> "customer" and RecordNo 
> would contain "39403".
> Well, apparently FileName actually contains
> "customer            ". Why 
> this is true is beyond me.
> 
>
[snip]

When you declared the filename as:
declare global FileName(20,*) 
You are reserving a string variable in memory that is
automatically filled with spaces by default.  This is
just how filepro does things.  Once you declare it
with a length, you no longer have a null.

Your numeric declaration behaves a little differently:

declare global RecordNo(8,.0)

Because it is numeric (.0) it is automatically right
justified, also, filepro knows that it is numeric and
so automatically evaluates it as a number - thus
making any leading or trailing spaces irrelavant.

Jeff Harrison
jeffaharrison at yahoo.com

Author of JHExport and JHImport.  The easiest and
fastest ways to generate code for filePro exports and imports.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Filepro-list mailing list