error while exporting resultset to a file in procedure

Database
Enthusiast

error while exporting resultset to a file in procedure

Hi all,
While executing the below procedure iam getting the following error.

procedure:
------------------------

Replace Procedure CFSysSPDev.AutomatedPassthruValidation(In str_sourcetable varchar(2000),
In str_targettable varchar(2000),
Out int_recorddiff integer

)

BEGIN

Declare v_strsql varchar(6000);
Set v_strsql = 'SELECT ';

FOR i AS myCur1 CURSOR FOR (
SELECT *
FROM cfstagedev.migrationmetadata
WHERE SOURCE_TABLE = str_sourcetable
AND TARGET_TABLE = str_targettable)
Do
Set v_strsql = v_strsql || i.source_column || ',';
END FOR;

Set v_strsql = SUBSTR(v_strsql, 1, (char_length(v_strsql)-1));
Set v_strsql = v_strsql || ' FROM ' || str_sourcetable;
Set v_strsql = v_strsql || ' ' || 'MINUS';
Set v_strsql = v_strsql || ' ';
Set v_strsql = v_strsql || ' SELECT ';

FOR i AS mycur2 CURSOR FOR (
SELECT *
FROM cfstagedev.migrationmetadata
WHERE SOURCE_TABLE = str_sourcetable
AND TARGET_TABLE = str_targettable)

DO
Set v_strsql = v_strsql || i.target_column || ',';
END FOR;

Set v_strsql = SUBSTR(v_strsql, 1, (char_length(v_strsql)-1));
Set v_strsql = v_strsql || ' FROM ' || str_targettable ;

/*SELECT COUNT(1) INTO :int_recorddiff FROM ( v_strsql ) A ; */

.Export File = G:\ODSCons\99. TCS User Area\BALU\balu.txt ;

call dbc.SYSEXECSQL( :v_strsql) ;

.Export RESET ;
.exit ;
END;

ERROR:
------------
SPL1027:E(L42), Missing/Invalid SQL statement'E(3707):Syntax error, expected something like an 'END' keyword between ';' and '.'.'.

Please help me out .

Thanks in advance.