Hi at all an thanks for accepted me in this forum.
I'm trying to manage open access handler on workstn files (dspf) on a program that execute only a EXFMT on it.
I've created a srvpgm with an external procedure that is called by the handler keyword.
Everything works fine until the control comes back to RPG from SRVPGM called by the EXFMT operation:
in that procedure the handler service program sets the inputbuffer to simulate input from the user, sets the function key pressed and then returns the control to RPG.
In that moment the RPG receives MCH1202 on the WORKSTN file (as I can see on debug), no inputbuffer comes back to RPG and got decimal data error.
I'm really crashing my head, I think that I'm missing something because even reading the DUMP spool I cant find the problem.
I really appreciate some help please, thanks
These are some part of code if this can help:
ON the RPG
// DSPF definition
DCL-F DSP066V WORKSTN INFDS(infdsDspf)
// INFDS definition
DCL-DS infDsDspf ;
ON the Handler Service Program
DCL-DS g_shared_IO LIKEDS(shared_IO) BASED(ptr_Shared_IO) ;
DCL-DS g_dspf_fld EXTNAME('DSP066V':'FMT06601':*INPUT) QUALIFIED
//-----------------------------------------------------------------------
DCL-PROC OASP_OATST01_$batch_exec EXPORT ;
WHEN io.rpgOperation = QrnOperation_CLOSE;
WHEN io.rpgOperation = QrnOperation_EXFMT;
OTHER ;
ENDSL; //__________________________________________________ ___________________
END-PROC;
//
//-----------------------------------------------------------------------
DCL-PROC exfmt_operation ;
ENDSL;
g_first_time = *OFF ; //__________________________________________________ ___________________
END-PROC;
//-----------------------------------------------------------------------
DCL-PROC set_inp_fields_to_output ;
//__________________________________________________ ___________________
END-PROC;
I'm trying to manage open access handler on workstn files (dspf) on a program that execute only a EXFMT on it.
I've created a srvpgm with an external procedure that is called by the handler keyword.
Everything works fine until the control comes back to RPG from SRVPGM called by the EXFMT operation:
in that procedure the handler service program sets the inputbuffer to simulate input from the user, sets the function key pressed and then returns the control to RPG.
In that moment the RPG receives MCH1202 on the WORKSTN file (as I can see on debug), no inputbuffer comes back to RPG and got decimal data error.
I'm really crashing my head, I think that I'm missing something because even reading the DUMP spool I cant find the problem.
I really appreciate some help please, thanks
These are some part of code if this can help:
ON the RPG
// DSPF definition
DCL-F DSP066V WORKSTN INFDS(infdsDspf)
HANDLER('BFZOASP(OASP_OATST01_$BATCH_EXEC)': shared_IO)
USROPN ALIAS;

