Exam4Training

Which code should you use in a tJava component to write a nb-line variable?

You need to calculate the total number of rows in an input file using a tMlelnputDelimited component.

Which code should you use in a tJava component to write a nb-line variable?
A . Int nb_line-(integer) globalMap.put(‘’tFileInputDelimited_1_NB_LINE’’)
B . Int nb_line=(integer)globalMap.put(‘’tFileInputDelimited_1_NB_LINE’’)
C . Int nb.line-(integer) globalMap.put(‘’tFileInputDelimited_1_NB_LINE’’)
D . Int nb_line-(String) globalMap.put(‘’tFileInputDelimited_1_NB_LINE’’)

Answer: C

Explanation:

You need to use the following code in a tJava component to write a nb_line variable:

int nb_line = (Integer)globalMap.get(“tFileInputDelimited_1_NB_LINE”);

This code retrieves the value of the global variable tFileInputDelimited_1_NB_LINE, which stores the number of rows processed by the tFileInputDelimited component, and assigns it to an integer variable named nb_line. You can then use this variable to print or manipulate the number of rows in your Job. Note that you need to use globalMap.get, not globalMap.put, to access the value of a global variable.

Exit mobile version