Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

raise and catch 'File Not Found' Exception

HI,
My job looks similar to the below.
tfilelist --(Iterate) -->tfileinputdelimited --(main)--> tmap --(main)--> staging_tbl (subjob1)
| \ ^
| (subjobok) \ (reject) | (lookup)
| \ dim1
| reject table
v
(subjob2)
|
|
v
other subjobs
:
:
I would like to raise and catch the 'File Not Found' exception if the expected file is not available in the directory, but I am not getting any error 0683p000009MADq.png. Please advice.
Thank you.
Labels (2)
13 Replies
Anonymous
Not applicable
Author

Hi
Which version of TOS do you use?
I'm using TOS 5.1.1 and the component tFileList can generate error when no file found.
Regards,
Pedro
Anonymous
Not applicable
Author

Hi,
The 'File name' is coming from a database table which in turn assigned to a context variable.
The directory name is coming from the context variable.
We are using TOS 4.1.2

connecting to socket on port 3895
connected
Exception in component tFileInputDelimited_2
java.io.FileNotFoundException:

Getting the above error if my job starts with tfileinputdelimited instead of tfilelist.
Thank you.
Anonymous
Not applicable
Author

Hi
Maybe I know the reason now.
What do you mean "the expected file is not available in the directory"?
The option "Generate error if no file found" indicates that only the file doesn't exist in this directory. It will generate error.
Well. If the file exists in this directory and it cannot be accessed, the error won't occur.
Maybe you get a wrong understanding about this option?
Or. You might try to update your TOS version. TOS 4.1.2 is relatively old...
Regards,
Pedro
Anonymous
Not applicable
Author

Hi Pedro,
I have created the job to process the file 'TAL_TEST.TXT'. As stated before the file name is assigned to a context variable from the database table. The directory name is coming from the context variable.
In case the file 'TAL_TEST.TXT' is not available in the directory, I presume the job should abend and an exception should be raised. Everything works perfectly well if my job starts with tfileinputdelimited.
When I use the tfilelist --(Iterate) -->tfileinputdelimited the job is not producing any error OR is that how the tfilelist component works, if the file is not available it will continue processing. In our case the filemask will be the actual file name from the context, thus we are processing the whole job just for one file.
Hope I am clear with my issue.
Thank you.
Anonymous
Not applicable
Author

Hi
Finally, got you...
The usages of tFileInputDelimited and tFileList are apparently different.
Why don't you select the option "generate error when no file found" on tFileList?
It would show you the following exception when no file found.
java.lang.RuntimeException: No file found in directory F:/TOS_DI-r84309-V5.1.1/workspace
Regards,
Pedro
Anonymous
Not applicable
Author

Thanks Pedro,
I just noticed the check box Generate Error if no file found. However, can't the exception be caught and handled with custom message.
Anonymous
Not applicable
Author

Hi
Sorry. You can't use the custom message here.
Regards,
Pedro
Anonymous
Not applicable
Author

Thanks for the clarification Pedro.
_AnonymousUser
Specialist III
Specialist III

hi,

I want all details about a job start time,processing status,error message and reason for execution failure stop time ,total execution time,job completion status ,like this all information relating to a job to be written from tool to a database. Is it possible ? If yes ,give the sample job to achieve this scenario.

with regards,
banu