How to Check Existence, Copy, Delete or Rename a Flat File?
Purpose of Document
How to check file existence, how to copy, delete or rename a file?
Disclaimer: This document may contain information, software, products, services which are not supported by Oracle Support Services and are being provided “as is” without warranty.
Using the suggested workarounds requires advanced knowledge of the JD Edwards EnterpriseOne toolset, including but not limited to using event rules, APIs, business functions,etc.. Although logic examples may be provided; field assistance will need to be requested if the customer requires more detailed development help with their implementation. These are billable activities that are not supported by Oracle Global Support.
The following Business Functions are available which can be used to perform flat file operations.
Purpose: This function enables you to check the existence, delete and rename a file depends on Action Code as input parameter
Parameter
Data Structure: D0500180 - Operating System File Operations
Parameter Name
Data Item
Data Type
I/O
Req
Implementation
cActionCode
EV01
CHAR
I
D: Delete (szFileName1)
E: Existence to check whether such a file does exist or not for szFileName1
R: Rename (Copy szFileName1 and name it szFileName2 and delete szFileName1)
szFileName1
EXEP
String
I/O
Source file you want to delete/copy from
szFileName2
EXEP
String
I/O
Target file you want to rename to
cSetOneWorldErrorFlag
EV01
CHAR
I
This flag is to set hard code error or not
0: do not stop process even if error
1: set Hard Code Error
mnErrorCodeReturned
MATH06
Numeric
O
2 - Source File does not exist or the size is 0
9 - Action Code Invalid
Action Code D - Delete
1 - Source File (File Name 1) gets removed
Action Code E - Existence
1 - Source File does not exist
0 - Source file does exist
Action Code R - Rename
3 - File Name 2 (Target File) is Null
1 - Failed to rename it
0 - Renamed successfully
Note:
Typically you may implement rename option before you calls TC (Table Conversion) batch. In case you have this implementation, ensure that you do not call TC routine if mnErrorCodeReturned contains any error in it. Even so, check existence after rename it not to have error like in TC routine,
Purpose: This function enables you to executes a command using the native command interpreter for the platform server where the business function is mapped to run through the EnterpriseOne Object Configuration Manager (OCM)
Parameter
Data Structure: D34A1030 - Execute External Program
Parameter Name
Data Item
Data Type
I/O
Req
Implementation
cSuppressErrorMessage
SUPPS
Char
I
- 1: Suppress Error Message (You won't get any error in return) - Else: Do not suppress
ErrorCode
ERRC
String
O
3143 - File can not be accessed
szErrorMessageId
DTAI
String
O
Value defined at F9207 for error code 3143
szCommandLine
NFLF
String
I
Command line to copy file the size of command can be up to 512 characters
Note: For detailed usage of this business function, refer to <Document 636244.1> - E1: BSFN: How to use business function B34A1030 Execute External Program in EnterpriseOne
B4700230 - DeleteOrCopyFlatFile (Delete Or Copy Flat File)
Purpose: This function enables you to delete source file, delete source and target file or copy TEXT file. This business function is not designed to copy binary file. Furthermore using this bsfn to copy is inefficient, instead use B34A1030 to do copy.
Parameter
Data Structure: D4700230 - Delete Or Copy Flat File
Parameter Name
Data Item
Data Type
I/O
Req
Implementation
szOriginalFlatFile
TXTDIR
String
I
Source file name with path
szNewFlatFile
NFLF
String
I/O
Target file name with path
cActionCodeOnFlatFile
EV01
Char
I
1 - Delete original flat file
2 - Copy original flat file to new flat file
3 - Delete both original flat file and new flat file
cSuppressErrorMessage
EV02
Char
I
1 - Suppress Error
0 - Do not suppress error
cErrorCode
ERRC
Char
O
1 - Error
0 - Success
szErrorMessage
DTAI
String
O
0003 - Either the original flat file or new flat file name is blank
022U - Failed to read the original flat file
1750 - Failed to write a new flat file
0001 - Action Code is not 1 or 2 or 3
Note:
cErrorCode and szErrorMessage are implemented through <Bug 10988359>: B4700230 DOES NOT POPULATE CER - SAR: 8802711
JDEDEBUG.log does not contain error code rather it shows error message JDEERR if you do not have equivalant bug applied (because the original purpose of this function is for interactive application where error can be shown in the form)
Detail information on jdeFopen() API, refer to <Document 1298219.1> E1: BSFN: Format and Use of jdeFopen() API Function for Text Files
To specify the path and file name and in the business function, for Intel platform use backward slash. For Unix/AS400 platform use forward slash.
Example:
Intel \\ServerName\FolderName\FileName
Unix/AS400 /FolderName/FileName (in AS400 IFS is root so do not indicate server name) For detail, refer to <Document 1305796.1> - E1: 47: Representation of Path for EDI in EnterpriseOne