Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to validate whether the header of file is expected or not. The expected header is passed as a context variable.
As i am using dynamic data type while reading the file, i cannot process it by any other means.
Input File - a.txt
A,B,C
1,2,3
4,5,6,7
8,9
Below commands were used, and output of tsystem is stored in global variables. But when the global variables are compared in tmap, log file is always created irrespective of whether the header matches or not.
tSystem1 -->(main) tSystem2 -->(main) tMap -->(main) tOutputFileDelimited
tSystem1 - "/bin/bash -c echo " + context.Header
tSystem2 - "/bin/bash -c echo `head -1 " + context.InputFile + "`"
tMap - ((String)globalMap.get("tSystem_1_OUTPUT")).equals(((String)globalMap.get("tSystem_2_OUTPUT"))) ? 0 : 1
Link Condition - var == 1
Output Message - Header not valid
tOutputFileDelimited - Create a log file
But, somehow, even when the header is as expected, the log file is created with output message.
What am i missing here? Also, if there is any other way to achieve the same with dynamic data type of the file, please let me know!
Even with this approach, the file is always created irrespective whether the header is same or not!