Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Please see the design above:
I want to unzip all .gz files into a "temp" folder. In case if it fails when unzipping one .gz file, I want the filename and error message printed out.
But I also don't want the job to fail when that happens -- so I have "Die on Error" unchecked in tFileUnarchive step.
I used a fake .gz file (I renamed a regular text file as .gz file) with several real .gz files for testing.
I don't get the error message at all. I did have something show up in the print out area, but not from my code:
Is it because I unchecked "Die on Error" so the OnComponentError would never be fired?
Does anyone have a good idea to catch the filename and error message when there is a problem unzipping the file, but still let the job continue?
Thanks!
Hi,
I've provided 2 variants:
as an example - http://kb.winzip.com/kb/entry/124/ or https://stackoverflow.com/questions/41902600/how-would-i-extract-a-gz-file-from-cmd-using-only-comma...
if the execution was successful, error code will be 0, if any error - not 0, and variables will display to you what happens
cheers,
Hi,
as a variant which is definitely working - put Unzip and error logic into SubJob (tRunJob)
Uncheck DieOnChildError, but in the child job use Die On Error for component
another variant, use tSystem and If triggers:
Thank you so much for your quick response!
But I have problem understanding what you wrote, especially when I'm looking at your design screenshot --
could you please help create a more understandable job if you have time?
BTW, if I want to use tSystem to unzip a group of .gz files, what should the command be?
Thanks!
Hi,
I've provided 2 variants:
as an example - http://kb.winzip.com/kb/entry/124/ or https://stackoverflow.com/questions/41902600/how-would-i-extract-a-gz-file-from-cmd-using-only-comma...
if the execution was successful, error code will be 0, if any error - not 0, and variables will display to you what happens
cheers,
I hope I understand you now.
I created a stand alone job ("unzip_file") with tFileList --Iterate--> tFileUnarchive --OnComponentError -> tJava (Print out error message) . I checked " Die on Error" within tFileUnarchive.
In my original job, I replaced above subjob with a tRunJob component and it calls job "unzip file".
Leave "Die on child error" unchecked.
I launched the job -- this time, I saw my error message print out my code. BUT, there is one problem: the child job didn't unzip ALL of the files. I believe when it encountered the bad file, it failed and it stopped unzipping the rest of the files.
Please let me know if I did it correctly. Thank you!
@Moe wrote:
I launched the job -- this time, I saw my error message print out my code. BUT, there is one problem: the child job didn't unzip ALL of the files. I believe when it encountered the bad file, it failed and it stopped unzipping the rest of the files.
Please let me know if I did it correctly. Thank you!
you need to run subjob for each file (filename as parameter from parent)
cheers, Vlad
Thanks! It's working now.