IBM Books

Reference

FFI Built-in Functions

DTWF_APPEND


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

X X X
X X

Purpose

Writes the contents of a Net.Data table to the end of a text file.

Format

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

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

@DTWF_APPEND(filename, transform, delimiter, table)

Parameters

Table 167. DTWF_APPEND Parameters

Data Type Parameter Use Description
string filename INOUT The name of the file to which the variable's contents are being added. 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 records are read.

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 appended to immediately. The default is not to retry.
integer rows IN The maximum number of rows from table to append. The default is to append all the rows. Specifying 0 appends all rows.

Return Codes

Table 168. DTWF_APPEND 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 The number of parameters passed on a function call either exceeded the maximum number allowed, or was less than the minimum number required by the function.
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 An 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

The current contents of a file affect the results of using DTWF_APPEND, especially the contents of the last column of the last row. If a new-line character follows the last column value of the last row of the file, appended data is placed in a new row. Otherwise, appended data becomes part of the last row of the file.

Examples

Example 1:

%DEFINE {
  myFile = "c:/private/myfile"
  myTable = %TABLE
%}
@DTWF_APPEND(myFile, "DELIMITED", " ;", myTable)

Example 2:

%DEFINE {
  myFile = "c:/private/myfile"
  myTable = %TABLE
%}
@DTWF_APPEND(myFile, "ASCIITEXT", " ;", myTable)

Example 3:

%DEFINE {
  myFile = "c:/private/myfile"
  myTable = %TABLE
%}
@DTWF_APPEND(myFile, "ASCIITEXT", " ;", myTable, "0", "10")

DTWF_CLOSE


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

X X X
X X

Purpose

Closes a file opened by DTWF_OPEN.

Format

@DTWF_CLOSE(filename, retry)

@DTWF_CLOSE(filename)

Parameters

Table 169. DTWF_CLOSE Parameters

Data Type Parameter Use Description
string filename INOUT The name of the file to close. On successful completion of the call, this parameter returns the fully qualified file name.
integer retry IN The number of times to retry if the file cannot be closed immediately. The default is not to retry.

Return Codes

Table 170. DTWF_CLOSE 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 The number of parameters passed on a function call either exceeded the maximum number allowed, or was less than the minimum number required by the function.
1005 A parameter passed on a function call, required to be a string variable, was of a different variable type.
1007 A parameter contains a value which is not valid.
2002 A flat file interface built-in function could not close the specified file because it was not opened by this macro invocation.

Examples

Example 1:

@DTWF_CLOSE(myFile, "5")

DTWF_DELETE


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

X X X
X X

Purpose

Deletes lines from a text file.

Format

@DTWF_DELETE(filename, transform, delimiter, retry, rows, startrow)

@DTWF_DELETE(filename, transform, delimiter, retry, rows)

@DTWF_DELETE(filename, transform, delimiter, retry)

@DTWF_DELETE(filename, transform, delimiter)

Parameters

Table 171. DTW_DELETE Parameters

Data Type Parameter Use Description
string filename INOUT The name of the file whose records are to be deleted. 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.
integer retry IN The number of times to retry if the records cannot be deleted immediately. The default is not to retry.
integer rows IN The maximum number of rows to delete. The default is to delete all the rows. Specifying 0 deletes all rows.
integer startrow INOUT The row number from which to begin deleting. A value of 1 means to begin deleting at the first row. If this value is greater than the number of rows in the file, the value is changed to the last record and returned as an error. The default is to start at 1.

Return Codes

Table 172. DTWF_DELETE 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 The number of parameters passed on a function call either exceeded the maximum number allowed, or was less than the minimum number required by the function.
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 An 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.

Examples

Example 1:

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

Example 2:

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

DTWF_INSERT


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

X X X
X X

Purpose

Inserts lines into a text file.

Format

@DTWF_INSERT(filename, transform, delimiter, table, retry, rows, startrow)

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

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

@DTWF_INSERT(filename, transform, delimiter, table)

Parameters

Table 173. DTWF_INSERT Parameters

Data Type Parameter Use Description
string filename INOUT The name of the file to which records are inserted. 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 records are inserted into the file.

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 maximum number of rows to insert from table. The default is to insert all the rows. A value of 0 inserts all the rows.
integer startrow INOUT The line number from which to begin inserting. If the value is greater than the number of lines in the file, the value is changed to the last record and returned as an error. Specifying 0 means to insert after the beginning of the file. The default is to start at 1.

Return Codes

Table 174. DTWF_INSERT 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 The number of parameters passed on a function call either exceeded the maximum number allowed, or was less than the minimum number required by the function.
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 An 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.

Examples

Example 1:

