Opens a file.
Class EasycomConnection
Syntax
public EasycomFile EasycomConnection.OpenFile(String FileName)
public EasycomFile EasycomConnection.OpenFile(String FileName, openFileAccess openMode)
public EasycomFile EasycomConnection.OpenFile(String FileName, openFileAccess openMode, Boolean bCommit)
Description
Opens a physical or logical file on the server, this file can be natively used (ReadKey, ReadFirst, ...).
Parameter |
Description |
Type |
Default Value |
FileName |
Specifies the name of the file to open. This filename must specify a name and can specify a library and/or a member. |
String |
N/A |
openMode |
Specifies the open mode (ReadOnly, ReadWrite, ExclusiveRead or ExclusiveReadWrite) |
openFileAccess |
ReadOnly |
bCommit |
If true, the file will be opened in journaled mode, and will take part of transactions. |
Boolean |
False |
The filename can have the following forms:
• LIBRARY/FILE: the file is defined in an absolute form.
• FILE: the file will be opened using the *LIBL (library list) rules.
• LIBRARY/FILE(MEMBER): the file is defined in an absolute form, with a specific member (allows multi-member capable programs).
• FILE(MEMBER): opens a file using the *LIBL rules, with a specific member.
• *PGM/PGM_DEF: opens an Easycom-defined program description. Allows native program calls (using key search function).
If the member is not specified, the default member is opened. If a file has no member the function will fail.
This function returns an instance to EasycomFile class which is designed to allow native actions possible to a file, including:
o key access
o direct update/insert/delete
o record locking
o native information on fields (column heading, AS/400 data type, lengths, etc.)
o saving/retrieving position (using Relative Record Numbers)
Remarks:
o the LIBRARY can be QTEMP. But be careful: QTEMP is a "memory" library valid only for the current JOB
o the file opening process will follow file substitutions that are performed on the job scope (OVRSCOPE(*JOB) parameter of OVRDBF AS/400 command).
See also
EasycomFile constructor
Example (C#):
EasycomFile ecfile = new EasycomFile (Cnx, "EASYCOMXMP/SP_CUST", openFileAccess.ReadWrite);