Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : OS-APPEND statement
 

OS-APPEND statement

Executes an operating system file append command from within ABL.

Syntax

OS-APPEND
{ source-filename | VALUE ( expression ) }
{ target-filename | VALUE ( expression ) }
source-filename
The name of the source file. (If you append file A to file B, file A is the source file.) If you specify a directory, OS-APPEND generates an error. The filename can contain Unicode characters. See OpenEdge Development: Internationalizing Applications for more information about Unicode.
VALUE ( expression )
An expression that returns the name of the source file. (If you append file A to file B, file A is the source file.) expression can contain constants, field names, and variable names. The filename can contain Unicode characters.
target-filename
The name of the target file. (If you append file A to file B, file B is the target file.) The filename can contain Unicode characters.
VALUE ( expression )
An expression that returns the name of the target file. (If you append file A to file B, file B is the target file.) expression can contain constants, field names, and variable names. The filename can contain Unicode characters.

Example

This procedure opens a dialog box that prompts the user to choose a source file for the append. It then prompts for a name for the target file. Finally, the procedure uses the OS-APPEND statement to append the source file to the target file.
r-os-app.p
DEFINE VARIABLE sourcefile AS CHARACTER NO-UNDO.
DEFINE VARIABLE targetfile AS CHARACTER NO-UNDO FORMAT "x(20)"
  VIEW-AS FILL-IN.
DEFINE VARIABLE OKpressed  AS LOGICAL   NO-UNDO INITIAL TRUE.

Main:
REPEAT:
SYSTEM-DIALOG GET-FILE sourcefile
TITLE "Choose Source File For Append"
MUST-EXIST
USE-FILENAME
UPDATE OKpressed.

IF OKpressed = FALSE THEN
LEAVE Main.
UPDATE targetfile WITH FRAME appendframe.
OS-APPEND VALUE(sourcefile) VALUE(targetfile).
END.

Notes

*The filenames must conform to the naming conventions of the underlying operating system.
*If target-file names a file that does not exist or a directory, OS-APPEND becomes an OS-COPY and a copy is created in the current or specified directory. If an error occurs during the copy, the AVM deletes the partial target-file.
*Although an error can occur during execution of this statement, the statement does not generate an error message, raise an error condition, or affect the program's flow in any way. Check for an execution error by using the OS-ERROR function and evaluating the return.
*If you specify the same file for the source and the target, the append fails but OS-ERROR is not set.

See also

OS-ERROR function