Re: CPYF using INCREL parm in CL



I don't think there is a way around CPYF processing automatic string
termination 'feature'. Funny thing is that if you try it on the
command line with 'AA ' for &val keyword it'll work. One workaround
is to build your own string and submit it via QCMDEXC. Another is
OPNQRYF followed CPYFRMQRYF.
I tested option 1 using the via CALL T1 (F1 AA) and it seems to work.
Here is the source for T1 pgm:

pgm (&fld &val)
dcl &fld *char 10
dcl &val *char 5
dcl &cmd *char 200
dcl &cmdlen *dec (15 5) 200

chgvar &cmd ('CPYF FROMFILE(QTEMP/T1) TOFILE(QTEMP/T2) ' *cat +
'MBROPT(*ADD) CRTFILE(*YES) INCREL((*IF ' *cat +
&FLD *cat ' *EQ ''' *cat &VAL *cat ''')) ERRLVL(*NOMAX)')
call qcmdexc (&cmd &cmdlen)

endpgm

.