nkuebelbeck
VIP Member
As I understand it, there is no shipped method in JDE to get a list of files in a directory. It sounds like you need to depend on the underlying OS.
In my case, I need to execute a bsfn for each file in a directory. What's the best approach?
I believe I have two options
1)execute an OS program to write the directory and file list to a table and process later with a UBE and the bsfn
2)have the OS execute the BFSN for each file in the directory via an interop method(XML,BSSN etc).
any help is appreciated.
per sig, E1 server would be OS/400
EDIT : current working solution
In my case, I need to execute a bsfn for each file in a directory. What's the best approach?
I believe I have two options
1)execute an OS program to write the directory and file list to a table and process later with a UBE and the bsfn
2)have the OS execute the BFSN for each file in the directory via an interop method(XML,BSSN etc).
any help is appreciated.
per sig, E1 server would be OS/400
EDIT : current working solution
Code:
#ifdef JDENV_PC
struct _tfinddata_t c_file;
ID hFile = 0;
#endif
#ifdef JDENV_AS400
DIR *dir = NULL;
struct dirent *de = NULL;
JCHAR szd_name[255] = { 0 };
#endif
#ifdef JDENV_PC
jdeStrncat(lpDS->szDirectoryPath, _J("*.*"), 4);
if ((hFile = _tfindfirst(lpDS->szDirectoryPath, &c_file)) != -1L){
/*do stuff*/
while(_tfindnext(hFile, &c_file ) == 0){
/*do more stuff*/
}
}
#ifdef JDENV_AS400
dir = jdeOpendir(lpDS->szDirectoryPath);
if (dir){
while ((de = readdir(dir)) != NULL){
jdeToUnicode(szd_name, (ZCHAR *)de->d_name, DIM(szd_name), NULL);
/*do stuff*/
}
}
jdeClosedir(dir);
#endif
Last edited: