Index problem

Boaz Bezborodko boaz at mirrotek.com
Tue May 25 19:26:21 PDT 2010


 78  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ? If:
       Then: lookup cst = cstrack  k=(t_num)    i=G -nL
 79  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ? If:         NOT cst or cst(1) le t_num -"1"
       Then:         tracking_num=t_num;mast(23)=t_num+"1";write 

Line 79 won't work if the lookup doesn't find a record.  FilePro will 
try to get a value for cst(1), but it won't have one if there is no 
record leading to an error.

You need to have a 'not cst' on its own line and deal with that 
situation first before letting FilePro work on a 'cst' field.  An 
alternative is blank the resulting lookup record (-bl) and compare the 
't_num' with cst(1) or with a nul ("") value that a failed lookup will 
return.

I've been bitten by this a few times so I'm aware of it when I program.

> Date: Tue, 25 May 2010 14:29:18 -0400
> From: "Richard Kreiss" <rkreiss at verizon.net>
> Subject: RE: Index problem
> To: <john at valar.com>,	<filepro-list at lists.celestial.com>
> Message-ID: <00b501cafc38$307a25c0$916e7140$@net>
> Content-Type: text/plain; charset=utf-8
>
> Top post:
> Method 1: Menu command - /fp/rclerk cstrack -s1 -xa -d
>
> Method 2: from system call marketing input program @key command
>      Then: sy="rclerk cstrack -s1 -xa -z enter -d -lx -rw market"<"-rx"<patient_code<"-ry"<master_code
> 	If:
> 	Then: system sy
>
> As entering a tracking record from marketing requires no update programming, this program is smaller and only allow for the initial entry of a record.
>
> Here is the code which causes the error at line 78.  When the index is rebuilt, everything works fine.
>
>        ? If:
>        Then: lookup mast = l_master  r=rn   -np
>  74  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>        ? If:         NOT mast
>        Then:         GOTO get_trk
>  75  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>        ? If:         mast(23) = "" or mast(23)="9999999"
>        Then:         mast(23)="1000"
>  76  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>        ? If:
>        Then:         t_num=mast(23);date_entered=@t4
> 77  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
> lok_trk? If: t_num = ""
>        Then: t_num="9999999"
>  78  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>        ? If:
>        Then: lookup cst = cstrack  k=(t_num)    i=G -nL
>  79  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>        ? If:         NOT cst or cst(1) le t_num -"1"
>        Then:         tracking_num=t_num;mast(23)=t_num+"1";write mast;display;END
>  80  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>        ? If:
>        Then:         t_num=t_num+"1"
>  81  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>        ? If:
>        Then: GOTO lok_trk
>
> Hope this is helpful.
>
> Richard
>   



More information about the Filepro-list mailing list