Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

WILD CARD char in file Name

Former Member
0 Kudos

Hi all,

I'm trying to use the wild card character "" in file name to read files from App server using open dataset st.If the file name is 2005stcjk.txt ,and if i use wild card like 2005.txt it should be able to pick that up.I tried and i'm not getting this to work.

Is ther anything i'm missing,i guess it's possible.any help is greatly appreciated.

Thanks,

Gopal.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

I don't think you can specify a wildcard in a filename since the system would not understand which file to pick up & hence the open dataset will fail.

If you have a requirement for reading files using wildcard characters from the app server, you will first have to determine the actual filenames using a separate routine (by using the SYSTEM function to run Unix command ls to list all the filenames matching the wildcard), get these filenames in an internal table & then read each one sequentially.

3 REPLIES 3

Former Member
0 Kudos

I don't think you can specify a wildcard in a filename since the system would not understand which file to pick up & hence the open dataset will fail.

If you have a requirement for reading files using wildcard characters from the app server, you will first have to determine the actual filenames using a separate routine (by using the SYSTEM function to run Unix command ls to list all the filenames matching the wildcard), get these filenames in an internal table & then read each one sequentially.

Former Member
0 Kudos

You cannot do that. Open dataset works with only one file at a time and the filename and directory should be valid.

You can use EPS_GET_DIRECTORY_LISTING function module to get the list of files in a specific directory. You can then loop at that internal tables with file names, and do a READ DATASET on each of those files. Remember, this function module is used on the administrative side, so you need proper authorizations to use function module. Otherwise you will get a blank internal table. Also, you can do a search with wild card only with * at the end, not any other way.

Hope this helps,

Srinivas

0 Kudos

Thanks rajesh and srinivas for your response.I'll try the function module and let you know..

Thanks again.

gopal