Sending data by using the REXX API

The Z Common Data Provider REXX API is a set of REstructured eXtended eXecutor (REXX) language functions that can be used to send data to the Data Streamer.

About this task

The sample REXX program HBORS001 in the hlq.SHBOSAMP library illustrates how to use the REXX API as described in the following procedure.

To send data, the API must have the port number on which the Data Streamer listens for data.

Procedure

To use the REXX API to send data to the Data Streamer, complete the following steps:

  1. In your REXX program, include the REXX procedures from the HBORDAPI sample program, which is in the hlq.SHBOSAMP library.
  2. Optional: If the Data Streamer is configured to bind to a specific IP address, specify the IP address of the Data Streamer in the variable hbo.host as shown in the following example. Because the Data Streamer and REXX application must be running on the same LPAR, the IP address must be a valid IP address on the LPAR where the REXX application runs.
    hbo.host = '9.30.243.157'
  3. As shown in the following example, define your metadata in a stem variable that is named Meta..
    This table must contain the metadata keywords and values that are described in Metadata keywords and values, with one value for each entry in keyword=value format.
    
    Meta.0 = 5
    Meta.1 = 'encoding=IBM1047'
    Meta.2 = 'path=APP/MyDataStream'
    Meta.3 = 'sourcename=MyDataStream'
    Meta.4 = 'sourcetype=zOS-MyDataStream'
    Meta.5 = 'timezone=+0000'
  4. As shown in the following example, define your data in a stem variable that is named Data.:
    
    Data.0 = 3
    Data.1 = 'Record 1'
    Data.2 = 'Record 2'
    Data.3 = 'Record 3'
  5. To send data to the Data Streamer, complete the following steps that apply, depending on whether you are sending data in a single transmission or multiple transmissions:
    Option Description
    Single transmission To connect to the Data Streamer, send the data, and disconnect from the Data Streamer, call HBO_Send_Data, as shown in the following example:
    
    Call HBO_Send_Data port, type, sender
    
    Multiple transmission If you have a long running program, you can open a connection to the Data Streamer before you call HBO_Send_Data so that the connection remains open, and you do not have to reconnect to send more data.
    1. Call HBO_Open, as shown in the following example:
      Call HBO_Open port
    2. Call HBO_Send_Data, as shown in the following example, which sends the data without connecting to, or disconnecting from, the Data Streamer:
      
      Call HBO_Send_Data port, type, sender
      
      Tip: In this call, the value for port is ignored because the connection to the Data Streamer is already open.
    3. When the program completes the sending of data, call HBO_Close to disconnect from the Data Streamer.
    Tip: If you make these calls from multiple, different REXX subroutines, ensure that any procedure statements expose the following variables:
    • HBO_Socket
    • hbo.
    • ecpref
    • ecname
    The following information describes the variables that are used in the calls:
    port
    The port number on which the local Data Streamer listens for data.
    type
    A value of 1 indicates unsplit data, and a value of 2 indicates split data.
    sender
    An eye catcher, with a maximum length of 8 characters, for identifying the origin of the data in traces and dumps.