In part 1 I described that the program was not able to open the database file: the filename was read from a field and its name contained spaces, it needed to be trimmed.
The code was:
file = FIELD->DBFNAME key1 = FIELD->INDEX1 key2 = FIELD->INDEX2 key3 = FIELD->INDEX3 IF my_netuse( file, ... ) SET INDEX to &KEY1, &KEY2, &KEY3
My solution was to trim the filename directly in my_netuse():
FUNCTION my_netuse( file, ....) ... file := alltrim( file )
Then I discovered that the indexes were not in the backups and so I needed to create them, incorporating the first external program into the main one, as decribed in the previous post.
The indexes were correctly created but with spaces in their name. Also the index names, as you can read in the previous code snippet, are read from a database, and so also I must trim them too!
Shortly, I add a trim() for the index file name during creation and then modified the previous code to:
file = trim( FIELD->DBFNAME ) key1 = trim( FIELD->INDEX1 ) key2 = trim( FIELD->INDEX2 ) key3 = trim( FIELD->INDEX3 ) IF my_netuse( file, ... ) SET INDEX to &KEY1, &KEY2, &KEY3
Now all files are opened correctly, dbf and ntx.