RXS_PutStdOut()

This subprocedure is used to output (to standard out) data. Typically, this would be used in a scenario where you are providing a webservice, and would be used to output XML retrieved via RXS_GetComposeBuffer().

Subprocedure Prototype

D RXS_PutStdOut...
D                 PR                  Extproc('RXS_PutStdOut')
 
D   Input                             Like(RXS_Var16Mv_t)
D                                     Options(*Varsize) Const

Data to be written to "standard out", i.e. to a web browser or to a web service which initiated the incoming request as a client.

D   pDS                               Like(RXS_Var64K_t)
D                                     Options(*Varsize:*Nopass)

Optional RXS_PutStdOutDS_t to allow for CCSID conversion during output.

Example Code

*--------------------------------------------------------------
* This example code writes the content of the field gXml to STDOUT.
*--------------------------------------------------------------
H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER)

 /copy QRPGLECPY,RXSCB

D gXML            S                   Like(RXS_Var1Kv_t)
 /free
  gXml = '<element>Example XML</element>';
  RXS_PutStdOut( gXml );

  *INLR = *ON;
 /end-free
*--------------------------------------------------------------
* This example code specifies the header content type as XML,
*  then sends the data to STDOUT.
*--------------------------------------------------------------
H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER)

 /copy QRPGLECPY,RXSCB

D putStdOutDS     DS                  LikeDS(RXS_PutStdOutDS_t)

D gXML            S                   Like(RXS_Var1Kv_t)
 /free
  RXS_ResetDS( PutStdOutDS : RXS_DS_TYPE_PUTSTDOUT ); 

  gXml = '<element>Example XML</element>';
  
  PutStdOutDS.HeaderContentType = 'text/xml';
  RXS_PutStdOut( gXml : PutStdOutDS );

  *INLR = *ON;
 /end-free
*--------------------------------------------------------------
* This example code specifies the header content type as XML, and
*  specifies the IFS file from which data will be read to STDOUT.
*--------------------------------------------------------------
H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER)

 /copy QRPGLECPY,RXSCB

D putStdOutDS     DS                  LikeDS(RXS_PutStdOutDS_t)
 /free
  RXS_ResetDS( PutStdOutDS : RXS_DS_TYPE_PUTSTDOUT ); 
  PutStdOutDS.HeaderContentType = 'text/xml';
  PutStdOutDS.Stmf = '/tmp/over16mb.xml';
  RXS_PutStdOut( *Omit : PutStdOutDS );

  *INLR = *ON;
 /end-free
*--------------------------------------------------------------
* This example code specifies the header content type as XML, and 
*  sets a header status code and text to communicate an HTTP error,
*  then sends the XML to STDOUT.
*--------------------------------------------------------------
H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER)

 /copy QRPGLECPY,RXSCB

D putStdOutDS     DS                  LikeDS(RXS_PutStdOutDS_t)

D gXML            S                   Like(RXS_Var1Kv_t)
 /free
  RXS_ResetDS( PutStdOutDS : RXS_DS_TYPE_PUTSTDOUT );

  gXml = '<element>Example XML</element>';
  
  PutStdOutDS.HeaderStatusCode = 500;
  PutStdOutDS.HeaderStatusText = 'SOAP Fault'; 
  PutStdOutDS.HeaderContentType = 'text/xml';
  RXS_PutStdOut( gXml : PutStdOutDS );

  *INLR = *ON;
 /end-free
*--------------------------------------------------------------
* This example code specifies the header content type as XML, and 
*  sets a sets a custom header "Prefer", then sends the XML to STDOUT.
*--------------------------------------------------------------
H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER)

 /copy QRPGLECPY,RXSCB

D putStdOutDS     DS                  LikeDS(RXS_PutStdOutDS_t)

D gXML            S                   Like(RXS_Var1Kv_t)
 /free
  RXS_ResetDS( PutStdOutDS : RXS_DS_TYPE_PUTSTDOUT );

  gXml = '<element>Example XML</element>';
  
  PutStdOutDS.HeaderContentType = 'text/xml';
  PutStdOutDS.CustomHeaderName(1) = 'Prefer'; 
  PutStdOutDS.CustomHeaderValue(1) = 'Return=representation';
  RXS_PutStdOut( gXml : PutStdOutDS );

  *INLR = *ON;
 /end-free

Data Structures

D RXS_PutStdOutDS_t...
D                 DS                  Qualified Template Inz
 
D   ReturnedErrorInfo...
D                                     LikeDS(RXS_ReturnedErrorInfoDS_t) Inz
 
D   DataStructureType...
D                                5I 0 Inz(RXS_DS_TYPE_PUTSTDOUT)
 
D   OnErrorMessageType...
D                                5I 0
 
D   Stmf                              Like(RXS_Var1Kv_t)

Specifies IFS path to a stream file whose contents are to be sent to STDOUT.

D   Ccsid                       10I 0

The contents of the Input parameter are converted from the job CCSID to this CCSID before being sent to standard out.

D   HeaderStatusCode...
D                               10I 0

The HTTP Status code to be sent in the response. A sucessful reponse is typically "200".

D   HeaderStatusText...
D                                     Like(RXS_Var1Kv_t)

The HTTP Status text to be sent in the response. This is also known as the reason phrase. A sucessful reponse is typically "OK".

D   HeaderContentType...
D                                     Like(RXS_Var1Kv_t)

The HTTP content type to be sent with the response. The most common content type for web services is "text/xml". There is no assumed default value and if this value is not supplied via this data structure, then the content type is usually required to be supplied in the Input parameter and it must be followed by two line control characters.

D   CustomHeaderName...
D                               64A   Varying Dim(50)

Specifies the name of up to 50 custom HTTP headers sent with the response.

D   CustomHeaderValue...
D                                     Like(RXS_Var1Kv_t) Dim(50)

Specifies the value of up to 50 corresponding CustomHeaderName's.