SQLRPGLE FNDSTRPDM
**FREE
ctl-opt dftactgrp(*no) actgrp(*caller);
Dcl-F s_keys Usage(*input) Keyed rename(S_KEYS: R_Skeys);
dcl-s lv_skeys char(10);
dcl-s cmdString char(500);
Dcl-s lv_CmDLen packed(15:5);
dcl-s found char(1);
Dcl-Pr RunCommand Extpgm('QCMDEXC');
*n char(500); // command
*n packed(15:5); // command length
End-PR;
exec sql
declare skeys_cursor cursor for
select settlement_key from s_keys;
exec sql
open skeys_cursor;
Exec sql
Fetch Next From skeys_cursor into :lv_skeys;
dow sqlcode = 0;
// Build FNDSTRPDM command
cmdString = 'FNDSTRPDM STRING(' + %trim(lv_skeys) +
') OPTION(*DSP) FILE(COMPRDSRC/QRPGSRC) MBR(*ALL)';
// Run the command
lv_CmDLen = %Len(%trim(cmdString));
RunCommand( cmdString : lv_CmDLen ) ;
// Optional: You can redirect output to a file and read it back
// to determine if the string was found. For simplicity, we assume
// the command shows results interactively or logs them.
Exec sql
Fetch Next From skeys_cursor into :lv_skeys;
enddo;
exec sql
close skeys_cursor;
*inlr = *on;