<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Response Procedures :: Aperio Documentation</title><link>/rpg/response/index.html</link><description>Chapter 6.2 RPG Response Procedures This chapter describes procedures used to build outgoing repsonse string.</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 01 Jan 0001 00:00:00 +0000</lastBuildDate><atom:link href="/rpg/response/index.xml" rel="self" type="application/rss+xml"/><item><title>respAdd3StateField()</title><link>/rpg/response/respadd3statefield/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respadd3statefield/index.html</guid><description>This procedure adds 3-State field into response. Procedure converts input 3-State value (text) into JSON true/false/null values then store it as field value. The input value is converted using several converson patterns.
Parameter Type Description element 30A VARYING, VARSIZE Mandatory Name of element fieldName 30A VARYING, VARSIZE Mandatory Field name value 10A Mandatory Input 3-state value (text) pattern 10I 0 Optional conversion pattern Following input boolean values are supported:</description></item><item><title>respAdd3StateValue()</title><link>/rpg/response/respadd3statevalue/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respadd3statevalue/index.html</guid><description>This procedure adds 3-State value for existing field. Procedure converts input 3-State value (text) into JSON true/false/null values then store it as field value. The input value is converted using several converson patterns.
Parameter Type Description ptr POINTER Mandatory Pointer to field Value 10A Mandatory Input 3-State value (text) pattern 10I 0 Optional conversion pattern Following input boolean values are supported:
’true' ‘false’ ’null' ‘Y’ ‘N’ *BLANK ‘1’ ‘0’ Following conversion patterns are sypported:</description></item><item><title>respAddBlobField()</title><link>/rpg/response/respaddblobfield/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddblobfield/index.html</guid><description>This procedure adds Blob field. The blob value is proviced as pair pointer andlength in bytes. NOTE: The blob value is added as text value to JSON.
Parameter Type Description element 30A VARYING, VARSIZE Mandatory Name of element fieldName 30A VARYING, VARSIZE Mandatory Field name valuePtr POINTER Mandatory Pointer to Blob value valueLen 10U 0 Mandatory Length of Blob value The procedure returns pointer of field. If procedure can’t add value, then returns null.</description></item><item><title>respAddBlobValue()</title><link>/rpg/response/respaddblobvalue/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddblobvalue/index.html</guid><description>This procedure adds Blob value for existing field. The blob value is proviced as pair pointer andlength in bytes. NOTE: The blob value is added as text value to JSON.
Parameter Type Description ptr POINTER Mandatory Pointer to field valuePtr POINTER Mandatory Pointer to Blob value valueLen 10U 0 Mandatory Length of Blob value The procedure returns pointer of field. If procedure can’t add value, then returns null.
Examples:</description></item><item><title>respAddBooleanField()</title><link>/rpg/response/respaddbooleanfield/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddbooleanfield/index.html</guid><description>This procedure adds Boolean field into response. Procedure converts input boolean value (text) into JSON true/false values then store it as field value. The input value is converted using several converson patterns.
Parameter Type Description element 30A VARYING, VARSIZE Mandatory Name of element fieldName 30A VARYING, VARSIZE Mandatory Field name bValue 10A Mandatory Input boolean value (text) pattern 10I 0 Optional conversion pattern Following input boolean values are supported:</description></item><item><title>respAddBooleanValue()</title><link>/rpg/response/respaddbooleanvalue/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddbooleanvalue/index.html</guid><description>This procedure adds Boolean value for existing field. Procedure converts input boolean value (text) into JSON true/false values then store it as field value. The input value is converted using several converson patterns.
Parameter Type Description ptr POINTER Mandatory Pointer to field bValue 10A Mandatory Input boolean value (text) pattern 10I 0 Optional conversion pattern Following input boolean values are supported:
’true' ‘false’ ‘Y’ ‘N’ ‘1’ ‘0’ Following conversion patterns are sypported:</description></item><item><title>respAddDateField()</title><link>/rpg/response/respadddatefield/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respadddatefield/index.html</guid><description>This procedure adds Date field into response. The date is converted from numeric format YYYYMMDD to ISO standard format YYYY-MM-DD. Additionally it is possible to pass date and time and time zone in one go. Then the response value is ISO format: YYYY-MM-DDTHH:MM:SS+HH:MM
Parameter Type Description element 30A VARYING, VARSIZE Mandatory Name of element fieldName 30A VARYING, VARSIZE Mandatory Field name date 8P 0 Mandatory Numeric data velue in format YYYYMMDD time 6P 0 Optional Numeric time value in format HH or HHMM or HHMMSS timeZone 5P 0 Optional Numeric time shift in minutes The procedure returns pointer of field. If procedure can’t add field, then returns null.</description></item><item><title>respAddDateValue()</title><link>/rpg/response/respadddatevalue/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respadddatevalue/index.html</guid><description>TThis procedure adds Date value for existing field. The date is converted from numeric format YYYYMMDD to ISO standard format YYYY-MM-DD. Additionally it is possible to pass date and time and time zone in one go. Then the response value is ISO format: YYYY-MM-DDTHH:MM:SS+HH:MM
Parameter Type Description ptr POINTER Mandatory Pointer to field date 8P 0 Mandatory Numeric data velue in format YYYYMMDD time 6P 0 Optional Numeric time value in format HH or HHMM or HHMMSS timeZone 5P 0 Optional Numeric time shift in minutes The procedure returns pointer of field. If procedure can’t add field, then returns null.</description></item><item><title>respAddError()</title><link>/rpg/response/respadderror/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respadderror/index.html</guid><description>This procedure adds error message to response.
Parameter Type Description code 9B 0 Mandatory Error code message 1024A VARSIZE Optional Additional message text Following codes are supported:
code Description API_PARSE_ERR Parse error API_INVREQ_ERR Invalid request API_METHOD_ERR Method not found API_PARAMS_ERR Invalid params API_INTERNAL_ERR Internal error API_SECURITY_ERR Security error API_SERVER_ERR Server error API_APPLICATION_ERR Application error API_INDEX_ERR Index out of bounds API_NO_RECORDS_ERR No records found Examples:
respAddError(API_PARAMS_ERR); respAddError(API_PARAMS_ERR: 'Additional message');</description></item><item><title>respAddField()</title><link>/rpg/response/respaddfield/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddfield/index.html</guid><description>This procedure adds field into memory. The field is added into element passed as pointer.
Parameter Type Description element_ptr POINTER Mandatory Pointer to element fieldName 30A VARYING, VARSIZE Mandatory Name of field structure 10A VARYING, VARSIZE Optional Structure of element (“array” or “object”) if no provided then “object” is default The procedure returns pointer for newly added field. If procedure can’t add field, then returns null.
Examples:
e_ptr = respAddElement('data'); f_ptr = respAddField(e_ptr: 'warehouse'); e_ptr = respAddElement('data'); f_ptr = respAddField(e_ptr: 'listOfWarehouses': 'array');</description></item><item><title>respAddJsonField()</title><link>/rpg/response/respaddjsonfield/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddjsonfield/index.html</guid><description>This procedure adds JSON String field into response.
Parameter Type Description element 30A VARYING, VARSIZE Mandatory Name of element fieldName 30A VARYING, VARSIZE Mandatory Field name json_ptr POINTER Mandatory Pointer to JSON String, NOTE: String must be in UCS2 json_len 10U 0 Mandatory Length in butes of JSON String The procedure returns pointer of field. If procedure can’t add field, then returns null.
Examples:
respAddJsonField('data': 'jsonData': %ADDR(xxJsonData): %LEN(xxJsonData)*2 );</description></item><item><title>respAddJsonValue()</title><link>/rpg/response/respaddjsonvalue/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddjsonvalue/index.html</guid><description>This procedure adds JSON value for existing field.
Parameter Type Description ptr POINTER Mandatory Pointer to field json_ptr POINTER Mandatory Pointer to JSON String in UCS2 json_len 10U 0 Mandatory Length in bytes of JSON String The procedure returns pointer of field. If procedure can’t add value, then returns null.
Examples:
xxPtr = respAddField('data': 'jsonData'); respAddJsonValue(xxPtr: %ADDR(xxJsonData): %LEN(xxJsonData)*2 );</description></item><item><title>respAddMessage()</title><link>/rpg/response/respaddmessage/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddmessage/index.html</guid><description>This procedure adds message to response.
Parameter Type Description msgType 10A Mandatory Type of message messageId 30A VARYING, VARSIZE Mandatory Message Id messageKey 30A VARYING, VARSIZE Mandatory Message key. For example field name or any other element which connects message with application messageText1 1024A VARYING, VARSIZE Mandatory Message text messageText2 1024A VARYING, VARSIZE Optional Additional message text Following message types are supported:
Type Description ERROR Error message WARNING Warning message. This message needs to be confirmed by user INFO Informational message. This message do not need to be confirmed nu user Examples:</description></item><item><title>respAddNullField()</title><link>/rpg/response/respaddnullfield/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddnullfield/index.html</guid><description>This procedure adds Null field into response.
Parameter Type Description element 30A VARYING, VARSIZE Mandatory Name of element fieldName 30A VARYING, VARSIZE Mandatory Field name The procedure returns pointer of field. If procedure can’t add field, then returns null.
NOTE: User do not need to provide any value. Procedure automatically adds null to JSON.`
Examples:
respAddNullField('data': 'freeOfCharge');</description></item><item><title>respAddNullValue()</title><link>/rpg/response/respaddnullvalue/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddnullvalue/index.html</guid><description>This procedure adds Null value for existing field.
Parameter Type Description ptr POINTER Mandatory Pointer to field The procedure returns pointer of field. If procedure can’t add value, then returns null.
NOTE: User do not need to provide any value. Procedure automatically adds null to JSON.`
Examples:
xxPtr = respAddField('data': 'contact'); respAddNullValue(xxPtr);</description></item><item><title>respAddNumericField()</title><link>/rpg/response/respaddnumericfield/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddnumericfield/index.html</guid><description>This procedure adds Numeric field into response.
Parameter Type Description element 30A VARYING, VARSIZE Mandatory Name of element fieldName 30A VARYING, VARSIZE Mandatory Field name value 30P 9 Mandatory Numeric value The procedure returns pointer of field. If procedure can’t add field, then returns null.
NOTE: Numeric values must be rounded to reqired number of decimals prior to add value to response. `
NOTE: Integer numbers are handled by JSON but only until 15 digits. If number is higher than 15 digits then most of JSON parser dumps. In RPG we can have up to 20 digits per integer number. Such big numbers must be then pack to JSON as string. See respAddNumValueAsString()`</description></item><item><title>respAddNumericValue()</title><link>/rpg/response/respaddnumericvalue/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddnumericvalue/index.html</guid><description>This procedure adds Numeric value for existing field.
Parameter Type Description ptr POINTER Mandatory Pointer to field numericValue 30P 9 Mandatory Numeric value The procedure returns pointer of field. If procedure can’t add value, then returns null.
NOTE: Numeric values must be rounded to reqired number of decimals prior to add value to response. `
NOTE: Integer numbers are handled by JSON but only until 15 digits. If number is higher than 15 digits then most of JSON parser dumps. In RPG we can have up to 20 digits per integer number. Such big numbers must be then pack to JSON as string. See respAddNumValueAsString()`</description></item><item><title>respAddNumFieldAsString()</title><link>/rpg/response/respaddnumfieldasstring/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddnumfieldasstring/index.html</guid><description>This procedure adds Numeric field as string value into response. The big numeric (more than 15 digits) must be passed as string via JSON.
Parameter Type Description element 30A VARYING, VARSIZE Mandatory Name of element fieldName 30A VARYING, VARSIZE Mandatory Field name value 30P 9 Mandatory Numeric value The procedure returns pointer of field. If procedure can’t add field, then returns null.
NOTE: Numeric values must be rounded to reqired number of decimals prior to add value to response. `</description></item><item><title>respAddNumValueAsString()</title><link>/rpg/response/respaddnumvalueasstring/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddnumvalueasstring/index.html</guid><description>This procedure adds Numeric value as string value for existing field. The big numeric (more than 15 digits) must be passed as string via JSON.
Parameter Type Description ptr POINTER Mandatory Pointer to field numericValue 30P 9 Mandatory Numeric value The procedure returns pointer of field. If procedure can’t add value, then returns null.
NOTE: Numeric values must be rounded to reqired number of decimals prior to add value to response. `</description></item><item><title>respAddObjectField()</title><link>/rpg/response/respaddobjectfield/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddobjectfield/index.html</guid><description>This procedure adds JSON Object field into response.
Parameter Type Description element 30A VARYING, VARSIZE Mandatory Name of element fieldName 30A VARYING, VARSIZE Mandatory Field name obj_ptr POINTER Mandatory Pointer to JSON Object The procedure returns pointer of field. If procedure can’t add field, then returns null.
Note: The JSON Object have to be created by JSON_new(); procedure. Then use: JSON_startNode, JSON_endNode, JSON_addStringPair, JSON_addNumericPair, etc….. By these functions You can create JSON Object into memory. Then this JSON object can be put into response. After field is added then JSON_destroy must be used to avoid memory leak.`</description></item><item><title>respAddObjectValue()</title><link>/rpg/response/respaddobjectvalue/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddobjectvalue/index.html</guid><description>This procedure adds Object value for existing field.
Parameter Type Description ptr POINTER Mandatory Pointer to field obj_ptr POINTER Mandatory Pointer to object The procedure returns pointer of field. If procedure can’t add value, then returns null.
Note: The JSON Object have to be created by JSON_new(); procedure. Then use: JSON_startNode, JSON_endNode, JSON_addStringPair, JSON_addNumericPair, etc….. By these functions You can create JSON Object into memory. Then this JSON object can be put into response. After field is added then JSON_destroy must be used to avoid memory leak.`</description></item><item><title>respAddPgmMessages()</title><link>/rpg/response/respaddpgmmessages/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddpgmmessages/index.html</guid><description>This procedure adds all program messages into response.
Parameter Type Description callStackEntry 4096A Mandatory Call stack entry. The program name from call stack to which the message was sent. callStackEntryLen 10I 0 Optional Length of call stack entry The length of the value for the Call stack entry parameter. See QMHSNDPM IBM API for more details. callStackEntryQual 20A Optional Call stack entry qualification. This parameter is used when it is necessary to further identify the call stack entry. The parameter consists of two 10 character parts. The first part is the module name qualifier and the second part is the program name qualifier. The procedure returns status code. Following codes are supported.</description></item><item><title>respAddStringField()</title><link>/rpg/response/respaddstringfield/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddstringfield/index.html</guid><description>This procedure adds String field into response.
Parameter Type Description element 30A VARYING, VARSIZE Mandatory Name of element fieldName 30A VARYING, VARSIZE Mandatory Field name stringValue 1024A VARYING, VARSIZE Mandatory String value escape N Optional *ON or *OFF (Default = *ON) Indicates if value must be “escaped” means add ‘' escape character The procedure returns pointer of field. If procedure can’t add field, then returns null.
Examples:
respAddStringField('data': 'warehouse': SRSROM); respAddStringField('data': 'warehouse': SRSROM: *OFF);</description></item><item><title>respAddStringValue()</title><link>/rpg/response/respaddstringvalue/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddstringvalue/index.html</guid><description>This procedure adds String value for existing field.
Parameter Type Description ptr POINTER Mandatory Pointer to field stringValue 1024A VARYING, VARSIZE Mandatory String value escape N Optional *ON or *OFF (Default = *ON) Indicates if value must be “escaped” means add ‘' escape character The procedure returns pointer of field. If procedure can’t add value, then returns null.
Examples:
xxPtr = respAddField('data': 'warehouse'); respAddStringValue(xxPtr: SRSROM); respAddStringValue(xxPtr: SRSROM: *OFF);</description></item><item><title>respAddTimeField()</title><link>/rpg/response/respaddtimefield/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddtimefield/index.html</guid><description>This procedure adds Time field into response. The time is converted from numeric format HHMMSS to ISO standard format HH:MM:SS. Additionally it is possible to pass date and time and time zone in one go. Then the response value is ISO format: YYYY-MM-DDTHH:MM:SS+HH:MM
Parameter Type Description element 30A VARYING, VARSIZE Mandatory Name of element fieldName 30A VARYING, VARSIZE Mandatory Field name time 6P 0 Mandatory Numeric time value in format HH or HHMM or HHMMSS date 8P 0 Optional Numeric data velue in format YYYYMMDD timeZone 5P 0 Optional Numeric time shift in minutes The procedure returns pointer of field. If procedure can’t add field, then returns null.</description></item><item><title>respAddTimeValue()</title><link>/rpg/response/respaddtimevalue/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddtimevalue/index.html</guid><description>TThis procedure adds Time value for existing field. The time is converted from numeric format HHMMSS to ISO standard format HH:MM:SS. Additionally it is possible to pass date and time and time zone in one go. Then the response value is ISO format: YYYY-MM-DDTHH:MM:SS+HH:MM
Parameter Type Description ptr POINTER Mandatory Pointer to field time 6P 0 Mandatory Numeric time value in format HH or HHMM or HHMMSS date 8P 0 Optional Numeric data velue in format YYYYMMDD timeZone 5P 0 Optional Numeric time shift in minutes The procedure returns pointer of field. If procedure can’t add field, then returns null.</description></item><item><title>respAddUCS2Field()</title><link>/rpg/response/respadducs2field/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respadducs2field/index.html</guid><description>This procedure adds UCS2 String field into response.
Parameter Type Description element 30A VARYING, VARSIZE Mandatory Name of element fieldName 30A VARYING, VARSIZE Mandatory Field name stringValue 1024C VARYING, VARSIZE Mandatory UCS2 String value escape N Optional *ON or *OFF (Default = *ON) Indicates if value must be “escaped” means add ‘' escape character The procedure returns pointer of field. If procedure can’t add field, then returns null.
Examples:</description></item><item><title>respAddUCS2Value()</title><link>/rpg/response/respadducs2value/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respadducs2value/index.html</guid><description>This procedure adds UCS2 String value for existing field.
Parameter Type Description ptr POINTER Mandatory Pointer to field stringValue 1024C VARYING, VARSIZE Mandatory UCS2 String value escape N Optional *ON or *OFF (Default = *ON) Indicates if value must be “escaped” means add ‘' escape character The procedure returns pointer of field. If procedure can’t add value, then returns null.
Examples:
xxPtr = respAddField('data': 'Address'); respAddUCS2Value(xxPtr: %UCS2(ADADDR)); respAddUCS2Value(xxPtr: %UCS2(ADADDR): *OFF);</description></item><item><title>respAddValue()</title><link>/rpg/response/respaddvalue/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respaddvalue/index.html</guid><description>This is general procedure which adds value for existing field.
Parameter Type Description ptr POINTER Mandatory Pointer to field valueType 1A Mandatory Type of value numericValue 30P 9 Optional, can be omit Numeric value provided if valueType is set to “N” stringValue 1024A VARYING, VARSIZE Optional, can be omit String value provided if valueType is set to “S” json_ptr POINTER Optional, can be omit Pointer to JSON object provided if valueType is set to “J” UCS2value 1024C VARYING, VARSIZE Optional, can be omit UCS2 string value if valueType is set to “U” object_ptr POINTER Optional, can be omit The pointer to response element object provided if valueType is set to “R” blob_ptr POINTER Optional, can be omit The pointer to Blob data provided if valueType is set to “B”. Can be provided if value type is “J” blob_len 10U 0 Optional The length in bytes of Blob data provided if valueType is set to “B” or “J” Following valueTypes are supported:</description></item><item><title>respSetSendEmpty()</title><link>/rpg/response/respsetsendempty/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/rpg/response/respsetsendempty/index.html</guid><description>This procedure globaly sets will response contain empty fields (ZERO or BLANKS) or not.
Parameter Type Description propValue INDICATOR Mandatory Property which indicate if epty values (ZERO or BLANKS) are sent in response. Examples:
//This means all values will be sent include ZERO or BLANKS. respSetSendEmpty('1'); //This means only not empty values will be sent. Means not include ZERO and BLANKS. respSetSendEmpty('0');</description></item></channel></rss>