ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

NULL, DC4 and DC2 STMF characters

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

  • NULL, DC4 and DC2 STMF characters

    I am trying to get some XML files written to the IFS using the C APIs from this article Programmers Sample Guide: Generate XML using RPGLE with help of C language API’ s Part 5 (mysamplecode.com) However, after putting in some test data, the STMF has some characters in it. Attached is the code and a text version of the STMF.

    I would like this issue figured out before I try and start putting in data from a couple of tables.

    Attached Files

  • #2
    %xml is a varchar, when you code
    Code:
    %addr($xml)
    it gives a pointer to the length part of the variable
    Code:
    %addr($xml:*data)
    points to the content

    By the way, varchars are helpfull because they keep track of the length of data, using
    Code:
    %len(%trim(a varchar))
    is just a %trim too much

    So in the end
    Code:
    write($fd: %addr($xml): %len(%trim($xml)));
    should be
    Code:
    write($fd: %addr($xml:*data): %len($xml));
    Nicolas

    Comment


    • #3
      Nicolas, Thank you so much. It is taking a lot for me to learn this language. Have to keep remembering this system architecture is as old as I am.

      Comment

      Working...
      X