%DEFINE {
   myFile = "c:/private/myfile"
   myTable = %TABLE
   myWait = "3000"
%}
@DTWF_INSERT(myFile, "Delimited", "|", myTable, myWait)

Example 2:

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

DTWF_OPEN


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

X X X
X X

Purpose

Opens a text file.

Format

@DTWF_OPEN(filename, mode, retry)

@DTWF_OPEN(filename, mode)

Parameters

Table 175. DTWF_OPEN Parameters

Data Type Parameter Use Description
string filename INOUT The name of the file to open. On successful completion of the call, this parameter returns the fully qualified file name.
string mode IN The type of access requested:
  • r - opens an existing file for reading.
  • w - creates a file for writing. (Destroys existing file of same name, if it exists.)
  • a - opens a file for appending. Net.Data creates the file if it is not found.
  • r+ - opens an existing file for reading and writing.
  • w+ - creates a file for reading and writing. (Destroys existing file of same name, if it exists.)
  • a+ - opens a file in append mode for reading or appending. Net.Data creates the file if it is not found.
integer retry IN The number of times to retry if the file cannot be opened immediately. The default is not to retry.

Return Codes

Table 176. DTWF_OPEN 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 The number of parameters passed on a function call either exceeded the maximum number allowed, or was less than the minimum number required by the function.
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 An 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.
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

  1. When 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.
  2. DTWF_OPEN keeps the file open, otherwise, the file is closed after each flat file operation.
  3. Use DTWF_OPEN to reduce the number of times a file is open. If DTWF_OPEN is not used, the file is closed after each flat file operation. The file is left open until it is closed using DTWF_CLOSE or macro processing ends.

Examples

Example 1:

%DEFINE {
  myFile = "c:/private/myfile"
  myMode = "r+"
%}
@DTWF_OPEN(myFile, myMode, "1000")

DTWF_READ


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

X X X
X X

Purpose

Reads lines from a text file into a Net.Data table.

Format

@DTWF_READ(filename, transform, delimiter, table, retry, rows, startrow, columns)

@DTWF_READ(filename, transform, delimiter, table, retry, rows, startrow)

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

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

@DTWF_READ(filename, transform, delimiter, table)

Parameters

Table 177. DTWF_READ Parameters

Data Type Parameter Use Description
string filename INOUT The name of the file whose records are read into 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 OUT The table variable into which the file records are read.

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 read immediately. The default is not to retry.
integer rows INOUT The maximum number of file records to read into table. The default is to read all the records, or until the table is full. A value of 0 means to read until the end of the file. The number of rows in the resulting table is returned.
integer startrow IN The record in the file from which to start reading. The default is to start reading at the first record.
integer columns OUT Returns the number of columns in the table.

Return Codes

Table 178. DTWF_READ 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 The number of parameters passed on a function call either exceeded the maximum number allowed, or was less than the minimum number required by the function.
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.
1010 Data was written to the table until it was full, and the remainder of the data was discarded.
2000 An 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.

Examples

Example 1:

%DEFINE {
  myFile = "c:/private/myfile"
  myTable = %TABLE
  myWait = "1000"
%}
@DTWF_READ(myFile, "DELIMITED", ";", myTable, myWait)

Example 2:

%DEFINE {
  myFile = "c:/private/myfile"
  myTable = %TABLE
  myWait = "0"
  myRows = "0"
  myStartrow = "1"
  myColumns = ""
%}
@DTWF_READ(myFile, "DELIMITED", ";", myTable, myWait, myRows,
             myStartrow, myColumns)

Example 3:

%DEFINE {
  myFile = "c:/private/myfile"
  myTable = %TABLE
%}
@DTWF_READ(myFile, "ASCIITEXT", ";", myTable)
@DTW_TB_TABLE(myTable,"BORDER","")

DTWF_REMOVE


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

X X X
X X

Purpose

Deletes an entire file.

Format

@DTWF_REMOVE(filename, retry)

@DTWF_REMOVE(filename)

Parameters

Table 179. DTW_REMOVE Parameters

Data Type Parameter Use Description
string filename INOUT The name of the file to delete. On successful completion of the call, this parameter returns the fully qualified file name.
integer retry IN The number of times to retry if the file cannot be deleted immediately. The default is not to retry.

Return Codes

Table 180. DTWF_REMOVE 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 The number of parameters passed on a function call either exceeded the maximum number allowed, or was less than the minimum number required by the function.
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 An flat file interface built-in function could not find the specified file.
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.

Examples

Example 1:

%DEFINE myFile = "c:/private/myfile"
@DTWF_REMOVE(myFile)

Example 2:

