«

»

May 20 2011

Search Files in JDE with Wild Cards

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)

Have you ever wondered if you can do a wild card search for the file you want to upload into JDE tables?

SearchLike 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.

Published under the license.

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
Search Files in JDE with Wild Cards, 5.0 out of 5 based on 1 rating
(Visited 700 times, 1 visits today)

About the author

Deepesh M Divakaran

Deepesh MD is more of a Gizmo Geek, and a techie.
A very experienced Technical Consultant on Oracle JD Edwards EnterpriseOne, and OneWorld. As a consultant he has worked for wide range of industries, from Manufacturing, Media, Oil & gas etc. and has worked on re-engineering modules, and areas of customization.
With a touch of class and understanding towards what ever he does, he is often regarded by his colleagues as the one stop answer for all Technical/Software related queries.

7 comments

Skip to comment form

  1. Vijay

    Deepesh,

    Are you aware of a solution we can use for Linux servers ? This is exactly our issue curretnly. Thans for looking into it.

    Regards,
    Vijay

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    1. Deepesh M Divakaran

      Hi Vijay,

      You could write a shell script for the purpose to be called and return value to a BSFN.

      VN:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
  2. Shahid Equbal

    Deepesh,

    I am in the need of implementing a similar functionality for my client (requirement: to read a directory from JDE 9.1 on an AS400 box). I was considering writing a C BSFN myself rather than calling an external CL program on the AS400 server to accomplish the job.

    Can you suggest something to read/search the contents of a directory on an AS400 box from JDE 9.1?

    Many thanks in Advance.
    – Shahid E

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    1. Deepesh M Divakaran

      Hi Shahid,
      IMHO, we do not have AS400 based JDE API’s for directory parse/search. You may have to include header files(like IFSIO_H) having AS400 specific API’s and then use it to your rigor. Easiest would be to use a CL script and execute it.

      VN:F [1.9.22_1171]
      Rating: +2 (from 2 votes)
  3. Shahid Equbal

    Thanks for the inputs Divakaran. Just one more thing, I read somewhere that the api readdir_r in C can work on AS400. Do you know whether the header IFSIO_H actually works through readdir_r?

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  4. Shahid Equbal

    I don’t know how did that sound but wanted to address you as Deepesh, typed out Divakaran instead…

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  5. Nelson Leong

    thank you so much, it helps me a lot =)

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

Leave a Reply