How do you loop over a multi-dimensional string?
collectionNames[cna] = 'Spherical Cluster' collectionNames[cna,collId] = collName loop "something" over collectionNames only provides this below and it does not seem to allow other notation. ====================================== Cluster xuex12|ICAB505-SEQ00012|Backends = Spherical Cluster Cluster xuex12|ICAB505-SEQ00012|SKF = Spherical Cluster Cluster xuex12|ICAB505-SEQ00012|N1 = Spherical Cluster Cluster xuex12|ICAB505-SEQ00012|EJB = Spherical Cluster Cluster xuex12|ICAB505-SEQ00012|JMS = Spherical Cluster Mike Measel Sr. Director Emerging Technologies CA Wily Technology Division Plano, TX 214-680-6549 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20080716/d78808bd/attachment-0001.html |
Unfortunately there is no documentation of how to use multilevel indexed
variables in a practical way. You have to develop your own code to copy or update them. When I ran into this problem, some experimentation gave me the following technique: chmods=mods[book] loop ch over chmods newmods[book,ch]=mods[book,ch] end While this gives you a second level index over the variable, I am crossing my fingers that it does not make a duplicate copy of the entire database! Anyone else know what this does? -- Kermit Kiser Measel, Mike wrote: > > How do you loop over a multi-dimensional string? > > > > collectionNames[cna] = 'Spherical Cluster' > > collectionNames[cna,collId] = collName > > > > loop "something" over collectionNames only provides this below and it > does not seem to allow other notation. > > > > ====================================== > > Cluster xuex12|ICAB505-SEQ00012|Backends = Spherical Cluster > > Cluster xuex12|ICAB505-SEQ00012|SKF = Spherical Cluster > > Cluster xuex12|ICAB505-SEQ00012|N1 = Spherical Cluster > > Cluster xuex12|ICAB505-SEQ00012|EJB = Spherical Cluster > > Cluster xuex12|ICAB505-SEQ00012|JMS = Spherical Cluster > > > > Mike Measel > > Sr. Director Emerging Technologies > > CA Wily Technology Division > > Plano, TX > > 214-680-6549 > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > > An HTML attachment was scrubbed... URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20080716/b87786dd/attachment.html |
In reply to this post by measel
Hi,
I don't know if this helps, but I think that 'over' can be taken as referring to the next available index after the one specified in the loop statement, so I use a nested loop structure, just like accessing a more conventional multidimensional array. I'm not sure if this is what you were after? (And apologies if I've misunderstood the problem!) Philip ------------- CODE ----------------- -- set default value person = '' -- set first index values person['Tom'] = 'TOM' person['Dick'] = 'DICK' person['Harry'] = 'HARRY' -- set second index values person['Tom', 'surname'] = 'BROWN' person['Tom', 'sex'] = 'M' person['Tom', 'age'] = '33' person['Dick', 'surname'] = 'WHITTINGTON' person['Dick', 'sex'] = 'M' person['Dick', 'age'] = '22' person['Harry', 'surname'] = 'HORSE' person['Harry', 'sex'] = 'M' person['Harry','age'] = '25' -- show values loop firstindex over person loop secondindex over person[firstindex] say 'person ' person[firstindex] ' has ' secondindex': ' person[firstindex, secondindex] end end ----------- OUTPUT ----------------- person DICK has surname: WHITTINGTON person DICK has age: 22 person DICK has sex: M person TOM has surname: BROWN person TOM has age: 33 person TOM has sex: M person HARRY has surname: HORSE person HARRY has age: 25 person HARRY has sex: M ------------------------------------- Philip Warren Dept Animal and Plant Sciences University of Sheffield Sheffield S10 2TN, UK On 16 Jul 2008, at 14:30, Measel, Mike wrote: > How do you loop over a multi-dimensional string? > > > > collectionNames[cna] = 'Spherical Cluster' > > collectionNames[cna,collId] = collName > > > > loop "something" over collectionNames only provides this below and it > does not seem to allow other notation. > > > > ====================================== > > Cluster xuex12|ICAB505-SEQ00012|Backends = Spherical Cluster > > Cluster xuex12|ICAB505-SEQ00012|SKF = Spherical Cluster > > Cluster xuex12|ICAB505-SEQ00012|N1 = Spherical Cluster > > Cluster xuex12|ICAB505-SEQ00012|EJB = Spherical Cluster > > Cluster xuex12|ICAB505-SEQ00012|JMS = Spherical Cluster > > > > Mike Measel > > Sr. Director Emerging Technologies > > CA Wily Technology Division > > Plano, TX > > 214-680-6549 > > > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > |
Philip, yes this is what I was after. Thank you.
-----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Philip Warren Sent: Thursday, July 17, 2008 9:03 AM To: IBM Netrexx Subject: Re: [Ibm-netrexx] loop over question Hi, I don't know if this helps, but I think that 'over' can be taken as referring to the next available index after the one specified in the loop statement, so I use a nested loop structure, just like accessing a more conventional multidimensional array. I'm not sure if this is what you were after? (And apologies if I've misunderstood the problem!) Philip ------------- CODE ----------------- -- set default value person = '' -- set first index values person['Tom'] = 'TOM' person['Dick'] = 'DICK' person['Harry'] = 'HARRY' -- set second index values person['Tom', 'surname'] = 'BROWN' person['Tom', 'sex'] = 'M' person['Tom', 'age'] = '33' person['Dick', 'surname'] = 'WHITTINGTON' person['Dick', 'sex'] = 'M' person['Dick', 'age'] = '22' person['Harry', 'surname'] = 'HORSE' person['Harry', 'sex'] = 'M' person['Harry','age'] = '25' -- show values loop firstindex over person loop secondindex over person[firstindex] say 'person ' person[firstindex] ' has ' secondindex': ' person[firstindex, secondindex] end end ----------- OUTPUT ----------------- person DICK has surname: WHITTINGTON person DICK has age: 22 person DICK has sex: M person TOM has surname: BROWN person TOM has age: 33 person TOM has sex: M person HARRY has surname: HORSE person HARRY has age: 25 person HARRY has sex: M ------------------------------------- Philip Warren Dept Animal and Plant Sciences University of Sheffield Sheffield S10 2TN, UK On 16 Jul 2008, at 14:30, Measel, Mike wrote: > How do you loop over a multi-dimensional string? > > > > collectionNames[cna] = 'Spherical Cluster' > > collectionNames[cna,collId] = collName > > > > loop "something" over collectionNames only provides this below and it > does not seem to allow other notation. > > > > ====================================== > > Cluster xuex12|ICAB505-SEQ00012|Backends = Spherical Cluster > > Cluster xuex12|ICAB505-SEQ00012|SKF = Spherical Cluster > > Cluster xuex12|ICAB505-SEQ00012|N1 = Spherical Cluster > > Cluster xuex12|ICAB505-SEQ00012|EJB = Spherical Cluster > > Cluster xuex12|ICAB505-SEQ00012|JMS = Spherical Cluster > > > > Mike Measel > > Sr. Director Emerging Technologies > > CA Wily Technology Division > > Plano, TX > > 214-680-6549 > > > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > _______________________________________________ Ibm-netrexx mailing list [hidden email] |
Free forum by Nabble | Edit this page |