Import
Richard D. Williams
richard at appgrp.net
Wed Aug 3 10:40:25 PDT 2011
On 8/3/2011 11:02 AM, Richard Kreiss wrote:
> I wrote a program to get the file names in a specific directory. The file name is a record_number_time.xml (12345_10:15:30)
>
>
>
> There are 1549 files in the directory. However, the program only read half of them.
>
>
>
> The purpose of the program is to check to see if any one record was run more than once on the day in question.
>
>
>
> The program runs from rreport @once and then prints a report.
>
>
>
> Can anyone tell me why the program is only getting ½ of the records?
>
>
>
> 29 ------- - - - - - - - - - - - - - - - -
>
> ◄ If:
>
> Then: qq=opendir("*.xml",new_dir)
>
> 30 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: ct = "1"
>
> Then: SHOWCTR ("3")"Records to Read \b2"<qq<"\a-"
>
> 31 ------- - - - - - - - - - - - - - - - -
>
> loop_fi◄ If:
>
> Then: qa=nextdir()
>
> 32 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: qa = ""
>
> Then: END
>
> 33 ------- - - - - - - - - - - - - - - - -
>
> ◄ If:
>
> Then: lc=strtok(qa," ","1");recnum=""
>
> 34 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: 'just the record number
>
> Then: RecNum=mid(qa,"1",lc-"1")
>
> 35 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: 'get the date
>
> Then: rdate=mid(qa,"60","10")
>
> 36 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: rdate ne exdate
>
> Then: GOTO loop_fi
>
> 37 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: 'just the file name
>
> Then: recnums[ct]=RecNum{""
>
> 38 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: ct ge "2"
>
> Then: GOSUB chk_rec
>
> 39 ------- - - - - - - - - - - - - - - - -
>
> ◄ If:
>
> Then: ct=ct+"1"
>
> 40 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: ct lt "2001"
>
> Then: SHOW("4","15") "Records Read"<ct-"1";GOTO loop_fi
>
> 41 ------- - - - - - - - - - - - - - - - -
>
> ◄ If:
>
> Then: END
>
> 42 ------- - - - - - - - - - - - - - - - -
>
> hk_rec◄ If: '***************************************************************
>
> Then: '* check to see if this record number exists in the array again
>
> 43 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: '* need to make sure the the same array element isn't count twice ◄
>
> Then: '************************************************************** ◄
>
> 44 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: oc = "" ◄
>
> Then: oc(4,.0)="1" ◄
>
> 45 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: ◄
>
> Then: pc(4,.0)="1" ◄
>
> 46 ------- - - - - - - - - - - - - - - - -
>
> loop_pc◄ If: recnums[pc]="" ◄
>
> Then: RETURN ◄
>
> 47 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: pc = ct 'this is the array element for ◄
>
> Then: pc=pc+"1" 'this number ◄
>
> 48 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: recnums[pc]=recnum 'found a dulpicate ◄
>
> Then: duprecs[oc]=qa;oc=oc+"1" ◄
>
> 49 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: pc lt "2000" ◄
>
> Then: pc=pc+"1";GOTO loop_pc ◄
>
> 50 ------- - - - - - - - - - - - - - - - -
>
> ◄ If: ◄
>
> Then: RETURN ◄
>
>
>
> Richard Kreiss
>
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.celestial.com/pipermail/filepro-list/attachments/20110803/31a69117/attachment.html
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
Richard,
Since Ken has pointed out a known bug, perhaps you could create a
counter for each blank in your list.
Count the first instance and go to your loop again. If you get a second
one, you may be at the end of your list.
then you could "end".
I do not use opendir. I would list the directory to a text file with a
system command and do an import loop.
Hope this helps,
Richard
More information about the Filepro-list
mailing list