# RXS_ComposeVariable() This searches the currently loaded template for the specified Variable, and replaces it with the Value parameter. If variable is used multiple times, all occurrences will be replaced. **Note**: This procedure will throw an error if it has been called without the composition engine being initialized via [RXS_StartComposeEngine()](https://isupport.katointegrations.com/rxs/3.1/rxs_startcomposeengine.md). ## Subprocedure Prototype ### IBM i 6.1+ | Field | Description | |---|---| | ` D RXS_ComposeVariable... D PR Extproc('RXS_ComposeVariable')` | | | ` D Variable 30A Varying` | The name of the variable to be replaced in the currently loaded template. | | ` D Value Const Like(RXS_Var16Mv_t)` | The value which will replace the specified Variable. | ## Example Code ### IBM i 6.1+ #### Example 1 ```rpgle *-------------------------------------------------------------- * This example demonstrates calling RXS_ComposeVariable() to assign the * value of the gFahrenheit field to the template variable 'fahrenheit'. * This variable would be defined in the XML template EXAMPLE like so: * .:fahrenheit:. *-------------------------------------------------------------- H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER) /copy QRPGLECPY,RXSCB /copy QRPGLETPL,EXAMPLE D gFahrenheit S 3P 1 /free gFahrenheit = 78.6; RXS_ComposeVariable( fahrenheit : %Char(gFahrenheit) ); *INLR = *ON; /end-free ```