DTWF_UPDATE

AIX HP-UX Linux OS/2 OS/390 OS/400 PTX SUN Win NT
X X X X X X X X X

Purpose

Update lines in a text file with data from a Net.Data table.

Format

@DTWF_UPDATE(filename, transform, delimiter, table, retry, rows, startline)

@DTWF_UPDATE(filename, transform, delimiter, table, retry, rows)

@DTWF_UPDATE(filename, transform, delimiter, table, retry)

@DTWF_UPDATE(filename, transform, delimiter, table)

Parameters

Table 186. DTWF_UPDATE Parameters
Data Type Parameter Use Description
string filename INOUT The name of the file whose records are updated from a table variable. On successful completion of the call, this parameter returns the fully qualified file name.
string transform IN The format of the file:
  • ASCIITEXT - writes the table to the file with a new-line character between column values and ignores the delimiter parameter.
  • DELIMITED - writes the table to the file with the delimiter specified in the delimiter parameter.
A new-line character in a file indicates the end of a row of a Net.Data macro table for ASCIITEXT and DELIMITED transforms.
string delimiter IN A character string to indicate the ends of values. This parameter is case sensitive. Ignored if transform is ASCIITEXT.
table table IN The table variable from which the file records are updated.

For non-OS/400 users: The maximum length of a row in an FFI table is 16383 characters. This limit includes a null character for each column in the Net.Data macro table.

integer retry IN The number of times to retry if the file cannot be written to immediately. The default is not to retry.
integer rows IN The number of rows in the table to use when updating the file. A value of 0 means to use all the rows when updating the file; this is the default. Note that only existing lines in the file are updated, no lines are added.
integer startline INOUT The first file record to update. The default is 1, which means to start updating at the beginning of the file. If the value is greater than the number of lines in a file, the value is changed to indicate the number of the last line in the file and an error is returned.

Return Codes

Table 187. DTWF_UPDATE Return Codes
Return Code Explanation
-1001 The server could not process a Net.Data request to allocate memory.
1001 An input parameter contained a NULL value.
1002 An input parameter contained a string value which consisted of the null-terminating character.
1003 An incorrect number of parameters were passed on a function call.
1004 A parameter passed on a function call, required to be a Net.Data macro table variable, was of a different variable type.
1005 A parameter passed on a function call, required to be a string variable, was of a different variable type.
1006 A literal string was passed on a function call for a parameter which was required to be an output parameter.
1007 A parameter contains a value which is not valid.
2000 A flat file interface built-in function could not find the specified file.
2001 A flat file interface built-in function could not open the specified file because it was in use by this or another process, and could not be shared in the specified mode.
2003 A flat file interface built-in function could not read a row of data into a table variable because the number of bytes in the row exceeded the maximum supported number of bytes.
2004 A flat file interface built-in function was attempting to find a file, but encountered a path in the FFI_PATH configuration file variable that was longer than the maximum supported number of bytes, which is 4095.
2005 A call to a system function failed.
2006 A flat file interface built-in function could not access the specified file because it was in use by this or another process and could not be shared in the specified mode.

Usage Notes

If the file does not exist, an absolute path for the filename should be specified, and the directory where the file is to be created must match a directory specified in FFI_PATH. If an absolute path is not used, the file will be opened in the current working directory.

Examples

Example 1:

%DEFINE {
   myFile = "c:/private/myfile"
   myTable = %TABLE
   myWait = "1500"
   myRows = "2"
%}
@DTWF_UPDATE(myFile, "Delimited", "|", myTable, myWait, myRows)

Example 2:

%DEFINE {
   myFile = "c:/private/myfile"
   myTable = %TABLE
   myStart = "1"
   myRows = "2"
%}
@DTWF_UPDATE(myFile, "Asciitext", "|", myTable, "0", myRows, myStart)


[ Top of Page | Previous Page | Next Page | Index ]