Build Parsing Subprocedure (BLDPRS)

The BLDPRS command is used to aid in writing RPG API Express XML or JSON parsing code to be used with the RXS_Parse() and RXS_ParseJson() subprocedures. These APIs rely on a “handler” subprocedure which captures various XML or JSON parsing events, and gives you access to the data in the document being parsed.

When provided with a sample XML or JSON file in the IFS, BLDPRS can generate a handler subprocedure for that document. It can generate in either mixed-format (fixed D-specs) or free-format (column limited) RPG. Once generated, this parsing handler can be copied into your program code.

Note: You will need to make manual modifications to the generated parsing handler in addition to importing it into your program. The generated code does not include any data handling logic.

Parameters

XML or JSON Stream File (SRCSTMF)

This is a required parameter.

Specify the path name of the XML or JSON stream file that will be processed to generate the parsing handler subprocedure.

Possible Values:

character-value
IFS path to XML or JSON file that will be read to generate the parsing handler subprocedure.

Output Source File (OUTFILE)

This is a required parameter if the parsing handler subprocedure is being generated in a source member.

Specify the source physical file (and optionally the library) for the output source member. The specified source physical file must exist, and the user profile must have authority to the object.

Possible Values:

character-value
Physical file name in which the source member exists, or will be created.

Qualifier Values:

*LIBL
The library list for the job will be used to located the file. This is the default value.
character-value
Specify the library name where the file is located.

Output Member Name (OUTMBR)

This is a required parameter if the parsing handler subprocedure is being generated in a source member.

Specify the name of the source member to which the generated code will be written. This source member will be created if it does not already exist. If it does exist, the generated parsing handler subprocedure will be appended to any content that is already present in the member. This behavior can be controlled with APPENDOUT.

Possible Values:

character-value
Source member that either exists or will be created.

Output Stream File (OUTSTMF)

This is a required parameter when the generated code is to be written to a stream file in the IFS.

Specify the fully-qualified file path to the output stream file in the IFS. If this file does not exist, it will be created. If the file exists, the generated parsing handler subprocedure will be appended to any content that is already present in the file. This behavior can be controlled with APPENDOUT.

The user profile must have write authority to the file.

Possible Values:

character-value
IFS path to the file where the parsing handler code will be written.

Append Output (APPENDOUT)

This is a required parameter.

Specifies whether the generated parsing handler subprocedure should be appended to the existing contents of the output source member or file, or if the generated code should overwrite any existing content.

Possible Values:

*YES
The generated parsing handler subprocedure will append to any existing content in the output source member or file. This is the default value.
*NO
The contents of the output source member or file will be overwritten by the generated parsing handler subprocedure.

Output RPG Code Format (CODEFORMAT)

This is a required parameter.

Specify the RPG coding format of the generated parsing handler subprocedure.

Possible Values:

*FREE
Generate full-free (columns 8-80) RPG code. This is the default value.
*MIXED
Generate mixed format (fixed D-specs, free C-specs) RPG code.

Parsing Handler Type (PARSETYPE)

This is a required parameter.

Specify the type of parsing handler subprocedure to generate.

Possible Values:

*RXS2XML
Generate an XML parsing handler subprocedure for use with the RXS 2 XML parsing API, RXS_parse().
*RXS3XML
Generate an XML parsing handler subprocedure for use with the RXS 3 XML parsing API, RXS_Parse().
*JSON
Generate a JSON parsing handler subprocedure for use with the RXS 3 JSON parsing API, RXS_ParseJson().

Base XPath/Envelope (BASEENV)

This is an optional parameter, and is only used with XML parsers.

Specify the base XPath (ie. SOAP envelope) that should be used within the parsing handler. The path should not end in XML element characters (<>). This XPath segment will be defined as a constant within the parsing handler subprocedure that is concatenated onto the XPaths used in the select block where applicable.

Possible Values:

character-value
XPath to be used as the base envelope.

XML Content Event Parsing (XMLCONTENT)

This is a required parameter if an XML parsing handler subprocedure is being generated.

Specify if the XML parsing handler subprocedure should be generated with content parsing events.

XML content events are triggered when an XML element contains data, and have XPaths that end in ‘/’. For example, the XPath Request/Item/ would retrieve the contents of the <Item> element.

Possible Values:

*YES
The parsing handler subprocedure will be generated with content parsing events. This is the default value.
*NO
Content parsing events will not be generated.

XML Begin Elem. Event Parsing (XMLBEGIN)

This is a required parameter if an XML parsing handler subprocedure is being generated.

Specify if the XML parsing handler subprocedure should be generated with begin element parsing events.

XML begin element events are triggered by the opening tag of an XML element, and have XPaths that end in ‘>’. For example, the XPath Request/Item> would be triggered by the opening tag of the <Item> element. These events are typically used to initialize record processing and reset working fields.

Possible Values:

*YES
The parsing handler subprocedure will be generated with begin element parsing events. This is the default value.
*NO
Begin element parsing events will not be generated.

XML End Elem. Event Parsing (XMLEND)

This is a required parameter if an XML parsing handler subprocedure is being generated.

Specify if the XML parsing handler subprocedure should be generated with end element parsing events.

XML end element events are triggered by the closing tag of an XML element, and have XPaths that end in ‘/>’. For example, the XPath Request/Item/> would be triggered by the closing tag of the <Item> element, </Item>. These events are typically used to finalize data processing and write records to physical files.

Possible Values:

*YES
The parsing handler subprocedure will be generated with end element parsing events. This is the default value.
*NO
End element parsing events will not be generated.

XML Attribute Event Parsing (XMLATTR)

This is a required parameter if an XML parsing handler subprocedure is being generated.

Specify if the XML parsing handler subprocedure should be generated with attribute parsing events.

XML attribute events are triggered by the presence of an attribute in an XML element tag. XPaths for attribute events list the XML element, followed by an ‘@’ symbol and the name of the attribute. For example, the XPath Request/Item@Id would be triggered by the attribute ‘Id’ on the <Item Id="12345"> element.

Possible Values:

*YES
The parsing handler subprocedure will be generated with attribute parsing events. This is the default value.
*NO
Attribute parsing events will not be generated.