Not sure this is going down the wrong path. Within a stored procedure you can have a SELECT which builds the tags around the data values and produce a result set.
SELECT '<Name>' || name || '</Name><Age>' || age || ......
FROM table
WHERE ....
You can also use system tables to build a select statement dynamically to pull the columns and data. I'm familiar with doing that within UDB but not sure about the mainframe.
Quote:
Originally posted by maxdp
Hi,
I'm trying to tag field values with the field names after extracting records from a DB2 table. Does anyone know how to extract the column names along with the column values from the table - is it possible using a function or a statement?
eg.
Customer (Name of table)
Name Age Sex Location
Don 28 M US
Jane 21 F UK
I have to extract each customer record and tag the values as follows:
<Name>Don<\Name><Age>28<\Age><Sex>M<\Sex><Location >US<\Location>
<Name>Jane<\Name><Age>21<\Age><Sex>F<\Sex><Locatio n>UK<\Location>
Would appreciate anyone's help with this.
Thanks,
Maxdp
*****
|