DKNFs even *with* -p [long; lots o' code]

Jay R. Ashworth jra at baylink.com
Mon Jun 18 08:25:46 PDT 2007


On an unrelated topic, I'm having a problem with a pair of files to
which I'm writing lots of records in a batch (currently about 2000).

This is an inventory file, and I whack it down to about 40 or 50 hand
entered records (using processing you'll see below), reindex it with
-ra -e, and then pour the records into it (code also below), with all
lookups flagged as -nxp.

I'm in a loop, working on the second table to get it exactly right, so
I have to run the first one multiple times as well. When I do, *even*
if I reindex both tables *after* the mass delete as well as before, the
delete code trips DKNF errors.

Only for one index on each file: on sviinvtr it's E; on sviinvfr, B;
the other indices -- and there are quite a number; far more than the 40
or so records which I am *not* deleting -- do *not* show up in the DKNF
dialogs as I spin through them.

No other processing touches either file within my whack-populate-test
loop.

This seems odd; does anyone have any suggestions before I dump this on
fpsupport?

Cheers,
-- jra


/usr/local/bin/invwhack:
==========================================
# whack the inventory files for a fresh reimport
dxmaint sviinvtr -ra -e
dxmaint sviinvfr -ra -e
dreport sviinvtr -f whack -s whack -h "Whacking sviinvtr"
dreport sviinvfr -f whack -s whack -h "Whacking sviinvfr"
==========================================

prc.whack:
==========================================
::' sviinvtr/whack - delete records:
start:::
::delete; end:
==========================================

sel.whack:
==========================================
hassn and not audit
audit:2:eq:AUDIT
hassn:297:ne:
:::
:::
:::
:::
:::
:::
:::
:::
:::
:::
==========================================


prc.push:
==========================================
::' post all imported inventory items to sviinvtr/sviinvfr:
::' custom for ${CUSTOMER}:
::' written 29-Jan-07 by jra at microsys.us:
::':
start::':
::' the full serial number is the key; we check both the inventory:
::' files and the archives -- put the record into the resp inventory:
::' file unless it's in the resp archive; handle independently:
::':
::lookup invt=sviinvtr k=1 i=A -nxp:
:not invt:lookup invtx=sviinvtx k=1 i=A -nxp:
:invtx:end                                ' if in the invt archive, skip:
::':
::lookup invf=sviinvfr k=1 i=A -nxp:
:not invf:lookup invfx=sviinvfx k=1 i=A -nxp:
:invfx:end                                ' if in the invf archive, skip:
::                                        ' unlikely to skip here, but...:
::':
::' on the pricing file, try to create one record per subcat:
::lookup invp=sviinvpr k=3 i=A -nxp:
:not invp:lookup invp=sviinvpr r=free -nxp:
::':
::' and finally, create or update a bulk price record:
::' figure out which warehouse:
::'debug on:
::gosub whse:
::sk(15,allup)=3                           ' trim off the SN to SKU:
:2 eq "LAPTOP":mid(sk,"13","3")="L/T"      ' if a laptop, so tag:
::lookup invb=sviinvtr k=(sk&wh) i=P -nxp:
:invb:goto cont1:
::lookup invb=sviinvtr r=free -nxp:
::gosub newbulk:
::':
cont1:::
::' if invt, update it, if not create; same with invf:
:invt:gosub updinvt:
:not invt:gosub newinvt:
:invf:gosub updinvf:
:not invf:gosub newinvf:
::gosub updinvp:
::gosub updinvb:
::end:
::':
newinvt:::
::' lookup a free record in the live file, then fall through:
::lookup invt=sviinvtr r=free -nxp:
:not invt:show "@Couldn't get free sviinvtr record; out of disk?  Yell for help"; exit:
updinvt:::
::invt(3)=1; invt(297)=1                      ' serial number:
::invb(6)=wh                                  ' warehouse:
::invt(288)=2                                 ' category:
::invt(289)=3                                 ' subcat:
::invt(12)=4                                  ' mfg:
::invt(4)=6<"/"<5                             ' model/desc:
:5 eq 6:invt(4)=5:
::invt(295)=8<"/"<7                           ' loc/bin:
::invt(305)=8                                 ' loc also:
::invt(31)=11                                 ' supplier #:
::invt(91)= "1"                              ' Qty dmd:
::':
::' other fields per dmd:
::invt(14)="R"                                ' Refurb:
::invt(16)="N"                                ' Taxable:
::invt(30)="1"                                ' default vendor:
::invt(11)="ZZZZZZZZZZZZZZZ"                  ' Non Serial Grouping #:
::invt(21)="5000";invt(22)="100"              ' Sales Accts:
::invt(23)="1200";invt(24)="000"              ' Inv Accts:
::invt(25)="4000";invt(26)="100"              ' COGS Accts:
::invt(101)="EA"                              ' Stk unit of measure:
::invt(102)="EA"                              ' Sell ""   "":
::invt(103)="EA"                              ' Buy unit of measure:
::invt(104)="1"                               ' Sell Conversion:
::invt(105)="1"                               ' Buy Conversion:
::invt(150)="F"                               ' Commission percentage fixed:
::return:
::':
newinvf:::
::' lookup a free record in the live file, then fall through:
::lookup invf=sviinvfr r=free -nxp:
:not invf:show "@Couldn't get free sviinvfr record; out of disk?  Yell for help"; exit:
updinvf:::
::' don't fill in warehouse for now; must xref to warehouse file:
::'invf(1)=8                                   ' location:
::invf(2)=1                                   ' serial number:
::invf(3)=5<"/"<6                             ' model/desc:
:5 eq 6:invf(3)=5:
::invf(7)=1                                   ' full serial number:
::return:
::':
updinvp:::
::invp(1)=3                                   ' subcat tag:
::return:
::':
updinvb:::
::invb(91)=invb(91) + "1"                     ' qty on hand:
::return:
::':
whse:::
::' is this a warehouse other than NJ?:
::wh(3,allup)="NJ"                            ' default here:
::' at the moment, we're not getting warehouse as a field in the:
::' DBF files, so we apply some heuristics:
:8 eq "FLORIDA":wh="FL":
:7 eq "FLORIDA":wh="FL":
::return:
::':
newbulk:::
::' lookup a free record in the live file, then fall through:
::invb(3)=sk; invb(297)=3                     ' serial number:
::invb(2)="BULK"                              ' BULK item class:
::invb(6)=wh                                  ' warehouse:
::invb(288)=2                                 ' category:
::invb(289)=3                                 ' subcat:
::invb(12)=4                                  ' mfg:
::' this will only acquire a valid description on non-new categories:
::invb(4)=invp(2)                             ' model/desc:
::invb(295)=8<"/"<7                           ' loc/bin:
::invb(305)=8                                 ' loc also:
::invb(31)=11                                 ' supplier #:
::invb(91)="0"                                ' updinvb will bump this:
::':
::' other fields per dmd:
::invb(14)="R"                                ' Refurb:
::invb(16)="N"                                ' Taxable:
::invb(30)="1"                                ' default vendor:
::invb(11)="ZZZZZZZZZZZZZZZ"                  ' Non Serial Grouping #:
::invb(21)="5000";invb(22)="100"              ' Sales Accts:
::invb(23)="1200";invb(24)="000"              ' Inv Accts:
::invb(25)="4000";invb(26)="100"              ' COGS Accts:
::invb(101)="EA"                              ' Stk unit of measure:
::invb(102)="EA"                              ' Sell ""   "":
::invb(103)="EA"                              ' Buy unit of measure:
::invb(104)="1"                               ' Sell Conversion:
::invb(105)="1"                               ' Buy Conversion:
::invb(150)="F"                               ' Commission percentage fixed:
::return:
::':
==========================================

If the maps and index lists seem germane, let me know and I'll post them
as well.
-- 
Jay R. Ashworth                   Baylink                      jra at baylink.com
Designer                     The Things I Think                       RFC 2100
Ashworth & Associates     http://baylink.pitas.com                     '87 e24
St Petersburg FL USA      http://photo.imageinc.us             +1 727 647 1274


More information about the Filepro-list mailing list