MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

XML Generate and attributes

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 618
Topics: 172
Location: Stockholm, Sweden

PostPosted: Tue Dec 21, 2021 11:54 am    Post subject: XML Generate and attributes Reply with quote

Let's start off with what I would like to generate (note that the formatting is just to make it more readable)

Quote:

<Amt>
<InstdAmt Ccy="SEK">123.00</InstdAmt>
</Amt>

I thjnk I have tried almost every example of the definitions and the XML generate variations there are. Here is the nearest I can get to it
Code:

01  Amt-1.                                       
    05  InstdAmt-1.                               
         10  Ccy-1                      pic x(3).     

and (the commented lines just show my various attempts that didn't work)
Code:

     move ' ' to doc                         
     move 123    to InstdAmt-1               
     move 'SEK' to CCY-1                     
     XML Generate Doc from amt-1             
*                         with attributes   
         type ccy-1      is attribute       
*         type InstdAmt-1 is content         
     end-xml                                 


The result of this generate gives
Quote:

<Amt-1><InstdAmt-1 Ccy-1="SEK"></InstdAmt-1>
</Amt-1>

So I'm getting the ccy-1 attribute generated correctly,
but what I can't achieve is to get the value 123 "imbedded" into the InstdAmt-1 tag.

Any suggestions ?
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Tue Dec 21, 2021 7:08 pm    Post subject: Re: XML Generate and attributes Reply with quote

misi01 wrote:

So I'm getting the ccy-1 attribute generated correctly,
but what I can't achieve is to get the value 123 "imbedded" into the InstdAmt-1 tag.

Any suggestions ?


misi01,

Is this a trick question? InstdAmt-1 is defined as a Group item with Ccy-1 as the ONLY element in it.

And you moved 123 to group item InstdAmt-1 which is pretty much moving '123' to CCY-1. And then again you moved 'sek1' to CCY-1 which over writes the previous move.

Did you really mean InstdAmt-1 to be a group item?
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 618
Topics: 172
Location: Stockholm, Sweden

PostPosted: Wed Dec 22, 2021 3:46 am    Post subject: Reply with quote

No, it's not a trick question, though I can understand why you ask.
It's like I've said before in this forum, when something doesn't work, is it because I'm doing it wrong, or because it simply will never work.

After even more experimentation, this was what did the trick
Code:

*                                           
 01  Amt.                                   
     05  InstdAmt.                           
         10  InstdAmt-content    pic 999.   
         10  Ccy                 pic x(3).   
*                                           

and
Code:

           move ' '                    to doc               
           move 111                    to InstdAmt-content 
           move 'SEK'                  to CCY               
      *                                                     
           XML Generate Doc          from amt               
               type  ccy               is attribute         
                     InstdAmt-content  is content           
           end-xml                                         

The end result was what I wanted
Quote:
<Amt><InstdAmt Ccy="SEK">111</InstdAmt></Amt>

It's all about the W-S definitions and the TYPE usage in the XML generate.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group