The FILE statement for the output file describes the file and database references and must be present in program. The optional INPUT parameter identifies the automatic input to the activity. This means that all input-related logic, such as opening the file, checking for end of file, and reading, and opening the output file, are all controlled by CA Easytrieve. If a input file is empty, processing continues witth the END-OF-FILE routines. Possible, there are existing user routines for output file processing (delete, etc). Virtual files without RETAIN option on the FILE statement are deleted when closed. Try to use the CREATE option on the FILE statement for the output file. Coding the DEFER option on the FILE statement instructs CA Easytrieve to delay the opening of the file until the first input or output operation for the file occurs. Only in MVS environment, the default opens all referenced files at the beginning of each CA Easytrieve activity.The FILE statement for the output file describe the file and database references and must be exist in program. You can set the file description string using an environment variable with the same name used in the FILE statement. For example, to reference a program containing this FILE statement: FILE EMPLOYEE F(88) INDEXED
Bourne and KORN shell users in Unix environment can specify:
EMPLOYEE=file-description-string export EMPLOYEE
C shell users in Unix environment can specify:
setenv EMPLOYEE file-description-string
Alternately, you can also use the SYSNAME parameter of the FILE statement dynamically by using a field-name or statically to supply the file-identifier. For example of static supply the file-identifier:
FILE EMPLOYEE-MASTER F(88) INDEXED SYSNAME 'EMPLOYEE'
There are some differences in the processing of Easytrieve in the MVS and in the Windows/Unix environment. In the MVS environment the Easytrieve opens automatically all defined files at program start exceptional the mentioned reason above. In Windows/Unix environment the DEFER option is the default. That instructs CA Easytrieve to delay the opening of the file until the first input or output operation for the file occurs.
You can solve/circumvent your problem with the statement:
Now, also on Windows and Unix an empty output file is written without PUT statement. This CLOSE statement should be written into own JOB routine as example:
PARM DEBUG(DMAP PMAP) FILE INFILE F(80) INFIELD1 1 80 A FILE OUTFILE SEQUENTIAL F(80) CREATE PROGRAM NAME CLOSETEST EXECUTE JOBSTART EXECUTE JOBENDE EXECUTE JOBCLOSE STOP JOB INPUT INFILE NAME JOBSTART STOP JOB INPUT NULL NAME JOBCLOSE CLOSE OUTFILE STOP JOB INPUT NULL NAME JOBENDE DISPLAY INFIELD1 STOP END