<div>  Well, I added at the end:</div>
<div> </div>
<div>         Then:  write deb; end</div>
<div> </div>
<div>@done Then:  system &quot;do_my_script&quot;&lt;fd</div>
<div> </div>
<div> This works - and emails the file with no problem using my mutt script (which uses sendmail)</div>
<div> </div>
<div> Problem is, the text file attachment isn&#39;t complete??  It quits on the 30th record, about mid-way thru.</div>
<div> </div>
<div> So I vi the text file on the SCO box and all 44 records are in the file I&#39;m sending?????</div>
<div> </div>
<div> So I tried putting a sleep 100000 command right before the system call, but still same issue.</div>
<div> </div>
<div> Any idea why it doesn&#39;t send me the whole file??</div>
<div> Very strange......</div>
<div> </div>
<div> My mutt script looks like this:</div>
<div> </div>
<div> #!/bin/sh</div>
<div> </div>
<div>cd /appl/fpmerge  (&lt;--- this is where the file (fd) gets created)</div>
<div> </div>
<div>FLE=$1</div>
<div> </div>
<div>mutt -s &quot;File you created is attached&quot; -a $FLE my_email@..... &lt; mailbody.txt   (&lt;--- mailbody.txt is just a generic text file saying &quot;file attached&quot;)</div>
<div> </div>
<div>Would it make a difference if root or filepro owns the mutt script?  (I&#39;m going to try to change that and run it again now)</div>
<div> </div>
<div>Thanks guys</div>
<div> </div>
<div>I knew it was something pretty obvious - just couldn&#39;t think of what it was - brain dead lol</div>
<div> </div>
<div>Scott</div>
<div> </div>
<div><br><br> </div>
<div class="gmail_quote">On Thu, Oct 7, 2010 at 12:59 PM, Brian K. White <span dir="ltr">&lt;<a href="mailto:brian@aljex.com">brian@aljex.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div class="im">On 10/7/2010 11:34 AM, <a href="mailto:scooter6@gmail.com">scooter6@gmail.com</a> wrote:<br></div>
<div>
<div></div>
<div class="h5">&gt; I have an export ascii out put processing script that I want to setup to<br>&gt; email after it finishes.<br>&gt;<br>&gt; Currently, in output processing, I use variables to create filename based on<br>
&gt; today&#39;s date, etc and that all works fine<br>&gt;<br>&gt;<br>&gt; Then:  export ascii deb=(fd) r=\n f=|<br>&gt;<br>&gt; Then: deb(1)=1, etc, etc, etc<br>&gt;<br>&gt; Then: write deb; end<br>&gt;<br>&gt; Now, after this finishes with all the records selected via set selection, I<br>
&gt; want to email the file, passing the variable filename to the script<br>&gt;<br>&gt; I thought easiest way would be to do a system call at the end, but if I<br>&gt; change<br>&gt;<br>&gt; Then: write deb; end<br>&gt; to<br>
&gt; Then: write deb<br>&gt;<br>&gt; Then: system &quot;path_to_my_script&quot;&lt;  fd<br>&gt;<br>&gt; obviously this calls the system call after each record is written to the<br>&gt; file - resulting in numerous emails of course haha<br>
&gt;<br>&gt; So, my next thought would be from the menu, to script it as:<br>&gt;<br>&gt; /u/appl/fp/rreport ............<br>&gt; cd /appl/fpmerge<br>&gt; ./script_name_to_send_email  ???????<br>&gt;<br>&gt; So how would I get the filename (fd) as defined in processing, passed to the<br>
&gt; email in the Create Script File (F5) in the define menus??<br>&gt;<br>&gt; Either that, or how do I do a system call ONLY after all records have been<br>&gt; written to my output file??<br>&gt;<br>&gt; Thanks for any help<br>
<br><br></div></div>My suggestion for the most self-contained and thus portable and<br>maintainable way:<br><br>Do the post-processing (send the email in this case) in @done.<br>This means declare fd with ,g so that it is still available in @done.<br>
And since in this case the value in fd doesn&#39;t change during the entire<br>run and doesn&#39;t depend on any record data, and assuming you have fp 4.8<br>or newer, the simplest and best place to declare and fill fd is in<br>
@once. (no need to check &quot;i did/didn&#39;t do this already&quot; on every record)<br><br>Lastly, to avoid possible permissions problems, You might need to use a<br>system command to create the file before allowing fp to create it.<br>
Again, best in @once.<br><br>top of prc<br> normal per-record output processing<br> [...]<br> end<br><br>@once:<br> fd(32,*,g) = &quot;/tmp/something.txt&quot; &#39; don&#39;t use rand()!<br> &#39; system &quot;umask 0 ; &gt;&quot; &lt; fd  &#39; may not need, try without first.<br>
 end<br><br>@done:<br> close deb<br> system &quot;...&quot; &lt; fd<br> x = remove(fd)<br> end<br><br><br><br>This way requires no special set up before nor after running<br>report/clerk. It&#39;s all within the processing table.<br>
<font color="#888888"><br>--<br>bkw<br>_______________________________________________<br>Filepro-list mailing list<br><a href="mailto:Filepro-list@lists.celestial.com">Filepro-list@lists.celestial.com</a><br>Subscribe/Unsubscribe/Subscription Changes<br>
<a href="http://mailman.celestial.com/mailman/listinfo/filepro-list" target="_blank">http://mailman.celestial.com/mailman/listinfo/filepro-list</a><br></font></blockquote></div><br>