Using WRITE() on 5.0 - running on Linux

Nancy Palmquist nlp at vss3.com
Fri Jun 26 07:48:11 PDT 2009


Kenneth Brody wrote:
> Nancy Palmquist wrote:
> [...]
>> Good suggestion. My clearing of the variable ofile was to insure that 
>> I got past the logic that assigned the next output filename before I 
>> processed the end tags. It eased my mind that it was not somehow 
>> running the @wbrk2 without running any detail section.
>
> I'm not sure why you close the file every time, and then reopen it.
>
> Where does ofile get set? If @wbrk2 is hit when ofile is not empty, 
> you will write another line to the file. Yes, I see that @wbrk2 clears 
> it, but you don't show how it gets set in the first place.
>
Ken,

I open and close it because I was not sure if the handle would pass from 
record to record along with the position in the file. I had always used 
this function while sitting on one record and wrote the entire file. So 
I thought it was best to close it after each record and open it again on 
the next record.

ofile is set in a routine that fires off on line 12

12 ------- - - - - - - - - - - - - - - - -
■ If: madetop ne "Y" ■
Then: myresult=""; gosub XMLBLD;count="1";account=1' ;reptype=5


26 ------- - - - - - - - - - - - - - - - -
XMLBLD ■ If: 'create header for document ■
Then: declare WEBPAGE,ACCFILE ■
27 ------- - - - - - - - - - - - - - - - -

■ If: exists(POLKSTORAGE{"/"{1) eq "0" ■
Then: system "mkdir "<polkstorage{"/"{1<";chmod 0755 "<polkstorage{"/"{1>
29 ------- - - - - - - - - - - - - - - - -
■ If: ' Canned txt file right now■
Then: ofile=POLKSTORAGE{"/"{1{"/index.xml" ■

SNipped out stuff that checked access

34 ------- - - - - - - - - - - - - - - - -
maketop■ If: ■
Then: declare stylesheet;stylesheet="[stylesheet name here]">
35 ------- - - - - - - - - - - - - - - - -
■ If: ■
Then: MyResult="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"{crlf
37 ------- - - - - - - - - - - - - - - - -
■ If: namespc eq "" ■
Then: namespc="";ltag="<"{namespc{"";letag="</"{namespc{"" ■
38 ------- - - - - - - - - - - - - - - - -
■ If: namespc eq "mrb:" ■
Then: MyResult=MyResult{ltag{"MetroIndex xmlns:mrb=\"[URL Here\"]" - cut 
these off the screen they are complete
39 ------- - - - - - - - - - - - - - - - -
■ If: namespc eq "" ■
Then: MyResult=MyResult{ltag{"MetroIndex>" ■
40 ------- - - - - - - - - - - - - - - - -
■ If: 'set this to indicate I started a file - clear it when I write the 
final tags in the @wbrk2 ■
Then: madetop="Y"

set some more tags

45 ------- - - - - - - - - - - - - - - - -
■ If: 'create the file - truncate it if it exists ■
Then: gosub creatit ■
46 ------- - - - - - - - - - - - - - - - -
■ If: 'write Myresult to file and close it ■
Then: gosub wrtit;gosub clsit ■
47 ------- - - - - - - - - - - - - - - - -
■ If: ■
Then: MyResult="" ; return


Ken this change was because when I used EXPORT I had other issues. When 
I write data to the file it is overlapping somehow.

myresult="<L_RequestDate......>" Continue a long string. I write this to 
the Export. I do myresult=""
Then I assign the next line line this:
myresult="<LINK ......>" and 3 times out of thousands, I get the 
following written to the file:

<L_LINK ....>

It must somehow be a combination of the two, I can not see any other 
reason for it. I thought changing the logic to use WRITE() instead of 
EXPORT might solve the problem, but I just got other issues. With Export 
I was getting random errors. Here is an example in the current run:

</PeopleSearch>
<PeopleSearch>
<ClaimNumber>08RICGA00722</ClaimNumber>
<RequestDate>04/01/2009</ReqopleSearch>
<PeopleSearch>

This should look like this:

</PeopleSearch>
<PeopleSearch>
<ClaimNumber>08RICGA00722</ClaimNumber>
<RequestDate>04/01/2009</RequestDate>
</PeopleSearch>
<PeopleSearch>

I am trying to get this to write these files accurately, without the 
miss-written files. Got any suggestions. I expect no way to duplicate 
this to send to you. I really never saw it do this before, I do 
thousands of things with Export and WRITE(). It is writing to a drive 
mounted with NSF, maybe that is it. I am going to add a small SLEEP - to 
give the file time to write before I send the next one. I have found 
this helps. It runs again at 11:18am - I will let you know if that fixed 
it. (on the 10:18AM run it only had 2 broken files out of all that I ran 
- Maybe about 600 - hard to count.

Nancy

-- 
Nancy Palmquist 		MOS & filePro Training Available
Virtual Software Systems	Web Based Training and Consulting	
PHONE: (412) 835-9417		   Web site:  http://www.vss3.com



More information about the Filepro-list mailing list