RPG - CPF4103 Device *REQUESTER not found

By kimot, 25 December, 2022

If you want to submit program with defined dislay file (dcl-f ...... workstn) in QBATCH.
And if this program doesn't need to use display file. (something like program have two modes interactive/batch)
You have to implement some changes into program design to avoid message  CPF4103 Device *REQUESTER not found ... 

At first - display file definition must have USROPN option ( display file isn't opened when program starts):

dcl-f display_file workstn indds(Dspf) sfile(SUBFILE:Z1RRN) USROPN ; 

And then separate code for interactive/batch mode and OPEN display file at first.
for example :

 if Mode = 'SCREEN' ;      
   OPEN display_file ;       
   Z1RRN = 0 ;             
   Dspf.SflDspCtl = *off ; 
   Dspf.SflDsp = *off ;    
   write SUBFCTL ;         
 endif ;