Main Menu

KB#00060-Alias line for printing to a file

Title:

Alias line for printing to a file

Description:

To direct printer output to a file, use the following alias: 

alias PFIL $FILE "Output to File" CR,SPCOLS=255,CPCOLS=255 

Using this alias, open the printer as follows: 

open (prt,mode="FILE=/tmp/prt/"+info(3,2))"PFIL" 

Note that you can specify a default file on the alias line like so: 

alias PFIL $FILE "Output to File" CR,SPCOLS=255,CPCOLS=255,FILE=C:/print.out 


If you specify a file that doesn't already exist, you will receive an error 12, indicating that the file needs to be created first. There are several ways to ensure that the file is already there including: 

1) Using the O_CREATE and O_TRUNC modes on the alias line. This will force the file to be created if it doesn't exist, and truncated if it has data already in it. However, these modes are Operating System specific, and may not work under certain Operating Systems. Therefore, because portability is always a concern, this isn't the best method. 

2) Using BBx code to ensure the file exists. You can create and truncate a file via a program similar to: 

        10 filename$="/tmp/prt/"+info(3,2) 
        20 erase filename$,err=30 
        30 string filename$ 



Last Modified: 09/30/1998 Product: PRO/5 Operating System: All platforms

BASIS structures five components of their technology into the BBx Generations.

  Google+ View BASIS LinkedIN Profile Visit our Twitter Feed Check out our Facebook Public Profile Click to View the BASIS youTube channel