The only way to return values from a submit remote command call is to issue an escape message from the CL or RPG program that is called. The following CL program returns an escape message, and the VB code sample works with a Corecode-generated VB module. 
 

Sample CL Program to Return an Escape Message

************** Beginning of data ****************************
PGM                                                       
DCL        VAR(&MSG) TYPE(*CHAR) LEN(256)                 
CHGVAR     VAR(&MSG) +                                    
          VALUE(1234567890123456789012345679801234567+ 
          8901234567890123456789012345678901234567890+ 
          1324567980Z)                                 

                                                      
SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&MSG)      
ENDPGM                                                    
***************** End of data *******************************
 

Sample VB Program for Accessing and Displaying Information from a Submit Remote Command Call

Private Sub Form_Load()

Dim RTN
Dim rtncpfmsg As String * 7
Dim rtncpftext As String * 256

RTN = CDDAINIT()

RTN = CDDASBMRMTCMD("QCUSTCDT", "CALL PGM(RJSASP400/ESCMSGC)", rtncpfmsg, rtncpftext)

MsgBox "CPF Message: " + rtncpfmsg + vbCrLf + _
 "CPF Text: " + rtncpftext

RTN = CDDAQUIT()

End Sub

Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: December 10, 2016