` Printed Icetips Article

Icetips Article



Par2: Automating Stream() and Flush()
1998-08-21 -- Garry Anderson
 
If you want to add some template code to allow all files in your file
schematic to be streamed when opened and flushed before closing, you
could try something like this

Make the following changes to the PROCESS.TPW
Somewhere in the prompt section put a checkbox
#PROMPT ('STREAM and FLUSH', CHECK), %EnableStreaming, DEFAULT(0)
I put mine after the line
#PROMPT ('Quick-Scan Records', CHECK), %EnableQuickScan, DEFAULT(1)

The open files routine should look something like this
OpenFiles ROUTINE
  #INSERT (%FileControlOpen)
  #IF (%EnableStreaming)
  ! STREAM Files
  #ENDIF
#FOR (%ProcFilesUsed)
  #IF (%EnableStreaming)
  STREAM(%ProcFilesUsed)
  #ENDIF
#ENDFOR

In the ProcedureReturn ROUTINE put this at the end of the comment
section
#IF (%EnableStreaming)
!|
!| Before Closing we must FLUSH all Files that were STREAMed
#ENDIF
!|
  #FOR (%ProcFilesUsed)
  #IF (%EnableStreaming)
  FLUSH(%ProcFilesUsed)
  #ENDIF
  #ENDFOR


I have only used this with TPS files

TPS files supposedly flush automatically ~100 records but you still
need to flush them before closing.



Printed May 4, 2024, 3:20 pm
This article has been viewed/printed 35108 times.