Page 2 of 2

Posted: Tue Jul 06, 2010 1:52 pm
by jpnrd
The Director log result for Execute Command is


SequencerTest1..JobControl (@Execute_Command_12): Executed: printf $(<D:\DataFiles\ETL_DEV_Seq_Files\Policy_MaxModelDate.txt>)
Reply=0
Output from command ====>

SequencerTest1..JobControl (@Execute_Command_12): Checkpointed execution of command 'printf $(<D:\DataFiles\ETL_DEV_Seq_Files\Policy_MaxModelDate.txt>)'


and Job parameter Data Type in Px_Etl_Unld_Pc_PolicyPeriod_TodaysDate1 is String....

Posted: Tue Jul 06, 2010 2:02 pm
by anbu
Do not use closing angle bracket in printf. Try printf or cat command with tr.

Code: Select all

printf "$(<D:\DataFiles\ETL_DEV_Seq_Files\Policy_MaxModelDate.txt)"
Or

Code: Select all

cat D:\DataFiles\ETL_DEV_Seq_Files\Policy_MaxModelDate.txt | tr -d '\n'

Posted: Tue Jul 06, 2010 2:08 pm
by jpnrd
Hey Anbu,

Now I am getting

SequencerTest1..JobControl (@Execute_Command_12): Executed: cat D:\DataFiles\ETL_DEV_Seq_Files\Policy_MaxModelDate.txt | tr -d '\n'
Reply=0
Output from command ====>
ModelDateMax
2010-05-26 03:34:44

Posted: Tue Jul 06, 2010 2:15 pm
by jpnrd
I think I need to eliminate that ModelDateMax now which is the column name

Posted: Tue Jul 06, 2010 2:23 pm
by jpnrd
Anbu,

I modified the sequential file settings so that I am getting

SequencerTest1..JobControl (@Execute_Command_12): Executed: cat D:\DataFiles\ETL_DEV_Seq_Files\Policy_MaxModelDate.txt | tr -d '\n'
Reply=0
Output from command ====>
2010-05-26 03:34:44



now I got this in sequence job. But still same in error is coming from the
job Px_Etl_Unld_Pc_PolicyPeriod_TodaysDate1

SQLServer_Enterprise_0,0: [IBM (DataDirect OEM)][ODBC SQL Server Driver][SQL Server]Conversion failed when converting datetime from character string.

Posted: Tue Jul 06, 2010 2:33 pm
by anbu
I am not sure whether tr command removes newline character.

Just pass first 19 chars to your job Px_Etl_Unld_Pc_PolicyPeriod_TodaysDate1 from sequence job

Code: Select all

ExecuteCmd.$CommandOutput[1,19]

Posted: Tue Jul 06, 2010 2:46 pm
by jpnrd
Hey Anbu,

I ran Successfully. You are really a Great HELP!!!! Thank You For all Your Support....

Posted: Tue Jul 06, 2010 3:13 pm
by chulett
The return value is actually a dynamic array, so one other solution would be to take just the first element from it:

Code: Select all

ExecuteCmd.$CommandOutput<1>
Another would be to strip the Field Mark that is added to the return value:

Code: Select all

Convert(@FM,"",ExecuteCmd.$CommandOutput)
Both of those solutions would be size / datatype 'agnostic'.

Execute Command

Posted: Wed Jul 28, 2010 8:38 am
by kfb_developer
chulett wrote:The return value is actually a dynamic array, so one other solution would be to take just the first element from it:

Code: Select all

ExecuteCmd.$CommandOutput<1>
Another would be to strip the Field Mark that is added to the return value:

Code: Select all

Convert(@FM,"",ExecuteCmd.$CommandOutput)
Both of those solutions would be size / datatype 'agnostic'.

What if we want to output a integer value using Execute Command... Do we need to use ExecuteCmd.$CommandOutput or ExecuteCmd.$ReturnValue.

Posted: Wed Jul 28, 2010 10:04 am
by anbu
ExecuteCmd.$CommandOutput or ExecuteCmd.$ReturnValue depends upon how you return 2 from your script.

If your script returns value using any command like echo or printf then use ExecuteCmd.$CommandOutput else if you return value using return then use ExecuteCmd.$ReturnValue.

If you are using command output, then make sure you delete newline char at the end of your output or use printf command.

Posted: Wed Jul 28, 2010 11:17 am
by kfb_developer
Thanks for your reply anbu

I am using Cat filename.txt to read a integer value in text file into a job parameter for the next job activity stage. For date datatype the solution you told above is working fine. For integer how to delete that new line char? Do we need to use anything other that Cat for integer datatype like Printf or echo?

Posted: Wed Jul 28, 2010 11:39 am
by anbu
Read the file using printf command

Code: Select all

printf $(< filename)
Or

You can run the script which has

Code: Select all

printf 2

Posted: Wed Jul 28, 2010 12:18 pm
by kfb_developer
The job is getting failed throwing me these errors

Seq_Load_TQC05_POLICY..JobControl (@Execute_Command_43): Executed: printf $(<D:\DataFiles\ETL_DEV_MaxSurrKeyFiles\TQC05_POLICY_Max_SRC_SYS_ID.txt)
Reply=1
Output from command ====>
The system cannot find the file specified.



Seq_Load_TQC05_POLICY..JobControl (@Job_Activity_46): Controller problem: Error calling DSSetParam(Jp_MaxSrcSysID), code=-4
[ParamValue/Limitvalue is not appropriate]

Posted: Wed Jul 28, 2010 12:33 pm
by anbu
$(< file) might not work in windows.

Then use cat and strip newline character as mentioned by Chulett

Posted: Wed Jul 28, 2010 12:47 pm
by kfb_developer
It worked Thanks Chulet and Anbu.... :D :D