Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

IS-EMPTY-FILE( ) Check file size

&pagelevel(3)&pagelevel

Domain: Environment information

The IS-EMPTY-FILE( ) function checks whether a file is empty. This is always true if the last-page pointer points to page 0, i.e. if the output field HIGH-US-PA in the output from the SHOW-FILE-ATTRIBUTES command contains the value 0.

In addition, the function recognizes if an ISAM file with existing control blocks is logically empty (i.e. if the file does not contain any record).

Format

IS-EMPTY-FILE( )

FILE-NAME = string_expression

Result type

BOOLEAN

Input parameters

FILE-NAME = string_expression
Designates the file to be checked.

Result

TRUE
Indicates that the file is empty.

FALSE
Indicates that the file is not empty.

Error messages

SDP0093    ERROR DURING ACCESS OF FILE/LIBRARY ‘(&00)‘ , ERROR ‘(&01)‘
           MORE INFORMATION: /HELP-MSG (&01)
SDP0440    NAME ‘(&00)‘ NOT A FILE NAME OR NOT A SPECIFIC FILE NAME 
SDP0453    (&00) PARAMETER IS EMPTY OR ITS LENGTH IS GREATER THAN (&01) 
           CHARACTERS OR CONTAINS ONE OR MORE SPACES 

Example

/CREATE-FILE newfile
/IF (IS-EMPTY-FILE (‘newfile‘))
/     WRITE-TEXT ‘This file is empty‘
/ELSE
/     WRITE-TEXT ‘This file is not empty‘
/END-IF

Output

This file is empty