10-08-2008 5:25 AM
Hi
My program downloading data to Unix.
My requirement is, before download to unix i need to delete the existing files started with 2703 cost* .
Is it possible to use wild card? Pls help me
Regards
Anbulakshmi
10-08-2008 5:42 AM
I have done this. To access the file from UNIX...
To access the file..
*-c list in time order.
CONCATENATE 'ls -c' p_fin INTO w_list_commandin
SEPARATED BY space.
CONCATENATE w_list_commandin '/.' INTO w_list_commandin.
CALL unix list command - will populate itab_file_list ITAB
CALL 'SYSTEM' ID 'COMMAND' FIELD w_list_commandin ID 'TAB'
FIELD it_file_list-sys.
To delete..
Remove the file once it is processed
CONCATENATE 'rm' it_file_list-file_name
INTO w_runcmd SEPARATED BY space.
send command to unix to move item file
CALL 'SYSTEM' ID 'COMMAND' FIELD w_runcmd.
10-08-2008 5:32 AM
Use FM EPS_DELETE_FILE of you may delete from AL11 also.elese use Delete dataset in your program(But it won't take wild card).
10-08-2008 5:33 AM
I dont think wild cards will work with dataset statements.
One possible way is to get the list of all the files in the target directory using FM EPS_GET_DIRECTORY_LISTING and then looping into the return table and doing string comparison to find the required file. and delete the file if found using DELETE dataset in the loop.
10-08-2008 5:36 AM
10-08-2008 5:42 AM
I have done this. To access the file from UNIX...
To access the file..
*-c list in time order.
CONCATENATE 'ls -c' p_fin INTO w_list_commandin
SEPARATED BY space.
CONCATENATE w_list_commandin '/.' INTO w_list_commandin.
CALL unix list command - will populate itab_file_list ITAB
CALL 'SYSTEM' ID 'COMMAND' FIELD w_list_commandin ID 'TAB'
FIELD it_file_list-sys.
To delete..
Remove the file once it is processed
CONCATENATE 'rm' it_file_list-file_name
INTO w_runcmd SEPARATED BY space.
send command to unix to move item file
CALL 'SYSTEM' ID 'COMMAND' FIELD w_runcmd.