File I/O in 4GL (V8.03 / Progress OE10.1B)

Depending on exactly what is needed, you can do it with ODBC/Access. You can write a macro in access and then write a batch file to automate the macro and schedule the batch file to run using the scheduled tasks. Might not be the best solution with the newer versions of Epicor, but we were on Vantage 5.2 for so long (very limited capabilities) that I did everything in access using macros/batch files.Â


Is there a better way to write to a file in 4GL than :


OUTPUT TO testfile.txt.

PUT UNFORMATTED txtBody.

OUTPUT CLOSE.


It appears that you cannot create a stream within a procedure.  


Do I run the risk of anything that is output by the OE engine (like log file entries) ending up in my file ("testfile.txt") ??


Calvin 



Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Tue, Jun 14, 2016 at 10:59 AM, ckrusen1@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p></p><p><span>Is there a better way to write to a file in 4GL than :</span></p><p><span><br></span></p><p><span>OUTPUT TO testfile.txt.</span></p><p><span>PUT UNFORMATTED txtBody.</span></p><p><span></span></p><p><span>OUTPUT CLOSE.</span></p><p><span><br></span></p><p>It appears that you cannot create a stream within a procedure.  </p><p><br></p><p>Do I run the risk of anything that is output by the OE engine (like log file entries) ending up in my file (&quot;testfile.txt&quot;) ??</p><p><br></p><p>Calvin </p><p></p>

</div>
 


<div style="color:#fff;min-height:0;"></div>

I tried that as "Advanced" code in a Pre-Process BPM, but get the error:

"You cannot define streams inside and internal procedure. (3359)"

Then I moved the code to an "Execute 4GL code" action, using the "Execute Code Below" option.  It would validate and let me close the 4GL Action dialog.  But upon saving the BPM, I get the error:

"Compilation error: You cannot define streams inside an internal procedure. (3359)"

Maybe a step back is needed, and I tell you what my end goal is.

I need to format and export data from the AP Invoice tables (APInvHed, APInvDtl, APInvMisc, APInvTax) along with related data from tables like Vendor, and GLAcct.  

I originally did this as an ODBC report in CR, but V8's CR run time doesn't have a "save as text" export option.  So the user runs the report (everyday), exports it to a PDF, Opens the PDF, Selects all the text, copies it to the clipboard, opens notepad, pastes the text, and then saves it as a text file with the name "AP-yyymmdd.txt".

So I created a BAQ (not related to the AP data) just to be able to schedule a BAQ Export Process.  Then created a BPM to trigger on running the BAQ Export.  In theory, the 4GL code in the BPM would create the AP-yyyymmdd.txt file automatically everyday.

Calvin
 
I haven't been following this thread, but when I have to do things like you describe, I use ODBC with Microsoft Access. You can make it super user friendly front-end for the end user in access, and also can integrate it directly with other office products (such as outlook, excel, etc). We have automated many data exports this way (payroll data, bank files info, financial statements, etc)

oh you are on 8.03 :( you can do it in a .P if you'd like
​In 9 they have a declaration section that is outside the procedure.​
In 8 you could inovoke a .P file and declare it in there...Â


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Tue, Jun 14, 2016 at 12:29 PM, ckrusen1@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>I tried that as &quot;Advanced&quot; code in a Pre-Process BPM, but get the error:</p><div><br></div><div><b>&quot;You cannot define streams inside and internal procedure. (3359)&quot;</b></div><div><span><br></span></div><div><span>Then I moved the code to an &quot;Execute 4GL code&quot; action, using the &quot;Execute Code Below&quot; option.  It would validate and let me close the 4GL Action dialog.  But upon saving the BPM, I get the error:</span></div><div><span><br></span></div><div><span>&quot;<b>Compilation error: You cannot define streams inside an internal procedure. (3359)</b>&quot;</span></div><div><span><br></span></div><div><span>Maybe a step back is needed, and I tell you what my end goal is.</span></div><div><span><br></span></div><div><span>I need to format and export data from the AP Invoice tables (APInvHed, APInvDtl, APInvMisc, APInvTax) along with related data from tables like Vendor, and GLAcct.  </span></div><div><span><br></span></div><div><span>I originally did this as an ODBC report in CR, but V8&#39;s CR run time doesn&#39;t have a &quot;save as text&quot; export option.  So the user runs the report (everyday), exports it to a PDF, Opens the PDF, Selects all the text, copies it to the clipboard, opens notepad, pastes the text, and then saves it as a text file with the name &quot;AP-<i>yyymmdd</i>.txt&quot;.</span></div><div><span><br></span></div><div><span>So I created a BAQ (not related to the AP data) just to be able to schedule a BAQ Export Process.  Then created a BPM to trigger on running the BAQ Export.  In theory, the 4GL code in the BPM would create the AP-<i>yyyymmdd</i>.txt file automatically everyday.</span></div><div><span><br></span></div><div><span>Calvin</span></div><div><span> </span></div><p></p>

</div><span>
 


<div style="color:#fff;min-height:0;"></div>


I used the following code to create differently named files in my BPMs:

 

DEF VAR Outfile AS Char format 'X(500)' no-undo.

DEF VAR OString AS Char format 'X(500)' no-undo.

DEF VAR spHolder AS Char format 'X(10)' no-undo.

 

OString = string(ttCallContextBpmData.Number01) + "CustApvd.csv".

 

Outfile = "\\humservcon\SCWork\QuoteEng\drop\ " + Ostring.

OUTPUT TO VALUE(Outfile).

 

OString = "QuoteNum,UD01,UD02,UD03,UD04,UD05,UD06,UD07,UD08,UD09,UD10".

PUT UNFORMATTED Ostring SKIP(0).

 

OString = string(ttCallContextBpmData.Number01) + "," + spHolder + "," + spHolder + "," + spHolder + "," + spHolder + "," + spHolder + "," + spHolder + "," + spHolder + "," + spHolder + "," + spHolder + "," + spHolder.

PUT UNFORMATTED Ostring SKIP(0).

 

 

Brenda

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Tuesday, June 14, 2016 12:29 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: File I/O in 4GL (V8.03 / Progress OE10.1B)

 

 

I tried that as "Advanced" code in a Pre-Process BPM, but get the error:

 

"You cannot define streams inside and internal procedure. (3359)"

 

Then I moved the code to an "Execute 4GL code" action, using the "Execute Code Below" option.  It would validate and let me close the 4GL Action dialog.  But upon saving the BPM, I get the error:

 

"Compilation error: You cannot define streams inside an internal procedure. (3359)"

 

Maybe a step back is needed, and I tell you what my end goal is.

 

I need to format and export data from the AP Invoice tables (APInvHed, APInvDtl, APInvMisc, APInvTax) along with related data from tables like Vendor, and GLAcct.  

 

I originally did this as an ODBC report in CR, but V8's CR run time doesn't have a "save as text" export option.  So the user runs the report (everyday), exports it to a PDF, Opens the PDF, Selects all the text, copies it to the clipboard, opens notepad, pastes the text, and then saves it as a text file with the name "AP-yyymmdd.txt".

 

So I created a BAQ (not related to the AP data) just to be able to schedule a BAQ Export Process.  Then created a BPM to trigger on running the BAQ Export.  In theory, the 4GL code in the BPM would create the AP-yyyymmdd.txt file automatically everyday.

 

Calvin

 

Sarah - ODBC is usually my go to method for getting data out of the DB.  But I wanted to automate this so it happens on a schedule. (see my reply to Jose)