The documentation under https://help.hcltechsw.com/dom_designer/12.0.0/basic/H_EXECUTE_METHOD_NDQ.html#reference_ivd_gz3_cgb and https://help.hcltechsw.com/dom_designer/12.0.0/basic/H_EXECUTE_METHOD_JAVA.html is incomplete, because it does not list all variants for the execute method.
The Lotusscript documentation only shows this syntax
Set doccol = NotesDominoQuery.Execute(Query$, Optional String ResultName, Optional Long ExpireHours)
while the JAVA documentation lists almost all possible syntax variants
DocumentCollection execute(String query) throws NotesException
DocumentCollection execute(String query, String resultname, boolean replace) throws NotesException
DocumentCollection execute(String query, String resultname, boolean replace, int expirehours) throws NotesExceptionn
The correct documentation would be
Set doccol = NotesDominoQuery.Execute(Query$)
Set doccol = NotesDominoQuery.Execute(Query$, Optional String ResultName)
Set doccol = NotesDominoQuery.Execute(Query$, Optional String ResultName, Optional boolean Replace)
Set doccol = NotesDominoQuery.Execute(Query$, Optional String ResultName, Optional boolean Replace, Optional Long ExpireHours)
for Lotusscript, and for Java
DocumentCollection execute(String query) throws NotesException
DocumentCollection execute(String query, String resultname) throws NotesException
DocumentCollection execute(String query, String resultname, boolean replace) throws NotesException
DocumentCollection execute(String query, String resultname, boolean replace, int expirehours) throws NotesException
Be aware that there is NO type check in the Lotusscript for the REPLACE parameter. It is possible to pass i.e. 42 to the method, which would work without any hint that 42 is not a valid value for true or false.