diff --git a/docs/ProgramCall.rst b/docs/ProgramCall.rst
index 1eca152..8d577e7 100644
--- a/docs/ProgramCall.rst
+++ b/docs/ProgramCall.rst
@@ -28,3 +28,99 @@ Retrieve the Return Value From a Service Program
.. literalinclude:: examples/cosine.js
:language: javascript
+
+Data types XMLSERVICE
+^^^^^^^^^^^^^^^^^^^^^
+
+.. list-table::
+ :header-rows: 1
+ :widths: 15 30 30 15
+
+ * - C types
+ - RPG types
+ - XMLSERVICE types
+ - SQL types
+ * - int8/byte
+ - D myint8 3i 0
+ - ````
+ - TINYINT (unsupported DB2)
+ * - int16/short
+ - D myint16 5i 0 (4b 0)
+ - ````
+ - SMALLINT
+ * - int32/int
+ - D myint32 10i 0 (9b 0)
+ - ````
+ - INTEGER
+ * - int64/longlong
+ - D myint64 20i 0
+ - ````
+ - BIGINT
+ * - uint8/ubyte
+ - D myuint8 3u 0
+ - ````
+ -
+ * - uint16/ushort
+ - D myuint16 5u 0
+ - ````
+ -
+ * - uint32/uint
+ - D myuint32 10u 0
+ - ````
+ -
+ * - uint64/ulonglong
+ - D myuint64 20u 0
+ - ````
+ -
+ * - char
+ - D mychar 32a
+ - ````
+ - CHAR(32)
+ * - varchar2
+ - D myvchar2 32a varying
+ - ````
+ - VARCHAR(32)
+ * - varchar4
+ - D myvchar4 32a varying(4)
+ - ````
+ -
+ * - packed
+ - D mydec 12p 2
+ - ````
+ - DECIMAL(12,2)
+ * - zoned
+ - D myzone 12s 2
+ - ````
+ - NUMERIC(12,2)
+ * - float
+ - D myfloat 4f
+ - ````
+ - FLOAT
+ * - real/double
+ - D myreal 8f
+ - ````
+ - DOUBLE
+ * - binary
+ - D mybin (any)
+ - ``F1F2F3``
+ - BINARY
+ * - hole (no out)
+ - D myhole (any)
+ - ````
+ -
+ * - boolean
+ - D mybool 1n
+ - ````
+ - CHAR(4)
+ * - time
+ - D mytime T timfmt(*iso)
+ - ``09.45.29``
+ - TIME
+ * - timestamp
+ - D mystamp Z
+ - ``2011-12-29-12.45.29.000000``
+ - TIMESTAMP
+ * - date
+ - D mydate D datfmt(*iso)
+ - ``2009-05-11``
+ - DATE
\ No newline at end of file
diff --git a/lib/Deprecated.js b/lib/Deprecated.js
index ed8b707..85af690 100644
--- a/lib/Deprecated.js
+++ b/lib/Deprecated.js
@@ -5,7 +5,7 @@
/* eslint-disable default-param-last */
const deprecate = require('depd');
-const { parseString } = require('xml2js');
+const { XMLParser, XMLValidator } = require('fast-xml-parser');
const iPgmDeprecate = deprecate('iPgm');
const iSqlDeprecate = deprecate('iSql');
@@ -676,26 +676,27 @@ class iDataQueue {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- rtValue = true;
- } else {
- rtValue = str;
- }
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue); // Run the call back function against the returned value.
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ rtValue = true;
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -738,27 +739,26 @@ class iDataQueue {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- rtValue = result.myscript.pgm[0].parm[3].data[0]._;
- } else {
- rtValue = str;
- }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ rtValue = result.myscript.pgm.parm[3].data;
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
}
@@ -795,26 +795,26 @@ class iDataQueue {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- rtValue = true;
- } else {
- rtValue = str;
- }
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ rtValue = true;
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -978,56 +978,57 @@ class iNetwork {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
- rtValue = {
- 'TCP/IPv4_stack_status': data[2]._,
- How_long_active: data[3]._,
- 'When_last_started_-_date': data[4]._,
- 'When_last_started_-_time': data[5]._,
- 'When_last_ended_-_date': data[6]._,
- 'When_last_ended_-_time': data[7]._,
- 'Who_last_started_-_job_name': data[8]._,
- 'Who_last_started_-_job_user_name': data[9]._,
- 'Who_last_started_-_job_number': data[10]._,
- 'Who_last_started_-_internal_job_identifier': data[11]._,
- 'Who_last_ended_-_job_name': data[12]._,
- 'Who_last_ended_-_job_user_name': data[13]._,
- 'Who_last_ended_-_job_number': data[14]._,
- 'Who_last_ended_-_internal_job_identifier': data[14]._,
- Offset_to_additional_information: data[16]._,
- Length_of_additional_information: data[17]._,
- Limited_mode: data[18]._,
- Offset_to_list_of_Internet_addresses: data[19]._,
- Number_of_Internet_addresses: data[20]._,
- Entry_length_for_list_of_Internet_addresses: data[21]._,
- DNS_protocol: data[22]._,
- Retries: data[23]._,
- Time_interval: data[24]._,
- Search_order: data[25]._,
- Initial_domain_name_server: data[26]._,
- DNS_listening_port: data[27]._,
- Host_name: data[28]._,
- Domain_name: data[29]._,
- Domain_search_list: data[31]._,
- };
- } else { rtValue = str; }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const data = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ 'TCP/IPv4_stack_status': data[2],
+ How_long_active: data[2],
+ 'When_last_started_-_date': data[4],
+ 'When_last_started_-_time': data[5],
+ 'When_last_ended_-_date': data[6],
+ 'When_last_ended_-_time': data[7],
+ 'Who_last_started_-_job_name': data[8],
+ 'Who_last_started_-_job_user_name': data[9],
+ 'Who_last_started_-_job_number': data[10],
+ 'Who_last_started_-_internal_job_identifier': data[11],
+ 'Who_last_ended_-_job_name': data[12],
+ 'Who_last_ended_-_job_user_name': data[13],
+ 'Who_last_ended_-_job_number': data[14],
+ 'Who_last_ended_-_internal_job_identifier': data[14],
+ Offset_to_additional_information: data[16],
+ Length_of_additional_information: data[17],
+ Limited_mode: data[18],
+ Offset_to_list_of_Internet_addresses: data[19],
+ Number_of_Internet_addresses: data[20],
+ Entry_length_for_list_of_Internet_addresses: data[21],
+ DNS_protocol: data[22],
+ Retries: data[23],
+ Time_interval: data[24],
+ Search_order: data[25],
+ Initial_domain_name_server: data[26],
+ DNS_listening_port: data[27],
+ Host_name: data[28],
+ Domain_name: data[29],
+ Domain_search_list: data[31],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
}
@@ -1208,74 +1209,75 @@ class iNetwork {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
-
- rtValue = {
- Internet_address: data[2]._,
- Internet_address_binary: data[4]._,
- Network_address: data[5]._,
- Network_address_binary: data[7]._,
- Line_description: data[8]._,
- Interface_status: data[10]._,
- Interface_type_of_service: data[11]._,
- Interface_MTU: data[12]._,
- Interface_line_type: data[13]._,
- Host_address: data[14]._,
- Host_address_binary: data[16]._,
- Interface_subnet_mask: data[17]._,
- Interface_subnet_mask_binary: data[19]._,
- Directed_broadcast_address: data[20]._,
- Directed_broadcast_address_binary: data[22]._,
- Change_date: data[23]._,
- Change_time: data[24]._,
- Associated_local_interface: data[25]._,
- Associated_local_interface_binary: data[27]._,
- Change_status: data[28]._,
- Packet_rules: data[29]._,
- Automatic_start: data[30]._,
- TRLAN_bit_sequencing: data[31]._,
- Interface_type: data[32]._,
- Proxy_ARP_allowed: data[33]._,
- Proxy_ARP_enabled: data[34]._,
- Configured_MTU: data[35]._,
- Network_name: data[36]._,
- Interface_name: data[37]._,
- Alias_name: data[38]._,
- Interface_description: data[40]._,
- Offset_to_preferred_interface_list: data[42]._,
- Number_of_entries_in_preferred_interface_list: data[43]._,
- Length_of_one_preferred_interface_list_entry: data[44]._,
- DHCP_created: data[45]._,
- DHCP_dynamic_DNS_updates: data[46]._,
- DHCP_lease_expiration: data[47]._,
- 'DHCP_lease_expiration_-_date': data[48]._,
- 'DHCP_lease_expiration_-_time': data[49]._,
- DHCP_lease_obtained: data[50]._,
- 'DHCP_lease_obtained_-_date': data[51]._,
- 'DHCP_lease_obtained_-_time': data[52]._,
- Use_DHCP_unique_identifier: data[53]._,
- DHCP_server_IP_address: data[54]._,
- Preferred_interface_Internet_address: data[56]._,
- Preferred_interface_Internet_address_binary: data[58]._,
- };
- } else { rtValue = str; }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ Internet_address: data[2],
+ Internet_address_binary: data[4],
+ Network_address: data[5],
+ Network_address_binary: data[7],
+ Line_description: data[8],
+ Interface_status: data[10],
+ Interface_type_of_service: data[11],
+ Interface_MTU: data[12],
+ Interface_line_type: data[13],
+ Host_address: data[14],
+ Host_address_binary: data[16],
+ Interface_subnet_mask: data[17],
+ Interface_subnet_mask_binary: data[19],
+ Directed_broadcast_address: data[20],
+ Directed_broadcast_address_binary: data[22],
+ Change_date: data[23],
+ Change_time: data[24],
+ Associated_local_interface: data[25],
+ Associated_local_interface_binary: data[27],
+ Change_status: data[28],
+ Packet_rules: data[29],
+ Automatic_start: data[30],
+ TRLAN_bit_sequencing: data[31],
+ Interface_type: data[32],
+ Proxy_ARP_allowed: data[33],
+ Proxy_ARP_enabled: data[34],
+ Configured_MTU: data[35],
+ Network_name: data[36],
+ Interface_name: data[37],
+ Alias_name: data[38],
+ Interface_description: data[40],
+ Offset_to_preferred_interface_list: data[42],
+ Number_of_entries_in_preferred_interface_list: data[43],
+ Length_of_one_preferred_interface_list_entry: data[44],
+ DHCP_created: data[45],
+ DHCP_dynamic_DNS_updates: data[46],
+ DHCP_lease_expiration: data[47],
+ 'DHCP_lease_expiration_-_date': data[48],
+ 'DHCP_lease_expiration_-_time': data[49],
+ DHCP_lease_obtained: data[50],
+ 'DHCP_lease_obtained_-_date': data[51],
+ 'DHCP_lease_obtained_-_time': data[52],
+ Use_DHCP_unique_identifier: data[53],
+ DHCP_server_IP_address: data[54],
+ Preferred_interface_Internet_address: data[56],
+ Preferred_interface_Internet_address_binary: data[58],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
}
@@ -1367,26 +1369,27 @@ class iObj {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- rtValue = true;
- } else {
- rtValue = str;
- }
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ rtValue = true;
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -1520,59 +1523,61 @@ class iObj {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
-
- rtValue = {
- 'Object_authority_/_Data_authority': data[2]._,
- Authorization_list_management: data[3]._,
- Object_operational: data[4]._,
- Object_management: data[5]._,
- Object_existence: data[6]._,
- Data_read: data[7]._,
- Data_add: data[8]._,
- Data_update: data[9]._,
- Data_delete: data[10]._,
- Authorization_list: data[11]._,
- Authority_source: data[12]._,
- Some_adopted_authority: data[13]._,
- Adopted_object_authority: data[14]._,
- Adopted_authorization_list_management: data[15]._,
- Adopted_object_operational: data[16]._,
- Adopted_object_management: data[17]._,
- Adopted_object_existence: data[18]._,
- Adopted_data_read: data[19]._,
- Adopted_data_add: data[20]._,
- Adopted_data_update: data[21]._,
- Adopted_data_delete: data[22]._,
- Adopted_data_execute: data[23]._,
- Adopted_object_alter: data[25]._,
- Adopted_object_reference: data[26]._,
- Data_execute: data[28]._,
- Object_alter: data[30]._,
- Object_reference: data[31]._,
- ASP_device_name_of_library: data[32]._,
- ASP_device_name_of_object: data[33]._,
- Offset_to_group_information_table: data[35]._,
- Number_of_group_table_entries_returned: data[36]._,
- };
- } else { rtValue = str; }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+
+ rtValue = {
+ 'Object_authority_/_Data_authority': data[2],
+ Authorization_list_management: data[3],
+ Object_operational: data[4],
+ Object_management: data[5],
+ Object_existence: data[6],
+ Data_read: data[7],
+ Data_add: data[8],
+ Data_update: data[9],
+ Data_delete: data[10],
+ Authorization_list: data[11],
+ Authority_source: data[12],
+ Some_adopted_authority: data[13],
+ Adopted_object_authority: data[14],
+ Adopted_authorization_list_management: data[15],
+ Adopted_object_operational: data[16],
+ Adopted_object_management: data[17],
+ Adopted_object_existence: data[18],
+ Adopted_data_read: data[19],
+ Adopted_data_add: data[20],
+ Adopted_data_update: data[21],
+ Adopted_data_delete: data[22],
+ Adopted_data_execute: data[23],
+ Adopted_object_alter: data[25],
+ Adopted_object_reference: data[26],
+ Data_execute: data[28],
+ Object_alter: data[30],
+ Object_reference: data[31],
+ ASP_device_name_of_library: data[32],
+ ASP_device_name_of_object: data[33],
+ Offset_to_group_information_table: data[35],
+ Number_of_group_table_entries_returned: data[36],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -1716,69 +1721,68 @@ class iObj {
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
-
- rtValue = {
- Command_name: data[2]._,
- Command_library_name: data[3]._,
- Command_processing_program_or_proxy_target_command: data[4]._,
- "Command_processing_program's_or_proxy_target_command's_library_name": data[5]._,
- Source_file_name: data[6]._,
- Source_file_library_name: data[7]._,
- Source_file_member_name: data[8]._,
- Validity_check_program_name: data[9]._,
- Validity_check_program_library_name: data[10]._,
- Mode_information: data[11]._,
- Where_allowed_to_run: data[12]._,
- Allow_limited_user: data[13]._,
- Maximum_positional_parameters: data[14]._,
- Prompt_message_file_name: data[15]._,
- Prompt_message_file_library_name: data[16]._,
- Message_file_name: data[17]._,
- Message_file_library_name: data[18]._,
- Help_panel_group_name: data[19]._,
- Help_panel_group_library_name: data[20]._,
- Help_identifier: data[21]._,
- Search_index_name: data[22]._,
- Search_index_library_name: data[23]._,
- Current_library: data[24]._,
- Product_library: data[25]._,
- Prompt_override_program_name: data[26]._,
- Prompt_override_program_library_name: data[27]._,
- Restricted_to_target_release: data[28]._,
- Text_description: data[29]._,
- Command_processing_program_call_state: data[30]._,
- Validity_check_program_call_state: data[31]._,
- Prompt_override_program_call_state: data[32]._,
- Offset_to_help_bookshelf_information: data[33]._,
- Length_of_help_bookshelf_information: data[34]._,
- 'Coded_character_set_ID_(CCSID)': data[35]._,
- Enabled_for_GUI_indicator: data[36]._,
- Threadsafe_indicator: data[37]._,
- Multithreaded_job_action: data[38]._,
- Proxy_command_indicator: data[39]._,
- Prompt_message_file_text_indicator: data[40]._,
- };
- } else { rtValue = str; }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ Command_name: data[2],
+ Command_library_name: data[3],
+ Command_processing_program_or_proxy_target_command: data[4],
+ "Command_processing_program's_or_proxy_target_command's_library_name": data[5],
+ Source_file_name: data[6],
+ Source_file_library_name: data[7],
+ Source_file_member_name: data[8],
+ Validity_check_program_name: data[9],
+ Validity_check_program_library_name: data[10],
+ Mode_information: data[11],
+ Where_allowed_to_run: data[12],
+ Allow_limited_user: data[13],
+ Maximum_positional_parameters: data[14],
+ Prompt_message_file_name: data[15],
+ Prompt_message_file_library_name: data[16],
+ Message_file_name: data[17],
+ Message_file_library_name: data[18],
+ Help_panel_group_name: data[19],
+ Help_panel_group_library_name: data[20],
+ Help_identifier: data[21],
+ Search_index_name: data[22],
+ Search_index_library_name: data[23],
+ Current_library: data[24],
+ Product_library: data[25],
+ Prompt_override_program_name: data[26],
+ Prompt_override_program_library_name: data[27],
+ Restricted_to_target_release: data[28],
+ Text_description: data[29],
+ Command_processing_program_call_state: data[30],
+ Validity_check_program_call_state: data[31],
+ Prompt_override_program_call_state: data[32],
+ Offset_to_help_bookshelf_information: data[33],
+ Length_of_help_bookshelf_information: data[34],
+ 'Coded_character_set_ID_(CCSID)': data[35],
+ Enabled_for_GUI_indicator: data[36],
+ Threadsafe_indicator: data[37],
+ Multithreaded_job_action: data[38],
+ Proxy_command_indicator: data[39],
+ Prompt_message_file_text_indicator: data[40],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
-
this.conn.run(toJson); // Post the input XML and get the response.
}
@@ -1965,88 +1969,89 @@ class iObj {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
- rtValue = {
- Program_name: data[2]._,
- Program_library_name: data[3]._,
- Program_owner: data[4]._,
- Program_attribute: data[5]._,
- Creation_date_and_time: data[6]._,
- Source_file_name: data[7]._,
- Source_file_library_name: data[8]._,
- Source_file_member_name: data[9]._,
- Source_file_updated_date_and_time: data[10]._,
- Observable_information: data[11]._,
- User_profile_option: data[12]._,
- Use_adopted_authority: data[13]._,
- Log_commands: data[14]._,
- Allow_RTVCLSRC: data[15]._,
- Fix_decimal_data: data[16]._,
- Text_description: data[17]._,
- Type_of_program: data[18]._,
- 'Teraspace_storage-enabled_program': data[19]._,
- Minimum_number_of_parameters: data[21]._,
- Maximum_number_of_parameters: data[22]._,
- Program_size: data[23]._,
- Associated_space_size: data[24]._,
- Static_storage_size: data[25]._,
- Automatic_storage_size: data[26]._,
- Number_of_MI_instructions: data[27]._,
- Number_of_MI_ODT_entries: data[28]._,
- Program_state: data[29]._,
- Compiler_identification: data[30]._,
- Earliest_release_program_can_run: data[31]._,
- Sort_sequence_table_name: data[32]._,
- Sort_sequence_table_library_name: data[33]._,
- Language_identifier: data[34]._,
- Program_domain: data[35]._,
- Conversion_required: data[36]._,
- Conversion_details: data[37]._,
- Optimization: data[39]._,
- Paging_pool: data[40]._,
- 'Update_program_automatic_storage_area_(PASA)': data[41]._,
- 'Clear_program_automatic_storage_area_(PASA)': data[42]._,
- Paging_amount: data[43]._,
- Program_entry_procedure_module: data[45]._,
- Program_entry_procedure_module_library: data[46]._,
- Activation_group_attribute: data[47]._,
- Observable_information_compressed: data[48]._,
- 'Run-time_information_compressed': data[49]._,
- Release_program_created_on: data[50]._,
- Shared_activation_group: data[51]._,
- Allow_update: data[52]._,
- Program_CCSID: data[53]._,
- Number_of_modules: data[54]._,
- Number_of_service_programs: data[55]._,
- Number_of_copyrights: data[56]._,
- Number_of_unresolved_references: data[57]._,
- Release_program_created_for: data[58]._,
- Allow_static_storage_reinitialization: data[59]._,
- All_creation_data: data[60]._,
- 'Allow_bound_*SRVPGM_library_name_update': data[61]._,
- Profiling_data: data[62]._,
- Teraspace_storage_enabled_modules: data[63]._,
- Storage_model: data[64]._,
- 'Uses_argument_optimization_(ARGOPT)': data[65]._,
- };
- } else { rtValue = str; }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ Program_name: data[2],
+ Program_library_name: data[3],
+ Program_owner: data[4],
+ Program_attribute: data[5],
+ Creation_date_and_time: data[6],
+ Source_file_name: data[7],
+ Source_file_library_name: data[8],
+ Source_file_member_name: data[9],
+ Source_file_updated_date_and_time: data[10],
+ Observable_information: data[11],
+ User_profile_option: data[12],
+ Use_adopted_authority: data[13],
+ Log_commands: data[14],
+ Allow_RTVCLSRC: data[15],
+ Fix_decimal_data: data[16],
+ Text_description: data[17],
+ Type_of_program: data[18],
+ 'Teraspace_storage-enabled_program': data[19],
+ Minimum_number_of_parameters: data[21],
+ Maximum_number_of_parameters: data[22],
+ Program_size: data[23],
+ Associated_space_size: data[24],
+ Static_storage_size: data[25],
+ Automatic_storage_size: data[26],
+ Number_of_MI_instructions: data[27],
+ Number_of_MI_ODT_entries: data[28],
+ Program_state: data[29],
+ Compiler_identification: data[30],
+ Earliest_release_program_can_run: data[31],
+ Sort_sequence_table_name: data[32],
+ Sort_sequence_table_library_name: data[33],
+ Language_identifier: data[34],
+ Program_domain: data[35],
+ Conversion_required: data[36],
+ Conversion_details: data[37],
+ Optimization: data[39],
+ Paging_pool: data[40],
+ 'Update_program_automatic_storage_area_(PASA)': data[41],
+ 'Clear_program_automatic_storage_area_(PASA)': data[42],
+ Paging_amount: data[43],
+ Program_entry_procedure_module: data[45],
+ Program_entry_procedure_module_library: data[46],
+ Activation_group_attribute: data[47],
+ Observable_information_compressed: data[48],
+ 'Run-time_information_compressed': data[49],
+ Release_program_created_on: data[50],
+ Shared_activation_group: data[51],
+ Allow_update: data[52],
+ Program_CCSID: data[53],
+ Number_of_modules: data[54],
+ Number_of_service_programs: data[55],
+ Number_of_copyrights: data[56],
+ Number_of_unresolved_references: data[57],
+ Release_program_created_for: data[58],
+ Allow_static_storage_reinitialization: data[59],
+ All_creation_data: data[60],
+ 'Allow_bound_*SRVPGM_library_name_update': data[61],
+ Profiling_data: data[62],
+ Teraspace_storage_enabled_modules: data[63],
+ Storage_model: data[64],
+ 'Uses_argument_optimization_(ARGOPT)': data[65],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -2193,69 +2198,69 @@ class iObj {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
-
- rtValue = {
- Service_program_name: data[2]._,
- Service_program_library_name: data[3]._,
- Service_program_owner: data[4]._,
- Service_program_attribute: data[5]._,
- Creation_date_and_time: data[6]._,
- Export_source_file_name: data[7]._,
- Export_source_file_library_name: data[8]._,
- Export_source_file_member_name: data[9]._,
- Activation_group_attribute: data[10]._,
- Current_export_signature: data[11]._,
- User_profile: data[12]._,
- Observable_information_compressed: data[13]._,
- 'Run-time_information_compressed': data[14]._,
- Service_program_CCSID: data[15]._,
- Number_of_modules: data[16]._,
- Number_of_service_programs: data[17]._,
- Number_of_copyrights: data[18]._,
- Text_description: data[19]._,
- Shared_activation_group: data[20]._,
- Allow_update: data[21]._,
- Number_of_unresolved_references: data[22]._,
- Use_adopted_authority: data[23]._,
- 'Allow_bound_*SRVPGM_library_name_update': data[24]._,
- Profiling_data: data[25]._,
- Teraspace_storage_enabled_modules: data[26]._,
- Storage_model: data[27]._,
- 'Uses_argument_optimization_(ARGOPT)': data[28]._,
- Service_program_state: data[30]._,
- Service_program_domain: data[31]._,
- Associated_space_size: data[32]._,
- Static_storage_size: data[33]._,
- Service_program_size: data[34]._,
- Release_service_program_created_on: data[35]._,
- Earliest_release_service_program_can_run: data[36]._,
- Release_service_program_created_for: data[37]._,
- Allow_static_storage_reinitialization: data[38]._,
- Conversion_required: data[39]._,
- All_creation_data: data[40]._,
- Conversion_details: data[41]._,
- Paging_pool: data[43]._,
- Paging_amount: data[44]._,
- };
- } else { rtValue = str; }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ Service_program_name: data[2],
+ Service_program_library_name: data[3],
+ Service_program_owner: data[4],
+ Service_program_attribute: data[5],
+ Creation_date_and_time: data[6],
+ Export_source_file_name: data[7],
+ Export_source_file_library_name: data[8],
+ Export_source_file_member_name: data[9],
+ Activation_group_attribute: data[10],
+ Current_export_signature: data[11],
+ User_profile: data[12],
+ Observable_information_compressed: data[13],
+ 'Run-time_information_compressed': data[14],
+ Service_program_CCSID: data[15],
+ Number_of_modules: data[16],
+ Number_of_service_programs: data[17],
+ Number_of_copyrights: data[18],
+ Text_description: data[19],
+ Shared_activation_group: data[20],
+ Allow_update: data[21],
+ Number_of_unresolved_references: data[22],
+ Use_adopted_authority: data[23],
+ 'Allow_bound_*SRVPGM_library_name_update': data[24],
+ Profiling_data: data[25],
+ Teraspace_storage_enabled_modules: data[26],
+ Storage_model: data[27],
+ 'Uses_argument_optimization_(ARGOPT)': data[28],
+ Service_program_state: data[30],
+ Service_program_domain: data[31],
+ Associated_space_size: data[32],
+ Static_storage_size: data[33],
+ Service_program_size: data[34],
+ Release_service_program_created_on: data[35],
+ Earliest_release_service_program_can_run: data[36],
+ Release_service_program_created_for: data[37],
+ Allow_static_storage_reinitialization: data[38],
+ Conversion_required: data[39],
+ All_creation_data: data[40],
+ Conversion_details: data[41],
+ Paging_pool: data[43],
+ Paging_amount: data[44],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -2338,40 +2343,41 @@ class iObj {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
- rtValue = {
- User_profile_name: data[2]._,
- 'Previous_sign-on_date_and_time': data[3]._,
- 'Sign-on_attempts_not_valid': data[5]._,
- Status: data[6]._,
- Password_change_date: data[7]._,
- No_password_indicator: data[8]._,
- Password_expiration_interval: data[10]._,
- Date_password_expires: data[11]._,
- Days_until_password_expires: data[12]._,
- Set_password_to_expire: data[13]._,
- 'Display_sign-on_information': data[14]._,
- Local_password_management: data[15]._,
- Block_password_change: data[16]._,
- };
- } else { rtValue = str; }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ User_profile_name: data[2],
+ 'Previous_sign-on_date_and_time': data[3],
+ 'Sign-on_attempts_not_valid': data[5],
+ Status: data[6],
+ Password_change_date: data[7],
+ No_password_indicator: data[8],
+ Password_expiration_interval: data[10],
+ Date_password_expires: data[11],
+ Days_until_password_expires: data[12],
+ Set_password_to_expire: data[13],
+ 'Display_sign-on_information': data[14],
+ Local_password_management: data[15],
+ Block_password_change: data[16],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -2475,41 +2481,42 @@ class iObj {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
- rtValue = {
- Profile_name: data[0]._,
- User_or_group_indicator: data[1]._,
- Data_authority: data[2]._,
- Authorization_list_management: data[3]._,
- Object_management: data[4]._,
- Object_existence: data[5]._,
- Object_alter: data[6]._,
- Object_reference: data[7]._,
- Object_operational: data[9]._,
- Data_read: data[10]._,
- Data_add: data[11]._,
- Data_update: data[12]._,
- Data_delete: data[13]._,
- Data_execute: data[14]._,
- };
- } else { rtValue = str; }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ Profile_name: data[0],
+ User_or_group_indicator: data[1],
+ Data_authority: data[2],
+ Authorization_list_management: data[3],
+ Object_management: data[4],
+ Object_existence: data[5],
+ Object_alter: data[6],
+ Object_reference: data[7],
+ Object_operational: data[9],
+ Data_read: data[10],
+ Data_add: data[11],
+ Data_update: data[12],
+ Data_delete: data[13],
+ Data_execute: data[14],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -2690,56 +2697,57 @@ class iProd {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(null);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
- rtValue = {
- Product_ID: data[3]._,
- PTF_ID: data[4]._,
- Release_level: data[5]._,
- Product_option: data[6]._,
- Load_ID: data[7]._,
- Loaded_status: data[8]._,
- Cover_letter_status: data[9]._,
- 'On-order_status': data[10]._,
- Save_file_status: data[11]._,
- File_name: data[12]._,
- File_library_name: data[13]._,
- PTF_type: data[14]._,
- IPL_action: data[15]._,
- Action_pending: data[16]._,
- Action_required: data[17]._,
- PTF_is_released: data[18]._,
- Target_release: data[19]._,
- Superseding_PTF: data[20]._,
- Current_IPL_source: data[21]._,
- Minimum_level: data[22]._,
- Maximum_level: data[23]._,
- Format_information_available: data[24]._,
- Status_date_and_time: data[25]._,
- Licensed_Internal_Code_group: data[26]._,
- Superseded_by_PTF_ID: data[27]._,
- Current_server_IPL_source: data[28]._,
- Server_IPL_required: data[29]._,
- Creation_date_and_time: data[30]._,
- Technology_refresh_PTF: data[31]._,
- };
- } else { rtValue = str; }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ Product_ID: data[3],
+ PTF_ID: data[4],
+ Release_level: data[5],
+ Product_option: data[6],
+ Load_ID: data[7],
+ Loaded_status: data[8],
+ Cover_letter_status: data[9],
+ 'On-order_status': data[10],
+ Save_file_status: data[11],
+ File_name: data[12],
+ File_library_name: data[13],
+ PTF_type: data[14],
+ IPL_action: data[15],
+ Action_pending: data[16],
+ Action_required: data[17],
+ PTF_is_released: data[18],
+ Target_release: data[19],
+ Superseding_PTF: data[20],
+ Current_IPL_source: data[21],
+ Minimum_level: data[22],
+ Maximum_level: data[23],
+ Format_information_available: data[24],
+ Status_date_and_time: data[25],
+ Licensed_Internal_Code_group: data[26],
+ Superseded_by_PTF_ID: data[27],
+ Current_server_IPL_source: data[28],
+ Server_IPL_required: data[29],
+ Creation_date_and_time: data[30],
+ Technology_refresh_PTF: data[31],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -2865,45 +2873,45 @@ class iProd {
callback(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- callback(parseError, null);
- return;
- }
- callback(null);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
-
- rtValue = {
- Product_ID: data[3]._,
- Release_level: data[4]._,
- Product_option: data[5]._,
- Load_ID: data[6]._,
- Load_type: data[7]._,
- Symbolic_load_state: data[8]._,
- Load_error_indicator: data[9]._,
- Load_state: data[10]._,
- Supported_flag: data[11]._,
- Registration_type: data[12]._,
- Registration_value: data[13]._,
- Offset_to_additional_information: data[15]._,
- Primary_language_load_identifier: data[16]._,
- Minimum_target_release: data[17]._,
- 'Minimum_VRM_of_*BASE_required_by_option': data[18]._,
- Requirements_met_between_base_and_option_value: data[19]._,
- Level: data[20]._,
- };
- } else { rtValue = str; }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- callback(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- callback(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ Product_ID: data[3],
+ Release_level: data[4],
+ Product_option: data[5],
+ Load_ID: data[6],
+ Load_type: data[7],
+ Symbolic_load_state: data[8],
+ Load_error_indicator: data[9],
+ Load_state: data[10],
+ Supported_flag: data[11],
+ Registration_type: data[12],
+ Registration_value: data[13],
+ Offset_to_additional_information: data[15],
+ Primary_language_load_identifier: data[16],
+ Minimum_target_release: data[17],
+ 'Minimum_VRM_of_*BASE_required_by_option': data[18],
+ Requirements_met_between_base_and_option_value: data[19],
+ Level: data[20],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ callback(null, rtValue);
+ return;
+ }
+ callback(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -3009,42 +3017,42 @@ class iProd {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
- const count = result.myscript.pgm[0].parm[4].ds[0].data[1]._;
-
- for (let i = 0; i < count * 12; i += 12) {
- rtValue.push({
- Product_ID: data[i]._,
- Product_option: data[i + 1]._,
- Release_level: data[i + 2]._,
- Description_text_message_ID: data[i + 4]._,
- Description_text_object_name: data[i + 5]._,
- Description_text_library_name: data[i + 6]._,
- Installed_flag: data[i + 7]._,
- Supported_flag: data[i + 8]._,
- Registration_type: data[i + 9]._,
- Registration_value: data[i + 10]._,
- Description_text: data[i + 11]._,
- });
- }
- } else { rtValue = str; }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ const count = result.myscript.pgm.parm[4].ds.data[1];
+ for (let i = 0; i < count * 12; i += 12) {
+ rtValue.push({
+ Product_ID: data[i],
+ Product_option: data[i + 1],
+ Release_level: data[i + 2],
+ Description_text_message_ID: data[i + 4],
+ Description_text_object_name: data[i + 5],
+ Description_text_library_name: data[i + 6],
+ Installed_flag: data[i + 7],
+ Supported_flag: data[i + 8],
+ Registration_type: data[i + 9],
+ Registration_value: data[i + 10],
+ Description_text: data[i + 11],
+ });
+ }
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -3147,27 +3155,26 @@ class iUserSpace {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- rtValue = true;
- } else {
- rtValue = str;
- }
-
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ rtValue = true;
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -3219,26 +3226,26 @@ class iUserSpace {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- rtValue = true;
- } else {
- rtValue = str;
- }
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ rtValue = true;
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -3289,27 +3296,27 @@ class iUserSpace {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[3];
- rtValue = data[0]._;
- } else {
- rtValue = str;
- }
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[3];
+ rtValue = data;
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -3355,25 +3362,27 @@ class iUserSpace {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- rtValue = true;
- } else { rtValue = str; }
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ rtValue = true;
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML and get the response.
@@ -3532,27 +3541,28 @@ class iWork {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
- rtValue = data[6]._; // Get the returned value from the output array.
- } else {
- rtValue = str;
- }
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ [, , , , , , rtValue] = data; // Get the returned value from the output array.
+ rtValue = rtValue.toString();
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson); // Post the input XML
@@ -3638,43 +3648,46 @@ class iWork {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
- rtValue = {
- Current_date_and_time: data[2]._,
- System_name: data[3]._,
- Users_currently_signed_on: data[4]._,
- 'Users_temporarily_signed_off_(disconnected)': data[5]._,
- Users_suspended_by_system_request: data[6]._,
- Users_suspended_by_group_jobs: data[7]._,
- Users_signed_off_with_printer_output_waiting_to_print: data[8]._,
- Batch_jobs_waiting_for_messages: data[9]._,
- Batch_jobs_running: data[10]._,
- Batch_jobs_held_while_running: data[11]._,
- Batch_jobs_ending: data[12]._,
- Batch_jobs_waiting_to_run_or_already_scheduled: data[13]._,
- Batch_jobs_held_on_a_job_queue: data[14]._,
- Batch_jobs_on_a_held_job_queue: data[15]._,
- Batch_jobs_on_an_unassigned_job_queue: data[16]._,
- Batch_jobs_ended_with_printer_output_waiting_to_print: data[17]._,
- };
- } else { rtValue = str; }
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ Current_date_and_time: data[2],
+ System_name: data[3],
+ Users_currently_signed_on: data[4],
+ 'Users_temporarily_signed_off_(disconnected)': data[5],
+ Users_suspended_by_system_request: data[6],
+ Users_suspended_by_group_jobs: data[7],
+ Users_signed_off_with_printer_output_waiting_to_print: data[8],
+ Batch_jobs_waiting_for_messages: data[9],
+ Batch_jobs_running: data[10],
+ Batch_jobs_held_while_running: data[11],
+ Batch_jobs_ending: data[12],
+ Batch_jobs_waiting_to_run_or_already_scheduled: data[13],
+ Batch_jobs_held_on_a_job_queue: data[14],
+ Batch_jobs_on_a_held_job_queue: data[15],
+ Batch_jobs_on_an_unassigned_job_queue: data[16],
+ Batch_jobs_ended_with_printer_output_waiting_to_print: data[17],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson);
@@ -3793,59 +3806,60 @@ class iWork {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
-
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
- rtValue = {
- Current_date_and_time: data[2]._,
- System_name: data[3]._,
- Elapsed_time: data[4]._,
- Restricted_state_flag: data[5]._,
- '%_processing_unit_used': data[7]._,
- Jobs_in_system: data[8]._,
- '%_permanent_addresses': data[9]._,
- '%_temporary_addresses': data[10]._,
- System_ASP: data[11]._,
- '%_system_ASP_used': data[12]._,
- Total_auxiliary_storage: data[13]._,
- Current_unprotected_storage_used: data[14]._,
- Maximum_unprotected_storage_used: data[15]._,
- '%_DB_capability': data[16]._,
- Main_storage_size: data[17]._,
- Number_of_partitions: data[18]._,
- Partition_identifier: data[19]._,
- Current_processing_capacity: data[21]._,
- Processor_sharing_attribute: data[22]._,
- Number_of_processors: data[24]._,
- Active_jobs_in_system: data[25]._,
- Active_threads_in_system: data[26]._,
- Maximum_jobs_in_system: data[27]._,
- '%_temporary_256MB_segments_used': data[28]._,
- '%_temporary_4GB_segments_used': data[29]._,
- '%_permanent_256MB_segments_used': data[30]._,
- '%_permanent_4GB_segments_used': data[31]._,
- '%_current_interactive_performance': data[32]._,
- '%_uncapped_CPU_capacity_used': data[33]._,
- '%_shared_processor_pool_used': data[34]._,
- 'Main_storage_size_(long)': data[35]._,
- };
- } else { rtValue = str; }
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ Current_date_and_time: data[2],
+ System_name: data[3],
+ Elapsed_time: data[4],
+ Restricted_state_flag: data[5],
+ '%_processing_unit_used': data[7],
+ Jobs_in_system: data[8],
+ '%_permanent_addresses': data[9],
+ '%_temporary_addresses': data[10],
+ System_ASP: data[11],
+ '%_system_ASP_used': data[12],
+ Total_auxiliary_storage: data[13],
+ Current_unprotected_storage_used: data[14],
+ Maximum_unprotected_storage_used: data[15],
+ '%_DB_capability': data[16],
+ Main_storage_size: data[17],
+ Number_of_partitions: data[18],
+ Partition_identifier: data[19],
+ Current_processing_capacity: data[21],
+ Processor_sharing_attribute: data[22],
+ Number_of_processors: data[24],
+ Active_jobs_in_system: data[25],
+ Active_threads_in_system: data[26],
+ Maximum_jobs_in_system: data[27],
+ '%_temporary_256MB_segments_used': data[28],
+ '%_temporary_4GB_segments_used': data[29],
+ '%_permanent_256MB_segments_used': data[30],
+ '%_permanent_4GB_segments_used': data[31],
+ '%_current_interactive_performance': data[32],
+ '%_uncapped_CPU_capacity_used': data[33],
+ '%_shared_processor_pool_used': data[34],
+ 'Main_storage_size_(long)': data[35],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson);
@@ -3906,30 +3920,31 @@ class iWork {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
-
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
- rtValue = {
- Job_status: data[2]._,
- Fully_qualified_job_name: data[4]._,
- };
- } else { rtValue = str; }
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ Job_status: data[2],
+ Fully_qualified_job_name: data[4],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson);
@@ -4068,64 +4083,64 @@ class iWork {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
-
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
-
- rtValue = {
- Job_name: data[2]._,
- User_name: data[3]._,
- Job_number: data[4]._,
- Job_status: data[6]._,
- Job_type: data[7]._,
- Job_subtype: data[8]._,
- Subsystem_description_name: data[9]._,
- 'Run_priority_(job)': data[10]._,
- System_pool_identifier: data[11]._,
- 'Processing_unit_time_used,_if_less_than_2,147,483,647_milliseconds': data[12]._,
- 'Number_of_auxiliary_I/O_requests,_if_less_than_2,147,483,647': data[13]._,
- Number_of_interactive_transactions: data[14]._,
- Response_time_total: data[15]._,
- Function_type: data[16]._,
- Function_name: data[17]._,
- Active_job_status: data[18]._,
- Number_of_database_lock_waits: data[19]._,
- Number_of_internal_machine_lock_waits: data[20]._,
- Number_of_nondatabase_lock_waits: data[21]._,
- Time_spent_on_database_lock_waits: data[22]._,
- Time_spent_on_internal_machine_lock_waits: data[23]._,
- Time_spent_on_nondatabase_lock_waits: data[24]._,
- Current_system_pool_identifier: data[26]._,
- Thread_count: data[27]._,
- 'Processing_unit_time_used_-_total_for_the_job': data[28]._,
- 'Number_of_auxiliary_I/O_requests': data[29]._,
- 'Processing_unit_time_used_for_database_-_total_for_the_job': data[30]._,
- Page_faults: data[31]._,
- Active_job_status_for_jobs_ending: data[32]._,
- Memory_pool_name: data[33]._,
- Message_reply: data[34]._,
- 'Message_key,_when_active_job_waiting_for_a_message': data[35]._,
- 'Message_queue_name,_when_active_job_waiting_for_a_message': data[36]._,
- 'Message_queue_library_name,_when_active_job_waiting_for_a_message': data[37]._,
- 'Message_queue_library_ASP_device_name,_when_active_job_waiting_for_a_message': data[38]._,
- };
- } else { rtValue = str; }
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ Job_name: data[2],
+ User_name: data[3],
+ Job_number: data[4],
+ Job_status: data[6],
+ Job_type: data[7],
+ Job_subtype: data[8],
+ Subsystem_description_name: data[9],
+ 'Run_priority_(job)': data[10],
+ System_pool_identifier: data[11],
+ 'Processing_unit_time_used,_if_less_than_2,147,483,647_milliseconds': data[12],
+ 'Number_of_auxiliary_I/O_requests,_if_less_than_2,147,483,647': data[13],
+ Number_of_interactive_transactions: data[14],
+ Response_time_total: data[15],
+ Function_type: data[16],
+ Function_name: data[17],
+ Active_job_status: data[18],
+ Number_of_database_lock_waits: data[19],
+ Number_of_internal_machine_lock_waits: data[20],
+ Number_of_nondatabase_lock_waits: data[21],
+ Time_spent_on_database_lock_waits: data[22],
+ Time_spent_on_internal_machine_lock_waits: data[23],
+ Time_spent_on_nondatabase_lock_waits: data[24],
+ Current_system_pool_identifier: data[26],
+ Thread_count: data[27],
+ 'Processing_unit_time_used_-_total_for_the_job': data[28],
+ 'Number_of_auxiliary_I/O_requests': data[29],
+ 'Processing_unit_time_used_for_database_-_total_for_the_job': data[30],
+ Page_faults: data[31],
+ Active_job_status_for_jobs_ending: data[32],
+ Memory_pool_name: data[33],
+ Message_reply: data[34],
+ 'Message_key,_when_active_job_waiting_for_a_message': data[35],
+ 'Message_queue_name,_when_active_job_waiting_for_a_message': data[36],
+ 'Message_queue_library_name,_when_active_job_waiting_for_a_message': data[37],
+ 'Message_queue_library_ASP_device_name,_when_active_job_waiting_for_a_message': data[38],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson);
}
@@ -4199,32 +4214,34 @@ class iWork {
cb(null);
return;
}
- parseString(str, (parseError, result) => {
- if (parseError) {
- if (this.reportError) {
- cb(parseError, null);
- return;
- }
- cb(str);
- return;
- }
- if (result.myscript.pgm[0].success && result.myscript.pgm[0].success[0].includes('+++ success')) {
- const { data } = result.myscript.pgm[0].parm[0].ds[0];
- rtValue = {
- Type_of_value_returned: data[2]._,
- Library_name: data[3]._,
- Length_of_value_returned: data[4]._,
- Number_of_decimal_positions: data[5]._,
- Value: data[6]._,
- };
- } else { rtValue = str; }
+ const parser = new XMLParser();
+ const result = parser.parse(str);
+ if (!XMLValidator.validate(str, { allowBooleanAttributes: true })) {
if (this.reportError) {
- cb(null, rtValue);
+ cb(Error('Unable to parse the xml input'), null);
return;
}
- cb(rtValue);
- });
+ cb(str);
+ return;
+ }
+ if (result.myscript.pgm.success && result.myscript.pgm.success.includes('+++ success')) {
+ const { data } = result.myscript.pgm.parm[0].ds;
+ rtValue = {
+ Type_of_value_returned: data[2],
+ Library_name: data[3],
+ Length_of_value_returned: data[4],
+ Number_of_decimal_positions: data[5],
+ Value: data[6],
+ };
+ } else {
+ rtValue = str;
+ }
+ if (this.reportError) {
+ cb(null, rtValue);
+ return;
+ }
+ cb(rtValue);
};
this.conn.run(toJson);
}