mypan := istcmsactrec.pan; func_desc := case istcmsactrec.cms_func when '01' then 'Issuance' when '02' then 'Delete' when'03' then 'Modify' when '05'then 'Lost-Hot' when '06' then 'Renewal' when '07' then 'Reprint' when '11' then'Convert' when '12' then 'issue_in_renewal' when '50' then 'Replacement' else 'Unknown' end;

--func_desc := case istcmsactrec.cms_func when 01 then 'Issuance' else 'Unknown' end; -- Locate account from ISTCARD table open c1; fetch c1 into istcardrec; if(c1%found) then if istcmsactrec.PAN_REPL <> '0000000000000000000' AND istcmsactrec.CMS_FUNC = '01' then null;-- nothing to be written else DBMS_OUTPUT.PUT_LINE(substr(istcardrec.primaryacct,14,19)||rtrim(istcmsactrec.pan)||istcmsactrec.cms_func); end if; end if; close c1;