Your DELETE statement is not within an EXEC-SQL – END-EXEC declaration block.
But that would exec the delete statement for every record in the file. The first time it would delete all the records with a TNCOUN = ‘USA’, every time after that would be wasted cpu.
If all you are trying to do is delete all the records that have a TNCOUN = ‘USA’, then you are making this too difficult. You don’t need to have an SQL cursor to delete a set of records. If this is what you are trying to do your *whole* program could be reduced to this:
******* start source *******
Exec SQL Set Option Commit = *NONE;
Exec SQL DELETE FROM MBMTEST01/WRLDSHP WHERE TNCOUN = ‘USA';
*inlr = *on;
********end source ********
This is assuming that you are on V5R4 or higher. If you are on a lower version then you will need to surround each SQL statement with the /EXEC-SQL and /END-EXEC statements.
And if you compile your program with comit(*NONE), then you don’t even need the “Set Option” statement.
Hope this helps.