Focal Point
[CASE-OPENED] Command Task in Iway Data Migrator

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/8857067436

November 19, 2013, 05:33 AM
Balaji
[CASE-OPENED] Command Task in Iway Data Migrator
Hi All,

I need to invoke a batch script from Iway Data Migrator Process flow. How can I achieve this? Kindly help me with your suggestions.

Thanks,
Balaji

This message has been edited. Last edited by: <Kathryn Henning>,
November 19, 2013, 12:06 PM
Sharon R.
I have done this by creating a WF stored procedure (.fex) with the following code,
This sample code passes one variable to the .bat script. The script needs to be in
the location path specified in the call command.

-TYPE **************************************************************************
-TYPE CSV FILE NAME: &CSV_FILE
-DOS CALL "e:\ibi\apps\lps_ch_upload\TRANSFER_FILES\ZipCSV.bat" &CSV_FILE E:\ibi\apps\lps_ch_upload\TRANSFER_FILES, E:\ibi\apps\lps_ch_upload\TRANSFER_FILES;
-RUN
-TYPE END OF JOB
-TYPE **************************************************************************


I then create a Data Migrator FLOW that calls this WF stored proc (that way
the results go to the ETLLOG, which includes any PRINT statements from the .bat script).
The FLOW that calls it will pass in the desired csv_file value.

If you don't have a parameter in your .bat file, just leave it off the call command;
or, if you have multiple parameters, just list them all at the end of the call command
(in the expected order by the .bat script, there are NO commas between parm values).

Hope this helps.
November 19, 2013, 11:27 PM
Balaji
Hi Sharon,

This is the code I have used in my procedure

-TYPE

-DOS CALL "C:\Users\bnagaraj\Desktop\xyz.bat"


-RUN


- TYPE END OF JOB

And this is the content of my xyz.bat file
echo Test write >> xyzwrite.txt


When I run this in a process flow I am getting the message mentioned below.

DEP_0: procedure command_test_proc started.
C:\ibi\DEVSTU~1\srv77\wfs\edatemp\ts000011>echo Test write 1>>xyzwrite.txt
END OF JOB
(ICM18039) DEP_0 command_test_proc Return Code = 0

My procedure executed successfully and the batch file is invoked.
But the file xyzwrite.txt is not created in the directory where xyz.bat is located.

I tried this too. But it didnt work.
-RUN
DOS C:\Users\bnagaraj\Desktop\xyz.bat
-RUN
-END


Please tell me what is the problem here.

Thanks

Balaji
November 21, 2013, 05:51 PM
Clif
If you don't specify a directory in your output redirection the file will be written to the current directory. In the case of an agent running on our server that's a temporary directory.

Try putting the following command at the end of your focexec and you should see your file name in the log.
!dir

However temporary directories (such as ts000011) are (by default) automatically deleted when the flow completes. That's so that another flow that uses the same agent (and thus directory) wouldn't find files left behind.

Try writing your file out to a more permanent location.

This message has been edited. Last edited by: Clif,


N/A
November 22, 2013, 04:35 AM
Balaji
Clif,

I tried using !dir command at the end.
But when I run it, I am getting the same message.
And my batch file is not in the temp folder.It is located in the C:\Users\Username\Desktop directory. So it will create a file named xyzwrite.txt in the same directory . It is working fine when I run the batch file from cmd.
But I am getting this message when I invoke the batch script from procedure.
November 22, 2013, 10:28 AM
Clif
Please open a case with hotline; they will be better able to assist you.


N/A