NL015: COMPRESS target is used as work file path without LEAVING NO SPACE

NL015: COMPRESS target is used as work file path without LEAVING NO SPACE

type: bug
priority: major

#pitfall
#confusing
#suspicious

Description

The variable that this COMPRESS is compressing into is used as a file path for a DEFINE WORK FILE.

The COMRESS does not specify LEAVING NO SPACE, which can result in the file path containing spaces where they are not expected (e.g. a leading space in the file name).

Problem

#FILENAME := 'file.txt'
COMPRESS '$HOME/folder/' #FILENAME INTO #FILEPATH
DEFINE WORK FILE 1 #FILEPATH

The resulting file path will contain a space: $HOME/folder/ file.txt.

Solution

Add LEAVING NO SPACE:

#FILENAME := 'file.txt'
COMPRESS '$HOME/folder/' #FILENAME INTO #FILEPATH LEAVING NO SPACE
DEFINE WORK FILE 1 #FILEPATH

The resulting file path will contain a space: $HOME/folder/file.txt.