Examples

Usage Example

  • Send the NetView command RES to the default receiver INGRCRCV. Wait up to 10 seconds, which is the default. Receive and display the command output.
    rc = INGRCRPC('RES',,,,’out.’)           
    if (rc=0) then
    do i=1 to out.0
       say out.i
    end
    
  • Send the command INGLIST to a different command receiver with PPI ID PPIQNAME, which will execute the command within the security context USERTASK. Wait up to 30 seconds for response.
    rc = INGRCRPC('INGLIST OUTMODE=LINE',,’PPIQNAME’,’USERTASK’,’out.’,30) 
    
     
  • Send MVS command D A,BDOW* to the default receiver INGRCRCV. Wait up to 30 seconds for response on the TSO side but stop MVS command execution until the first multi-line message was received.
    rc = INGRCRPC('MVS D A,BDOW*',,,,’out.’,30)

Programming Example

  • This example invokes the MYREXPGM command via RPC and displays the output.
    /*REXX*/
     context='AUTOTASK'  /*auto task security context*/
     context='USERTASK'  /*user task security context*/
     data.0=3 
     data.1='input line 1' 
     data.2='input line 2' 
     data.3='input line 3'
     command = 'MYREXPGM'             /*ANY NETV command */
     RC = INGRCRPC(command,,
                  'DATA.',,
                  'INGRCRCV',,        /*default command receiver*/  
                  ,,                  /*default task*/    
                  'RESP.',,
                  10,,
                  context)    
     SAY 'INGRCRPC RC='RC  
     if (rc=0) then  
     do i=1 to resp.0  
        say resp.i  
     end 
    EXIT                                             
    
  • The following self-written command MYREXPGM receives the input data and returns it as output data:
    /*REXX MYREXPGM*/
    SAY 'MYREXPGM STARTED'
       ADDRESS NETVASIS,
        'PIPE SAFE *',
        '| STEM SAFE.' 
    /*SAY may be used to return response data */
    SAY 'MYREXPGM SAFE.0='safe.0 
    do i=1 to safe.0 
      say 'OUTPUT('i'):' safe.i 
    end 
    SAY 'MYREXPGM ENDED'
    EXIT