input xml which needs to parsed for encodedtokenexchange field using either
xml into or xml-sax :-
i tried attached code but it's resulting in compilation errors.
sample input xml:-
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?><TokenExchangeResponse xmlns="
http://schemas.nav.gov.hu/OSA/1.0/api" xmlns:ns2="
http://schemas.nav.gov.hu/OSA/1.0/data
"><header><requestId>XXXXXXX6614</requestId><timestamp>2019-10-22T09:53:40.541Z</timestamp><requestVersion>1.1</requestVersion><headerVersion>1.0</headerVersion></header><result><funcCode>OK</funcCode></result><software><softwareId>R1RL002AAAAAAAAAAA</softwareId><softwareName>string</softwareName><softwareOperation>LOCAL_SOFTWARE</softwareOperation><softwareMainVersion>string</softwareMainVersion><softwareDevName>string</softwareDevName><softwareDevContact>string</softwareDevContact><softwareDevCountryCode>HU</softwareDevCountryCode><softwareDevTaxNumber>string</softwareDevTaxNumber></software><encodedExchangeToken>u3VtNgfyWU9faZc3Iaa8ZWbE5UZCfmC17yA4MyW0ghflt9dNQNDpCcgMZiG/kXPE4vv2CHL93B4iKiODHxxdVA==</encodedExchangeToken><tokenValidityFrom>2019-10-22T11:57:16.646+02:00</tokenValidityFrom><tokenValidityTo>2019-10-22T12:02:16.646+02:00</tokenValidityTo></TokenExchangeResponse>
Thanks
---------- Forwarded message ---------
From: Rishi Seth <rishiseth99@xxxxxxxxx>
Date: Wed, Oct 30, 2019 at 11:51 AM
Subject: parsing varying length field from XML file using RPGLE program
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Currently I am just trying to extract fixed length field called
'encodedExchangeToken'
in my RPGLE program but unable to extract it using XML INTO and it keeps
giving
me compilation error and I am unable to extract it's value from the
attached input XML file here
also if possible can you please advise if this field's length will vary,i
mean as it may have have varying
length data inside it then how will we be able to extract it's value using
XML-SAX considering current scenario
here.Please find my sample program and sample input xml attached here also
compilation errors for more details.
HOPTION (*SRCSTMT: *NODEBUGIO)
DFILENAME S 100A
DOPTIONS S 100A INZ
DToken DS QUALIFIED
DToken 88
C
/FREE
OPTIONS = 'DOC=FILE CASE=ANY';
FILENAME = '/HOME/i0rs01hu/input5.xml';
XML-INTO Token %XML(%TRIM(FILENAME):OPTIONS);
RETURN;
*INLR = *ON;
/END-FREE
5770WDS V7R3M0 160422 RN IBM ILE RPG RISHI/DCR3 VF61 19-10-30 11:10:26 Page 1
Command . . . . . . . . . . . . : CRTBNDRPG
Issued by . . . . . . . . . . : I0RS01HU
Program . . . . . . . . . . . . : DCR3
Library . . . . . . . . . . . : RISHI
Text 'description' . . . . . . . : *SRCMBRTXT
Source Member . . . . . . . . . : DCR3
Source File . . . . . . . . . . : RS1
Library . . . . . . . . . . . : RISHI
CCSID . . . . . . . . . . . . : 870
Text 'description' . . . . . . . :
Last Change . . . . . . . . . . : 19-10-30 11:10:18
Generation severity level . . . : 10
Default activation group . . . . : *YES
Compiler options . . . . . . . . : *XREF *GEN *NOSECLVL *SHOWCPY
*EXPDDS *EXT *NOSHOWSKP *NOSRCSTMT
*DEBUGIO *UNREF *NOEVENTF
Debugging views . . . . . . . . : *SOURCE
Debug encryption key . . . . . . : *NONE
Output . . . . . . . . . . . . . : *PRINT
Optimization level . . . . . . . : *NONE
Source listing indentation . . . : *NONE
Type conversion options . . . . : *NONE
Sort sequence . . . . . . . . . : *HEX
Language identifier . . . . . . : *JOBRUN
Replace program . . . . . . . . : *NO
User profile . . . . . . . . . . : *USER
Authority . . . . . . . . . . . : *LIBCRTAUT
Truncate numeric . . . . . . . . : *YES
Fix numeric . . . . . . . . . . : *NONE
Target release . . . . . . . . . : *PRV
Allow null values . . . . . . . : *NO
Define condition names . . . . . : *NONE
Enable performance collection . : *PEP
Profiling data . . . . . . . . . : *NOCOL
Licensed Internal Code options . :
Generate program interface . . . : *NO
Include directory . . . . . . . :
Preprocessor options . . . . . . : *NONE
VF61 Volvo IT
5770WDS V7R3M0 160422 RN IBM ILE RPG RISHI/DCR3 VF61 19-10-30 11:10:26 Page 3
Line <---------------------- Source Specifications -----------------------------------------------------> DO CHANGE SRC SEQ
Number ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+...10 NUM DATE ID NUMBER
S o u r c e L i s t i n g
1 **free 191029 000100
2 dcl-s filename char(100); 191029 000200
3 dcl-s options(100); 191029 000300
======> dddddddabbbc
*RNF3308 20 a 000300 Keyword name is not valid; the keyword is ignored.
*RNF3308 20 b 000300 Keyword name is not valid; the keyword is ignored.
*RNF0633 20 c 000300 An unexpected right parenthesis was encountered; right
parenthesis is ignored.
*RNF3438 30 d 000300 LIKE keyword is expected for field OPTIONS but not found;
definition is ignored.
4 dcl-ds encodedExchangeToken qualified; 191030 000400
5 encodedExchangeToken char(88); 191030 000500
6 end-ds encodedExchangeToken; 191030 000600
7 OPTIONS = 'DOC=FILE CASE=ANY allowmissing=yes' 191030 000700
8 FILENAME = '/HOME/i0rs01hu/input.xml'; 191029 000800
======> aaaaaaaa
*RNF5377 20 a 000800 The end of the expression is expected.
9 XML-INTO encodedEchangeToken %XML(%TRIM(FILENAME):OPTIONS); 191029 000900
10 return; 191029 001000
11 eval *inlr = *on; 191029 001100
* * * * * E N D O F S O U R C E * * * * *
VF61 Volvo IT
5770WDS V7R3M0 160422 RN IBM ILE RPG RISHI/DCR3 VF61 19-10-30 11:10:26 Page 3
A d d i t i o n a l D i a g n o s t i c M e s s a g e s
Msg id Sv Number Seq Message text
*RNF7030 30 9 000900 The name or indicator ENCODED... is not defined.
*RNF7030 30 3 000300 The name or indicator OPTIONS is not defined.
*RNF7503 30 9 000900 Expression contains an operand that is not defined.
* * * * * E N D O F A D D I T I O N A L D I A G N O S T I C M E S S A G E S * * * * *
VF61 Volvo IT
5770WDS V7R3M0 160422 RN IBM ILE RPG RISHI/DCR3 VF61 19-10-30 11:10:26 Page 4
C r o s s R e f e r e n c e
File and Record References:
File Device References (D=Defined)
Record
No references in the source.
Global Field References:
Field Attributes References (D=Defined M=Modified)
*INLR N(1) 11M
*RNF7030 ENCODEDECHANGETOKEN...
**UNDEF** 9M
*RNF7031 ENCODEDEXCHANGETOKEN...
DS(88) 4D
*RNF7031 ENCODEDEXCHANGETOKEN...
A(88) 5D
FILENAME A(100) 2D 8 9
*RNF7030 OPTIONS **UNDEF** 3D 7M 9
Indicator References:
Indicator References (D=Defined M=Modified)
LR 11M
* * * * * E N D O F C R O S S R E F E R E N C E * * * * *
VF61 Volvo IT
5770WDS V7R3M0 160422 RN IBM ILE RPG RISHI/DCR3 VF61 19-10-30 11:10:26 Page 5
E x t e r n a l R e f e r e n c e s
Statically bound procedures:
Procedure References
No references in the source.
Imported fields:
Field Attributes Defined
No references in the source.
Exported fields:
Field Attributes Defined
No references in the source.
* * * * * E N D O F E X T E R N A L R E F E R E N C E S * * * * *
VF61 Volvo IT
5770WDS V7R3M0 160422 RN IBM ILE RPG RISHI/DCR3 VF61 19-10-30 11:10:26 Page 6
M e s s a g e S u m m a r y
Msg id Sv Number Message text
*RNF7031 00 2 The name or indicator is not referenced.
*RNF0633 20 1 An unexpected right parenthesis was encountered; right
parenthesis is ignored.
*RNF3308 20 2 Keyword name is not valid; the keyword is ignored.
*RNF5377 20 1 The end of the expression is expected.
*RNF3438 30 1 LIKE keyword is expected but not found; definition is
ignored.
*RNF7030 30 2 The name or indicator is not defined.
*RNF7503 30 1 Expression contains an operand that is not defined.
* * * * * E N D O F M E S S A G E S U M M A R Y * * * * *
VF61 Volvo IT
5770WDS V7R3M0 160422 RN IBM ILE RPG RISHI/DCR3 VF61 19-10-30 11:10:26 Page 7
F i n a l S u m m a r y
Message Totals:
Information (00) . . . . . . . : 2
Warning (10) . . . . . . . : 0
Error (20) . . . . . . . : 4
Severe Error (30+) . . . . . . : 4
--------------------------------- -------
Total . . . . . . . . . . . . . : 10
Source Totals:
Records . . . . . . . . . . . . : 11
Specifications . . . . . . . . : 10
Data records . . . . . . . . . : 0
Comments . . . . . . . . . . . : 0
* * * * * E N D O F F I N A L S U M M A R Y * * * * *
Compilation stopped. Severity 30 errors found in program.
* * * * * E N D O F C O M P I L A T I O N * * * * *
VF61 Volvo IT
**free
dcl-s filename char(100);
dcl-s options(100);
dcl-ds encodedExchangeToken qualified;
encodedExchangeToken char(88);
end-ds encodedExchangeToken;
OPTIONS = 'DOC=FILE CASE=ANY allowmissing=yes'
FILENAME = '/HOME/i0rs01hu/input.xml';
XML-INTO encodedEchangeToken %XML(%TRIM(FILENAME):OPTIONS);
return;
eval *inlr = *on;
As an Amazon Associate we earn from qualifying purchases.