%DEFINE {
  myFile = "c:/private/myfile"
  myWait = "2000"
%}
@DTWF_REMOVE(myFile, myWait)

DTWF_SEARCH


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

X X X
X X

Purpose

Searches a text file for a string, returning the results into a Net.Data table.

Format

@DTWF_SEARCH(filename, transform, delimiter, table, searchFor, retry, rows, startrow)

@DTWF_SEARCH(filename, transform, delimiter, table, searchFor, retry, rows)

@DTWF_SEARCH(filename, transform, delimiter, table, searchFor, retry)

@DTWF_SEARCH(filename, transform, delimiter, table, searchFor)

Parameters

Table 181. DTWF_SEARCH Parameters

Data Type Parameter Use Description
string filename INOUT The name of the file to search. 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 OUT The table variable into which the search results are placed. Three columns are returned if transform is DELIMITED:
  • The row in which the match was found.
  • The column in which the match was found.
  • The matching column from the file.

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.

string searchFor IN The string of characters to search for.
integer retry IN The number of times to retry if the file cannot be searched immediately. The default is not to retry.
integer rows INOUT The maximum number of rows to read into table. The default is to read all the rows or until table is full. Specifying 0 reads to the end of the file. The number of rows in the resulting table is returned by this parameter.
integer startrow IN The record in the file to start searching from. The default is 1, which begins the search at the first record.

Return Codes

Table 182. DTWF_SEARCH 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 The number of parameters passed on a function call either exceeded the maximum number allowed, or was less than the minimum number required by the function.
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.
1010 Data was written to the table until it was full, and the remainder of the data was discarded.
2000 An 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

  1. The table that is returned for DTWF_SEARCH has three columns. The first two columns contain the row and the column number where the match is found; the last column contains the column value that contains the characters that are specified in the SearchFor parameter. For example, if the fourth row of the file contains matching characters in column three, the returned table has a row with the number 4 in the first column to indicate the row of the file that it came from; it has a number 3 in the second column to indicate which column of the file contains a match; and it has the complete column value in the third column.
  2. The SearchFor parameter cannot include the contents of the delimiter parameter.

Examples

Example 1:

%DEFINE {
  myFile = "c:/private/myfile"
  myTable = %TABLE
  myWait = "1000"
  mySearch = "0123456789abcdef"
@DTWF_SEARCH(myFile, "DELIMITED", ";",
               myTable, mySearch, myWait)

Example 2:

%DEFINE {
  myFile = "c:/private/myfile"
  myTable = %TABLE
  mySearch = "answer:"
  myWait = "0"
  myRows = "0"
  myStartrow = "1"
%}
@DTWF_SEARCH(myFile, "DELIMITED", ";", myTable,
               mySearch, myWait, myRows, myStartrow)

DTWF_UPDATE


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
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, startrow)

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

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

@DTWF_UPDATE(filename, transform, delimiter, table)

Parameters

Table 183. 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 maximum number of records to be updated from table. The default is to update all the records. A value of 0 means to update all rows in the file.
integer startrow 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 records in a file, the value is changed to indicate the number of the last record in the file and an error is returned.

Return Codes

Table 184. 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 The number of parameters passed on a function call either exceeded the maximum number allowed, or was less than the minimum number required by the function.
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 An 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)

DTWF_WRITE


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

X X X
X X

Purpose

Writes the contents of a Net.Data table to a text file.

Format

@DTWF_WRITE(filename, transform, delimiter, table, retry, rows, startrow)

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

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

@DTWF_WRITE(filename, transform, delimiter, table)

Parameters

Table 185. DTWF_WRITE Parameters

Data Type Parameter Use Description
string filename INOUT The name of the file the records of the table variable are written to. 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 used to export rows to the file.

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 to not retry.
integer rows IN The maximum number of file records to write. The default is to write the entire table. A value of 0 means to write all records to the end of the file.
integer startrow INOUT The record number to start writing to in the file. The default is 1, which means to start at the first record. If a value beyond the end of the file is specified, the last row of the file is returned with an error.

Return Codes

Table 186. DTWF_WRITE 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 The number of parameters passed on a function call either exceeded the maximum number allowed, or was less than the minimum number required by the function.
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 An 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
%}
@DTWF_WRITE(myFile, "DELIMITED", ";", myTable)

Example 2:

%DEFINE {
  myFile = "c:/private/myfile"
  myTable = %TABLE
%}
@DTWF_WRITE(myFile, "ASCIITEXT", ";", myTable, "5000")

Example 3:

%DEFINE {
  myFile = "c:/private/myfile"
  myTable = %TABLE
%}
@DTWF_WRITE(myFile, "ASCIITEXT", ";", myTable, "5000", "10", "50")


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