/* + PRCMBRLST: Process each row of a DSPFD outfile member (a list). The given + command is executed using relevant values from the list row. + + A command is supplied that the list is processed against. The + command string may have special 'substitution' values that will + be replaced by 'replacement' values from the list. The modified + command is then executed. The file name, file library and member + name are the replacement values that may be used. + */ pgm ( + &pCmd + &pLstNam + &pqLstF + &pPrcErr + &pErrAct + ) dcl &pCmd *char 6002 dcl &pLstNam *char 10 dcl &pqLstF *char 20 dcl &pPrcErr *char 4 dcl &pErrAct *char 10 dcl &LstF *char 10 dcl &LstFLib *char 10 dcl &PrcErr *char 4 dcl &ErrAct *char 10 dcl &PrcCmd *char 6000 dcl &PrcCmdLen *dec ( 5 0 ) dcl &Type *char 1 dcl &Reply *char 1 dcl &CStkCtr *char 4 dcl &CStkIDLen *char 4 dcl &RSNM0100 *char 29 dclf QAFDMBR /* */ /* Global message monitor... */ /* */ monmsg ( cpf0000 cpf9999 ) exec( goto Std_Err ) /* */ /* Copy parm values into local variables... */ /* */ chgvar &LstF %sst( &pqLstF 1 10 ) chgvar &LstFLib %sst( &pqLstF 11 10 ) if ( &LstF *eq '*DFT' ) + Qsys/rtvdtaara dtaara( VLDFTMBR ) rtnvar( &LstF ) chgvar &PrcCmdLen %bin( &pCmd 1 2 ) chgvar &PrcCmd %sst( &pCmd 3 &PrcCmdLen ) chgvar &PrcErr &pPrcErr chgvar &ErrAct &pErrAct Qsys/ovrdbf QAFDMBR tofile( &LstFLib/&LstF ) + mbr( &pLstNam ) Nxt_LstMbr: rcvf monmsg ( cpf0864 ) exec( goto End_LstMbr ) /* */ /* Search/replace any @@Fs... */ /* */ callprc RPLSST ( + &PrcCmd + &PrcCmdLen + '@@F ' + &MBFILE + ) /* */ /* Search/replace any @@Ms... */ /* */ callprc RPLSST ( + &PrcCmd + &PrcCmdLen + '@@M ' + &MBNAME + ) /* */ /* Search/replace any @@Ls... */ /* */ callprc RPLSST ( + &PrcCmd + &PrcCmdLen + '@@L ' + &MBLIB + ) /* */ /* Process the command for this list entry... */ /* */ PRCCMD CMD( &PrcCmd ) CMDLEN( &PrcCmdLen ) /* */ /* For prompted commands, was pressed? If so, does that */ /* mean we should cancel processing the remainder of the list? */ /* */ monmsg ( cpf6801 ) exec( do ) Qsys/rtvjoba type( &Type ) if ( &Type *eq '0' ) + chgvar &Reply 'Y' else + Qsys/sndusrmsg msgid( CPF9898 ) msgf( QCPFMSG ) + msgdta( + 'Cancel remaining list (Y/{N})?' + ) + values( Y N ) dft( N ) msgrpy( &Reply ) + trntbl( QSYSTRNTBL ) if ( &Reply *eq 'Y' ) + goto End_LstMbr enddo /* */ /* Errors will jump us to Std_Err unless we requested we said */ /* processing should continue... */ /* */ monmsg ( cpf0000 cpf9999 mch0000) exec( do ) if ( &PrcErr *eq '*NO' ) + goto Std_Err enddo goto Nxt_LstMbr End_LstMbr: Qsys/dltovr file( QAFDMBR ) return Std_Err: /* Move any *DIAG messages up the stack... */ Qsys/call pgm( QSYS/QMHMOVPM ) parm( + ' ' + '*DIAG ' + x'00000001' + '* ' + x'00000001' + x'00000000' + ) Qsys/monmsg ( CPF0000 MCH0000 ) /* Resend any *ESCAPE messages up the stack... */ chgvar %bin( &CStkCtr ) 2 Qsys/monmsg ( CPF0000 MCH0000 ) chgvar %bin( &CStkIDLen ) 1 Qsys/monmsg ( CPF0000 MCH0000 ) chgvar &RSNM0100 ( &CStkCtr *CAT + '*NONE *NONE ' *CAT + &CStkIDLen *CAT + '*' + ) Qsys/monmsg ( CPF0000 MCH0000 ) Qsys/call pgm( QSYS/QMHRSNEM ) parm( + ' ' + x'00000000' + &RSNM0100 + x'0000001D' + 'RSNM0100 ' + '* ' + x'00000000' + ) Qsys/monmsg ( CPF0000 MCH0000 ) return endpgm