Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Capturing Error Code 4 into my flag file

Saradevi wrote:

No, it should write to HRMSEarningLeaveBalanceExportFileNotDownloaded.txt as an Error but it is not writing.

I've meant, if you get a record stored (incorrectly) in the "success" branch. Or if you do not get any record at all.
Saradevi

Capturing Error Code 4 into my flag file

No, it should write to HRMSEarningLeaveBalanceExportFileNotDownloaded.txt as an Error but it is not writing.
Error Code 4 and its corresponding message information is writing only to log file i.e.,
\\hqolymappim3q\Informatica\PowerCenter Server\FlagFiles\LaborReplacementSystem\EarningLeaveBalanceExport\HRMSEarningLeaveBalanceExport_!Y!M!D!T.log

Please find the script below to capture errors and my SFTP process should fail or aborts.

if %ERRORLEVEL% neq 0 goto error
if %ERRORLEVEL% equ 0 goto success

:success
echo
"Success" >> "\\hqolymappim3q\Informatica\PowerCenter Server\FlagFiles\LaborReplacementSystem\EarningLeaveBalanceExport\HRMSEarningLeaveBalanceExportFileDownloadedSuccessFully.txt"

exit /b 0
:end

:error
echo "Error" >> "\\hqolymappim3q\Informatica\PowerCenter Server\FlagFiles\LaborReplacementSystem\EarningLeaveBalanceExport\HRMSEarningLeaveBalanceExportFileNotDownloaded.txt"

exit /b 1
:end

Also if there is an error it should goto the error echo statement but it is not happening.Is there anything i need to make the code change.
martin

Your batch file works for me just fine.
So when you get "error 4", is a record stored to HRMSEarningLeaveBalanceExportFileDownloadedSuccessFully.txt?
Saradevi

Attaching the .bat file whih runs the script file that i attached in previous post
Saradevi

Re: Capturing Error Code 4 into my flag file

martin wrote:

Your example does not show where/how you run WinSCP.


Thanks Martin for the reply.Plesase find the script file and .bat file which i use to run the script.
martin

Re: Capturing Error Code 4 into my flag file

Your example does not show where/how you run WinSCP.
Saradevi

Capturing Error Code 4 into my flag file

Hi Martin,
This is SaraDevi and i am new to the Winscp Batch script.Please help and really appreciate it.
I am using the below script to send a flag when script returns error codes.

if %ERRORLEVEL% equ 1 goto error
if %ERRORLEVEL% equ 0 goto success

:succes
echo
"Success" > "\\hqolymappim3q\Informatica\PowerCenter Server\FlagFiles\LaborReplacementSystem\EarningLeaveBalanceExport\HRMSEarningLeaveBalanceExportFileDownloadedSuccessFully.txt"

exit /b 0
:end

:error
echo "Error" > "\\hqolymappim3q\Informatica\PowerCenter Server\FlagFiles\LaborReplacementSystem\EarningLeaveBalanceExport\HRMSEarningLeaveBalanceExportFileNotDownloaded.txt"

exit /b 1
:end
But it didnt write the HRMSEarningLeaveBalanceExportFileNotDownloaded.txt even though script returns exit code 1.
Could you please help if i am doing anything wrong.
Also please find the log attached to the post and do let me know if i am doing anything wrong.

Thanks,
SaraDevi