vexing index issue

Mitch Theophila/MGT Computer Solutions theophila at compuserve.com
Thu Aug 4 07:40:42 PDT 2005


Message text written by Craig Tooker
> > 
> >  17  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
> Note thate at this point you have not initilized the value of "filename" 
> so the lookup will ALWAYS fail the first time.
> >        ¦ If: 'test for existence of this item                                  ¦
> >        Then: lookup chk=(filename)    k=(xi) i=0 -nx                           ¦
> >  18  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
> >        ¦ If: chk                                                               ¦
> >        Then: goto upditem                                                      ¦
> >  19  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
> > newitem¦ If:                                                                   ¦
> >        Then:                                                                   ¦
> >  20  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
> >        ¦ If:                                                                   ¦
> >        Then: AT = AT + "1"                                                     ¦
> >  21  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
> Now you initilize that variable - do this before the first lookup.
> >        ¦ If:                                                                   ¦
> >        Then: filename=@FI                                                      ¦
> >  22  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
> <

hi Craig, thanks for your reply!

drat.  i erred when i removed the first 5 lines of the program to make my post 
more concise.  the declaration for FILENAME is on line 2.

I apologize to the list members for the inconvenience caused by my oversight.

here are the first 5 lines.  

  1  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: ' this processing executes one time at most.  it exits at end of  ¦
       Then: ' its input file.                                                 ¦
  2  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If:                                                                   ¦
       Then: declare filename ; FILENAME=@fI                                   ¦
  3  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If:                                                                   ¦
       Then: yn(1,yesno) = "N"                                                 ¦
  4  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: filename eq "INVENTORY"                                           ¦
       Then: input yn"Working on production file!  Continue?"                  ¦
  5  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: filename eq "INVENTORY" and yn eq "N"                             ¦
       Then: exit                                                              ¦

FILENAME is properly initialized and the first lookup does indeed work fine.

here's the rest of the program repeated so it's all visible in one place.

  6  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: x=""                                                              ¦
       Then: x(len(9),edit(9),g)="ACME"                                        ¦
  7  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: 'input count    recs skipped     recs added       recs updated    ¦
       Then: AA(5,.0,g)="0" ; AB(5,.0,g)="0" ; AT(5,.0,g)="0" ; AU(5,.0,g)="0" ¦
  8  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: 'partno                  desc                        price        ¦
       Then: xa(len(1),edit(1),g)="" ; xc(len(20),edit(20),g)="" ; xe(len(4),edit(4),g)=0:
  9  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
loop   ¦ If:                                                                   ¦
       Then:                                                                   ¦
 10  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: @sk eq "BRKY"                                                     ¦
       Then: msgbox "Add cancelled after reading"<AA<"records."; exit          ¦
 11  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If:                                                                   ¦
       Then: gosub ShowIt                                                      ¦
 12  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: 'read import record                                         ¦
       Then: import ascii imp=allied.txt f=~ r=\n                              ¦
 13  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: not imp 'end of import file                                       ¦
       Then: msgbox "Records added:"<AT<"updated:"<AU ; exit                   ¦
 14  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: 'store import data into memory  ' in 2005-07, only 2 fields       ¦
       Then: xa=imp(1);xe=imp(2)                                               ¦
 15  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: '1:PARTNO 2:COST                                                  ¦
       Then: AA = AA + "1"                                                     ¦
 16  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If:                                                                   ¦
       Then: xi = x & xa                                                       ¦
 17  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: 'test for existence of this item                                  ¦
       Then: lookup chk=(filename)    k=(xi) i=0 -nx                           ¦
 18  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: chk                                                               ¦
       Then: goto upditem                                                      ¦
 19  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
newitem¦ If:                                                                   ¦
       Then:                                                                   ¦
 20  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If:                                                                   ¦
       Then: AT = AT + "1"                                                     ¦
 21  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If:                                                                   ¦
       Then: filename=@FI                                                      ¦
 22  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: 'get a free record                                                ¦
       Then: lookup inv=(filename)    r=free -e                                ¦
 23  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: 'post variables to free record                                    ¦
       Then: inv(21)=xa;inv(4)=xe;inv(30)="Y";inv(9)=x ' inv(20)=xc            ¦
 24  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If:                                                                   ¦
       Then: inv(1) = inv(21)                                                  ¦
 25  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: ' get next import record                                          ¦
       Then: goto loop                                                         ¦
     -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦
       ¦
 29  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
upditem¦ If:                                                                   ¦
       Then:                                                                   ¦
 30  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If:                                                                   ¦
       Then: ' msgbox chk(9) & chk(1) {":"{ xi { ""; goto loop                 ¦
 31  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: chk(9) ne x                                                       ¦
       Then: msgbox "no vndr match" < chk(9) < xi { "" ; AB = AB + "1"; goto loop >
 32  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: chk(1) ne xa                                                      ¦
       Then: msgbox "no part match" < chk(1) < xa { "" ; goto newitem          ¦
 33  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If:                                                                   ¦
       Then: AU = AU + "1"                                                     ¦
 34  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: ' post variables to item record                                   ¦
       Then: chk(4)=xe ' chk(21)=xa;chk(20)=xc;chk(30)="Y";chk(9)=x;chk(1)=xa  ¦
 35  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If: ' get next import record                                          ¦
       Then: goto loop                                                         ¦
 36  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If:                                                                   ¦
       Then:                                                                   ¦
 37  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
SHOWIT ¦ If:                                                                   ¦
       Then: show "Records  read:" < AA & "  added:" < AT & "  skipped:" < AB &>
 38  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ¦ If:                                                                   ¦
       Then: return                                                            ¦
 39  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
@DONE  ¦ If:                                                                   ¦
       Then: msgbox "DONE - Records  read:" < AA & "  added:" < AT & "  skipped>
 40  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

thanks again to those with the patience to stay with me on this one.

best regards .mitch theophila/MGT Computer Solutions
/knew he shouldn't have messed with it


More information about the Filepro-list mailing list