Using Remote Files

When a program needs to read from or write to a remote device attached to the system, it opens a remote file and associates it with that device. A common example of this is a program that sends data to or accepts input from the terminal where the program was initiated. Special measures are required when using WFL to initiate a program that reads from or writes to a remote file.

When a program tries to open a remote file, by default it tries to associate that file with the station the program was initiated from. However, if the program was initiated by a WFL job, then the program is not associated with a station, and an error is generated when it attempts to open the remote file.

To prevent this problem, you can include the following statement near the start of the WFL job, before any tasks are initiated:

MYJOB(STATIONNAME = #MYSELF(SOURCENAME));

This statement causes the STATIONNAME attribute of the WFL job to store the name of the station that initiated the job. Any tasks of that job inherit the STATIONNAME value. When any of these tasks opens a remote file, the remote file is linked by default to the station that initiated the WFL job.

Before the STATIONNAME task attribute was implemented, the STATION task attribute was the only method of specifying the default station for remote files. The STATION attribute identifies a station by its logical station number (LSN). Use STATIONNAME rather than STATION because the station name is stable, whereas the LSN is subject to change.

The setting of the CANDE LAISSEZFILE option affects the ability of the program to open remote files that are not directly associated with its own session. According to the value of LAISSEZFILE, the task attribute assignment in the previous example might be sufficient to enable the program to open the remote file, or the system might ask for an OK from the station before the remote file is opened, or the program might be prohibited from opening the remote file. Refer to remote files in the CANDE Configuration Reference Manual for further information.

Another approach to dealing with programs that use remote files would be to file-equate the remote files to a different KIND, such as DISK or READER.