Return to the RPG Tips
Override printer file in RPG IV
Technique 1 H BndDir('QC2LE') DftActGrp(*NO) FPRINTFILE O E Printer UsrOpn * prototyped call to execute a system command D System PR 10i 0 ExtProc('system') D Cmd * Value Options(*string) D ErrorFlag S 10i 0 C If NOT %open(PRINTFILE) C Eval ErrorFlag = System('OVRPRTF FILE(PRINTFILE) + C PAGESIZE(' + %char(LENGSR) + ' 80)+ C OVRFLW(' + %char(OVFLNZ) + ') LPI(6) + C CPI(10) FORMTYPE(whatever)') C Open PRINTFILE C EndIF NOT %open(PRINTFILE) Technique 2 I do similar QCMDEXC PR calls. d Qcmdexc pr Extpgm('QCMDEXC') d Cmd Like(Qcmd) Options(*Varsize) Const d CmdLen 15p 5 Const d CmdOpt 3 Options(*NoPass) Const d Qcmd s 3000 d OvrPrtf c 'OVRPRTF FILE(QSYSPRT) PAGESIZE(*N 1- d 98) CPI(15) MAXRCDS(*NOMAX) OVRSCOPE- d (*JOB) SHARE(*YES)' c Eval Qcmd = OvrPrtf c CallP Qcmdexc(Qcmd : %Len(%Trim(Qcmd))) c If Not %Open(Qsysprt) c Open Qsysprt c EndIf c Close Qsysprt c Eval Qcmd = 'DLTOVR FILE(QSYSPRT) LVL(*JOB)' c CallP Qcmdexc(Qcmd : %Len(%Trim(Qcmd)))
[report a broken link by clicking here]