cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

wait function

Former Member
0 Likes
763

Hi All,

Please provide me inputs, Here is my scenario.

I came up with  wait_for_file( $GV_FILE_PATH || '/' || $GV_FILE_TYPE || '*' || '.TXT',0,0,1,$GV_FILE_NAME);  to check the path and find the file to process. Finally assign it to $GV_FILE_NAME in one of the pre-processing script.

But the $GV_FILE_NAME is capturing the complete path where I don't it because I am assigning this value to source Flat file's file name(s).


Note : $GV_FILE_PATH  is defined as global variable with path as value.


If run the job ,it will throw error because path is already defined and wait_for_file function is pulling the complete path.



Cannot open file </test/Ecommerce/IBMMainFrame/Acknowledge_Files/test/Ecommerce/IBMMainFrame/Acknowledge_Files/POV_Confirm_1.TXT>.



All I need is pull just the file name from the wait_for_file.


Please advice.


View Entire Topic
former_member106536
Active Participant
0 Likes

Heres a custom function to do it.  (I use the word count function all over the place)

custom function:

$ret_fn = word_ext($InputFilePath,JB_WordCount($InputFilePath,'/'),'/');

Return($ret_fn);

word count function:

$SubstrIdx = 0;

begin

  while(word_ext($StringInput,$SubstrIdx + 1,$Delimiter) <> '')

  begin

  $SubstrIdx = $SubstrIdx + 1;

  end

end

return($SubstrIdx);

Former Member
0 Likes

Can you explain with an example ??

I didn't understand in this area $ret_fn = word_ext($InputFilePath,JB_WordCount($InputFilePath,'/'),'/');