Subject: Why two agents?
You could easily do that in one agent. Pseudo code below:
'*** List of field names with
'*** source names as list tag
fieldname(“SourceField1”) = “TargetField1”
fieldname(“SourceField2”) = “TargetField2”
etc
Set sourceDB
Set targetDB
Set view = sourceDB.GetView(“LookupMainDocs”)
Set sourceDoc = view.GetFirstDocument
Do Until sourceDoc Is Nothing
'*** Create new main doc in target db
targetDoc = New NotesDocument(targetDB)
Call targetDoc.ReplaceItemValue(“Form”,“TargetFormName”)
'*** Loop thorugh all fields and copy values
'*** to corresponding fields in target doc
ForAll i In sourceDoc.Items
Call targetDoc.ReplaceItemValue(fieldname(i.Name), i.Value)
End ForAll
'*** Mark as archived and save
Call sourceDoc.ReplaceItemValue(“Exported”,“Yes”)
Call sourceDoc.Save(True,False)
Call targetDoc.Save(True,False)
'*** Get all responses
Set responseCol = sourceDoc.Responses
set sourceResponse = responseCol.GetFirstDocument
Do Until responseCol is Nothing
targetResponse = New NotesDocument(targetDB)
Call targetResponse.ReplaceItemValue(“Form”,“TargetResponseFormName”)
'*** Loop thorugh all fields and copy values
'*** to corresponding fields in target doc
'*** just like above
Call targetResponse.MakeResponse(targetDoc)
set sourceResponse = responseCol.GetNextDocument(sourceResponse)
Loop
Set sourceDoc = view.GetNextDocument(sourceDoc)
Loop
Change values of fields, etc as required.
You probably want two lists of field names, one for the main document and one for the response documents.