// INFDS definition
DCL-DS infDsDspf ;
g0_wstOpen CHAR(1) POS(09) ;
g0_fKey CHAR(1) POS(369) ;
g0_wstPosCur BINDEC(4) POS(370) ;
END-DS;g0_fKey CHAR(1) POS(369) ;
g0_wstPosCur BINDEC(4) POS(370) ;
ON the Handler Service Program
DCL-DS g_shared_IO LIKEDS(shared_IO) BASED(ptr_Shared_IO) ;
DCL-DS g_dspf_fld EXTNAME('DSP066V':'FMT06601':*INPUT) QUALIFIED
BASED(ptr_inp_buffer) ;
END-DS;//-----------------------------------------------------------------------
DCL-PROC OASP_OATST01_$batch_exec EXPORT ;
DCL-PI OASP_OATST01_$batch_exec ;
io LIKEDS(QrnOpenAccess_T) ;
END-PI;
//__________________________________________________ ___________________
ptr_Shared_IO = io.userArea;
SELECT ;
WHEN io.rpgOperation = QrnOperation_OPEN;
//__________________________________________________ ___________________
ptr_Shared_IO = io.userArea;
SELECT ;
WHEN io.rpgOperation = QrnOperation_OPEN;
DF_log('OPEN del DSPF') ;
WHEN io.rpgOperation = QrnOperation_CLOSE;
DF_log('CLOSE del DSPF') ;
WHEN io.rpgOperation = QrnOperation_EXFMT;
DF_log('EXFMT del DSPF') ;
exfmt_operation(io) ;
OTHER ;
// Any other operation is unsupported so notify RPG
io.rpgStatus = 1299; // general error status
ENDSL;
END-PROC;
//
//-----------------------------------------------------------------------
DCL-PROC exfmt_operation ;
DCL-PI exfmt_operation ;
io LIKEDS(QrnOpenAccess_T) ;
END-PI;
DCL-S l_indicators IND DIM(99) BASED(l_ptr_indicators) ;
DCL-S l_ptr_indicators POINTER INZ ;
//__________________________________________________ ___________________
SELECT ;
WHEN g_shared_IO.i_opzione = F6 ;
IF g_first_time=*ON ;
DCL-S l_indicators IND DIM(99) BASED(l_ptr_indicators) ;
DCL-S l_ptr_indicators POINTER INZ ;
//__________________________________________________ ___________________
SELECT ;
WHEN g_shared_IO.i_opzione = F6 ;
IF g_first_time=*ON ;
set_inp_fields_to_output(io) ; // Forza i campi a video
io.functionKey = QrnFunctionKey_09 ; // FORZA F9 PREMUTO
ELSE;
// Altrimenti vuol dire che c'è stato un errore
io.functionKey = QrnFunctionKey_03 ; // quindi FORZA F3
l_ptr_indicators = io.indara ; // restituisce gli indicatori in output
g_shared_io.o_indicators = l_indicators ;
ENDIF;
io.functionKey = QrnFunctionKey_09 ; // FORZA F9 PREMUTO
ELSE;
// Altrimenti vuol dire che c'è stato un errore
io.functionKey = QrnFunctionKey_03 ; // quindi FORZA F3
l_ptr_indicators = io.indara ; // restituisce gli indicatori in output
g_shared_io.o_indicators = l_indicators ;
ENDIF;
ENDSL;
g_first_time = *OFF ;
END-PROC;
//-----------------------------------------------------------------------
DCL-PROC set_inp_fields_to_output ;
DCL-PI set_inp_fields_to_output ;
io LIKEDS(QrnOpenAccess_T) ;
END-PI;
DCL-S l_value VARCHAR(32740) BASED(l_ptr_value) ;
DCL-S l_ptr_value POINTER INZ ;
// DS di stato Display file
DCL-DS l_infDsDspf QUALIFIED INZ;
DCL-S l_value VARCHAR(32740) BASED(l_ptr_value) ;
DCL-S l_ptr_value POINTER INZ ;
// DS di stato Display file
DCL-DS l_infDsDspf QUALIFIED INZ;
g0_wstOpen CHAR(1) POS(09) INZ('1');
g0_fKey CHAR(1) POS(369) ;
g0_wstPosCur BINDEC(4) POS(370) INZ(5120);
g0_fKey CHAR(1) POS(369) ;
g0_wstPosCur BINDEC(4) POS(370) INZ(5120);
END-DS;
//__________________________________________________ ___________________
ptr_inp_buffer = io.inputBuffer;
g_dspf_fld.vtipo = g_shared_io.i_buffer.cgtipo ;
g_dspf_fld.vstato = 'X';
l_infdsdspf.g0_fkey = F9 ;
io.deviceFeedback = %ADDR(l_infDsDspf) ;
io.deviceFeedbackLen = %LEN(l_infDsDspf) ;
io.ioFeedback = %ADDR(l_infDsDspf) ;
io.ioFeedbackLen = %LEN(l_infDsDspf) ;
io.openFeedback = %ADDR(l_infDsDspf) ;
io.openFeedbackLen = %LEN(l_infDsDspf) ;
io.inputBuffer = %ADDR(g_dspf_fld) ;
io.inputBufferlEN = %LEN(g_dspf_fld) ;
//__________________________________________________ ___________________
ptr_inp_buffer = io.inputBuffer;
g_dspf_fld.vtipo = g_shared_io.i_buffer.cgtipo ;
g_dspf_fld.vstato = 'X';
l_infdsdspf.g0_fkey = F9 ;
io.deviceFeedback = %ADDR(l_infDsDspf) ;
io.deviceFeedbackLen = %LEN(l_infDsDspf) ;
io.ioFeedback = %ADDR(l_infDsDspf) ;
io.ioFeedbackLen = %LEN(l_infDsDspf) ;
io.openFeedback = %ADDR(l_infDsDspf) ;
io.openFeedbackLen = %LEN(l_infDsDspf) ;
io.inputBuffer = %ADDR(g_dspf_fld) ;
io.inputBufferlEN = %LEN(g_dspf_fld) ;
//__________________________________________________ ___________________
END-PROC;




Comment