fieldnum() problem

Richard Kreiss rkreiss at gccconsulting.net
Wed Aug 22 21:14:30 PDT 2018


Program to delete records from multiple files. The files to delete are named in a file called files_2_delete
which contains 3 fields, 1- file name, 2-index to use, 3-field names for sort - i.e. address,Street

Program runs from a "library file".
There is a routine which fills arrays with the values in each record of files_2_delete
Dim DeleteFiles(20);dim FileIndex(20)(1,.0);dim FileSort(20)

filename is set from the array DeleteFiles(ct )which holds the file name (looked up)
FileIndex is an array which holds the index letter to be used for the lookup

if: fiIeindex(ct) = "A" 'set the index value
then:lookup defile = (filename) k=A -npx
more programming here
if:
Then: a="street";sf=fieldnum(defile,a);a="Address";af=fieldnum(defile,a)
if: defile(af) = ad and defile(sf) = st    - if the lookup record has the same address - ad and street name - st
then: getnext defile;GOTO loop_de

The above passes the syntax check. however I get an error when
I try to write the current lookup record to the qualifier called backup

BackFile=filename{"@backup"
if:
then: lookup back = (backFile) r=free -n
if:Not back
THEN: RETURN
if:
Then: copy defile to back;rn=back(@rn);GOSUB post_mr
If:
Then: Return
post_mr:if:
Then:
if:
then: lookup back = (backfile) r-=rn -np
if:not back
Then:RETURN
if:
Then: a="backup_date";bd=fieldnum(back,a)
I have checked the value of bd , it is the correct field number for the file vaw_cards
if:
then: back(bd)=@td - Post the current date to backup record - syntax error pointing at back(bd)

if:
Then: back(bw)=getenv("username") - Syntax error points at (bw)

Note that the syntax points to the closing ) of back().

Why am I having this issue when prior to this defile(af) does not create a syntax error?

another issue is getting the creation date of the original record:

RecordDate=deFile(@cd) should have the creation date of the record. The actual date is
05/20/08. However when I check the value of RecordDate is shows as today's date.

My programming looks correct, what am I doing wrong?



-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 16531 bytes
Desc: not available
URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20180823/0be2dc5d/attachment.bin>


More information about the Filepro-list mailing list