RPGIV @ Work

A unique site for RPG and System i Lovers

Welcome!

Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

Rules for transferring XML data to RPG variables Print E-mail
User Rating: / 0
PoorBest 
Written by Chamara   
  • For integer, unsigned, decimal (packed, zoned, binary) and float fields , the data will be transferred using the same rules as RPG uses for %INT, %UNS, %DEC, %FLOAT for respectively. %INTH, %UNSH and %DECH will be used if the Half-Adjust operation extender is specified on the XML-INTO operation code.
  • For date, time and timestamp fields, the data will be transferred using the same rules as RPG uses for %DATE, %TIME and %TIMESTAMP respectively. The format defaults to *ISO with separators. The format may be specified by an attribute fmt in the element. The value of the attribute must be one of the valid formats for the respective built-in function; the leading asterisk is optional. For formats that allow more than one separator in RPG, the separator defaults to the RPG default separator for the format. For example, for a date field, the following XML fragments are valid:
    <myDate fmt="DMY/">25/12/04</myDate>   <!-- 2004-12-25 -->
    <myDate fmt="Dmy">25.12.04</myDate>    <!-- 2004-12-25 -->
    <myDate fmt="*cymd0">0971123</myDate>  <!-- 1997-11-23 -->
  • For indicator, character and UCS-2 fields, data will be transferred with appropriate CCSID conversion if necessary. Fixed-length fields will be assigned left-adjusted by default. The adjustment can be specified by an attribute adjust in the element, with a value of either "left" or "right". For example, if the RPG variable data is 10 bytes long, the following XML data will cause the value of DATA to be set to '     abcde'.
    <data adjust="right">abcde</data>
  • For graphic fields, data will be transferred using the same rules as the %GRAPH built-in function, with appropriate CCSID conversion if necessary. Fixed-length fields will be assigned left-adjusted by default. The adjustment can be specified by an attribute adjust in the element, with a value of either "left" or "right".
  • Pointer and procedure-pointer subfields are not supported, and are ignored by the XML-INTO operation.
  • The special attributes fmt and adjust will be treated as ordinary attributes if they are not relevant to the assignment of the matching variable, or if the value of the attribute is not valid. For example, the following XML attributes would be treated as ordinary XML attributes:
    'fmt="abc"'
    "abc" is not a valid format
    'adjust=yes'
    "yes" is not a valid value for the "adjust" attribute
    'fmt="mdy/"', if specified for a numeric field
    'adjust=right', if specified for a varying-length field
  • The attributes fmt and adjust and their values must be specified in the case specified by the case option. The following table shows valid examples of the attributes for each value of the case option.
case option fmt, example "*MDY/" adjust, example "right"
not specified
fmt="mdy/"
fmt="*mdy/"
adjust="right"
'case=lower'
fmt="mdy/"
fmt="*mdy/"
adjust="right"
'case=upper'
fmt="MDY/"
fmt="*MDY/"
ADJUST="RIGHT"
'case=any'
Fmt="Mdy/"
FMT="*mDY/"
and so on
Adjust="Right"
adjust="RIGHT"
and so on
<Previous   Next>