RXS_charToBln()

Use RXS_charToBln() to easily convert a character Boolean value (i.e. true/false, t/f, on/off/, 1/0) to an RPG Boolean. This will save the headache of programming for all of the different Boolean formats out there. Note that according to the XML specification that the valid Boolean values are true and false.

If the value in pValFrmXml matches the value in pTrueVal then *on will be returned. If the value in pValFrmXml matches the value in pFalseVal then *off will be returned. If the value in pValFrmXml doesn’t match either pTrueVal or pFalseVal then the value specified in pDftVal will be returned.

Typical usage would look like:

myBlnVar = RXS_charToBln(strBln: ‘true’: ‘false’: *off);

Subprocedure Prototype

D RXS_charToBln   pr              n

Returns *On if the value being tested is considered true, *Off if it is considered false.

D  pValFrmXml                   10a   value

Required

The string value parsed from an XML document. Letters will be converted to lowercase before processing.

Example: true,False,T,f,1,0

D  pTrueVal                     10a   value

Required

The value which, if passed in pValFrmXml, would represent a true Boolean condition. Must be lowercase.

Example: t,1

D  pFalseVal                    10a   value

Required

The value which, if passed in pValFrmXml, would represent a false Boolean condition. Must be lowercase.

Example: f,false

D  pDftVal                        n   value

Required

Default, fallback value which will be returned if the character data in pValFrmXml does not match either of the specified true or false values.