ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

XML-into procedure cuts a 18- character variable

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML-into procedure cuts a 18- character variable

    Hi, I am using XML-into to parse 18- character variable to qualified data structure with array. But I receive only 16 first characters and 2 last characters blanks. How to fix that?

    DSLines ds QUALIFIED
    E1EDL24 dim(30) likeds(E1EDL24_DS)
    E1EDL24_DS ds QUALIFIED
    M1 18a

    I have M1 in XML like this : <M1>000000000001247937</M1>

    And in ILE program , after parsing in debug I get

    DSLINES.E1EDL24.M1(1) = '0000000000012479 '

  • #2
    There's something other than XML-INTO causing this issue. This code works and I get all 18 characters.
    Code:
           Dcl-ds DSLines QUALIFIED;
             Dcl-ds E1EDL24 dim(30);
               M1 Char(18);
             End-ds;
           End-Ds;
    
           Dcl-ds  progStatus PSDS;
             xmlElements  Int(20) Pos(372);
           End-ds;
    
           dcl-s xmlData char(256)
              Inz('<X><E1EDL24><M1>000000000001247937</M1></E1EDL24></X>');
    
           xml-into  DSLINES.E1EDL24
              %XML( xmlData: 'case=any');
    
           dsply ('Count is ' + %char(xmlElements) );
           dsply ('Value of M1 is ' + DSLINES.E1EDL24(xmlElements).M1 );
    
           *InLr = *On;
    Try this exact code on your box and see what happens. If you get the same error here then you must have a PTF or something missing.

    If my code works correctly then I can only suspect that you have a DS definition error that is perhaps causing field overlap or something?

    Comment

    Working...
    X