Seventeen Stars

how to delete data on a table (AS400)

hi,
i'm trying to delete all data on a table but it doesn't work.
I just use a "tAS400Ouput" whith context param and choice "delete" option from "action on data" menu.
and nothing appened ...
If i look to the source the SQL syntaxe is :
java.sql.PreparedStatement pstmt_tAS400Output_1 = conn_tAS400Output_1
.prepareStatement("DELETE FROM " + "LANDMUCTIS" + " WHERE ");

I only want to do :
java.sql.PreparedStatement pstmt_tAS400Output_1 = conn_tAS400Output_1
.prepareStatement("DELETE FROM " + "LANDMUCTIS");

How can i change this !??
Perhaps I have to add component to my job !?
thank for your help
9 REPLIES
Seventeen Stars

Re: how to delete data on a table (AS400)

....
I've tied with a "input" As400 component and it's work (that delete data) but return a alert from java :
Exception in component tAS400Input_1
java.sql.SQLException: Cursor state not valid.
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:389)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:366)
at com.ibm.as400.access.AS400JDBCStatement.executeQuery(AS400JDBCStatement.java:1956)
at test.delete_data_database_0_1.DELETE_DATA_DATABASE.tAS400Input_1Process(DELETE_DATA_DATABASE.java:172)
at test.delete_data_database_0_1.DELETE_DATA_DATABASE.runJobInTOS(DELETE_DATA_DATABASE.java:348)
at test.delete_data_database_0_1.DELETE_DATA_DATABASE.main(DELETE_DATA_DATABASE.java:240)

if i have to use a " onsubjobOk" it will never work for the next component.!?
an idea for this exception !?
One Star

Re: how to delete data on a table (AS400)

try with a tAS400Row with the right sql query
Seventeen Stars

Re: how to delete data on a table (AS400)

hi,
error message has changed ( it's not a java exception ... looks better so)
It's seems to be a "problem" with operation I can do with the data and the table ...
in french in the "error" text
 Table LANDMUCTIS de TLMBIB incorrecte pour cette opération.

but the code is Ok
thanks for your help
One Star

Re: how to delete data on a table (AS400)

hi
table for update must be loged on as400. see STRJRN
Seventeen Stars

Re: how to delete data on a table (AS400)

hi Chris
i'm not sure to understand what you means by "see STRJRN".
i've checked the meaning of STRJRN ... but i'm also beginner with As400 ..
thanks to give me more information.
Seventeen Stars

Re: how to delete data on a table (AS400)

hi,
I've tried to use tAS400Row to delete (not to difficult !) normaly,
but , and i often has "a but" inside (lol) , I' ve strange addition in the generated code.
I do noting very special in the job : just put value to the connection and the sql synxtaxe :
"DELETE FROM DATABASE.TABLE;"

and have an error message :
Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
Syntax error on token "=", VariableInitializer expected after this token
Syntax error on token "+", ++ expected
at test.delete_data_database_0_1.DELETE_DATA_DATABASE.tAS400Row_1Process(DELETE_DATA_DATABASE.java:156)
at test.delete_data_database_0_1.DELETE_DATA_DATABASE.runJobInTOS(DELETE_DATA_DATABASE.java:361)
at test.delete_data_database_0_1.DELETE_DATA_DATABASE.main(DELETE_DATA_DATABASE.java:259)

A normal error message if we look at the generated code .
And impossible to find the reason why !
any idea !?
thanks for you help
Seventeen Stars

Re: how to delete data on a table (AS400)

Never mind,
i 'v done an other "job" with the same properties-values ...
When i excecute the SQL request via the dialog box to test my query, it work fine
but now (and again ) have an error message when i launch the job by running it ...
 Table LANDMUCTIS de TLMBIB incorrecte pour cette opération.

like i've already said an a previous message
and i'm like on a merry-go-round now ...
thanks

Edit : find the reason why for incorrecte pour cette opération
One Star

Re: how to delete data on a table (AS400)

Seventeen Stars

Re: how to delete data on a table (AS400)

yes , i've already seen this page (and 'cause i'm french... i've read it first )
but like the forum is "in english" ... (with a lot french "speaker" I guess ..lol)