Perform a File Search in JDE

Have you ever wondered if you can do a wild card search for the file you want to upload into JDE tables?
Like while you do an interface, where the files come in with Date/Time stamps, you can find the latest file, and then upload it! It used to be a crude way of doing where, you used to write a Driver program, which gets the file name using the Processing Options, and then rename it according to the way your Table conversion has the file name.
You can do a file search or even do a Wild card search; for e.g. you have to find files which start with FileUpload*, and the files in the directory are FileUpload_050111.txt, FileUpload_050311.txt, FileUpload_050611.txt, FileUpload_061011.txt.
We use the BSFN – B9600471 (Find First File Matching Wild Card) to search for a file. The BSFN is fairly simple to use. You just need to use the Wild card = ‘*’ to perform the Wild search.
Following is an example of the code in use.
VA evt_PartialFileName_DL011 = concat(‘*Upload_my_File_’,concat([VA rpt_EdiBatchNumber_EDBT],’*‘)
VA evt_TargetDirectory_NFLF = concat([VA rpt_QueuePath_QUPATH],concat(‘\’,[VA evt_PartialFileName_DL011]))
VA evt_FileFound_NFLF = “”
VA evt_CDHandle_CDHNDL = “”
//
Find First File Matching Wildcard

VA evt_CDHandle_CDHNDL <> BF hFile
VA evt_TargetDirectory_NFLF -> BF szTargetDirectory
VA evt_FileFound_NFLF <- BF szFileName

Find Next File Matching Wildcard

VA evt_CDHandle_CDHNDL <> BF hFile
VA evt_FileFound_NFLF <- BF szFileName

This way, you can use the CDHandle pointer to do consecutive searches (using FindNextFileMatchingWildcard) incase you have multiple files with similar matching names in the directory.
The only Cons of the BSFN is that this works only on Windows Machines. AS400, Linux/Unix based systems are exempted.

3 thoughts on “Perform a File Search in JDE

  1. Terry Reply

    Hi,
    How did you get this business function to run on the server? As far as I can tell it is a client only business function that can only be run on a fat client?

  2. Mayuri Reply

    Hi,
    Do you have any solution or suggestion for this wild card search function in Linux server ?

  3. Priya Reply

    Hi Deepesh,
    I am trying to read set of files from a path (using above BSFN), process them and store them in a new Location and delete the files from Original Location.
    But the Enterprise Server is not allowing me to delete the files. Its keeping them still open.
    Is there a function to free the Handle ? Need your help.
    Thanks in advance.

Leave a Reply