RXS_GetUrlVar()

This subprocedure is used to retrieve variables from the URL that was used to call the current program as a web service.

Variables on a URL are specified in name-value pairs. For example:

http://mysite.com/rxs/mywebservice?customer=1&code=3

In this example, there are two variables: customer and code, and each of them has a value of 1 and 3 respectively.

Note: This API is only meant to be used in a program acting as a webservice. Using it in other programs will throw errors.

Subprocedure Prototype

D RXS_GetUrlVar...
D                 PR                  Extproc('RXS_GetUrlVar') Opdesc
D                                     Like(RXS_Var16Mv_t)
D                                     Rtnparm

Returns the data retrieved from the URL variable.

D   UrlVar                     300A   Value

Specify the name of the URL variable which is to be retrieved.

D RXS_GetUrlVar...
D                 PR                  Extproc('RXS_GetUrlVar') Opdesc
 
D   Output                            Like(RXS_Var16Mv_t)
D                                     Options(*Varsize)

Holds the data retrieved from the URL variable.

D   UrlVar                     300A   Value

Specify the name of the URL variable to retrieve the value of.

Example Code

*--------------------------------------------------------------
* This example code retrieves variable values from the URL that 
* was used to call this program.
* For example, if this program were called with the following URL:
* http://mysite.com/rxs/mywebservice?customer=1&code=3
* The output in the job log would be:
* Customer: 1
* Code: 3
*--------------------------------------------------------------
H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER)

 /define RXSV6R1
 /copy QRPGLECPY,RXSCB

D VarCustomer     S                   Like(RXS_Var1Kv_t)
D VarCode         S                   Like(RXS_Var1Kv_t)

 /free

  VarCustomer = RXS_GetUrlVar( 'customer' );

  VarCode = RXS_GetUrlVar( 'code' );

  RXS_JobLog( 'Customer: %s' : VarCustomer );
  RXS_JobLog( 'Code: %s' : VarCode );

  *INLR = *ON;
 /end-free
*--------------------------------------------------------------
* This example code retrieves variable values from the URL that 
* was used to call this program.
* For example, if this program were called with the following URL:
* http://mysite.com/rxs/mywebservice?customer=1&code=3
* The output in the job log would be:
* Customer: 1
* Code: 3
*--------------------------------------------------------------
H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER)

 /define RXSV6R1
 /copy QRPGLECPY,RXSCB

D VarCustomer     S                   Like(RXS_Var1Kv_t)
D VarCode         S                   Like(RXS_Var1Kv_t)

 /free

  RXS_GetUrlVar( VarCustomer : 'customer' );

  RXS_GetUrlVar( VarCode : 'code' );

  RXS_JobLog( 'Customer: %s' : VarCustomer );
  RXS_JobLog( 'Code: %s' : VarCode );

  *INLR = *ON;
 /end-free