Hi Charles, Thanks a lot for your help and explanation. Know, I understand the use of the "@MV" in an I-descriptor. In my case, I can't use a BY-EXP clause because I'm working with SQL statements sent through ODBC to Universe.
Finally, I made the modifications suggested by Manu Fernandes in my subroutine and it works fine. I was just dreaming about a way of defining an I-descriptor without any modification in my subroutine (also used in a Pick correlative) :-( Best regards, Vincent MASSON Infodata Sarl Tel : (352) 33 16 48 Fax : (352) 33 75 55 -----Message d'origine----- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Stevenson, Charles Envoyi : mercredi 9 mars 2005 0:00 @ : [email protected] Objet : RE: [U2] I-Type and Assoc Vincent, I am not sure why you get a one character answer one way and a full word the other. I assume that's either in the nature of how your SQ_CAL_SUB is written & called, or from formatting applied differently in the 2 methods. I think we need more context. Manu Fernandes seems to be assuming the former. Stipulating that, I have some comments interspersed below. cds -----Original Message----- From: Manu Fernandes > Inside a I-Type; SUBR is called only one time. The first. I think Manu means an I-descriptor, not SUBR(), is evaluated once per _record_, not for each value in the association. That is the nature of I-descriptors, regardless of whether SUBR() is invoked. It is both the beauty and bane of I-descriptors. It is a (the?) major distinction between them and pick-correlatives. In your case, the I-descriptor has 2 SUBR() calls in it. Both will be called, but the whole I-descriptor will only be evaluated once per record. The exception is if you are processing an active "exploded" list, i.e. one that has been generated by SELECT . . . WHEN mv-field condition . . . BY.EXP mv-field . . . then each line of such a list contains id & particular value number. That is what populates @MV for your I-desc to process. The I-descriptor will be evaluated once for each entry in the active select list. A record with many values might be in the list many times, once per value. Perhaps this is why you get different results. One way you are processing an exploded list and the other way you are not? > You need to return a mv'ed dynamic array. > That the reason why there is many functions to manage mv'ed field. > Functions are usually postfixed by S like CHAR and CHARS. > > You must have : > SUBR('SQ_CAL_SUB','GQ.COD.TAB',@RECORD<3>:'|':'TMDEFN':'|':'CT.ES'); > SUBR('SQ_CAL_SUB','OEM2ANSI',@1) Manu has removed your @MV from @RECORD<3,@MV>. ( Humour me. Let's also simplify: ) ( '|':'TMDEFN':'|':'CT.ES' ) ( which is really one constant: ) ( '|TMDEFN|CT.ES' ) Applying the MV functions that Manu suggests, you would change SUBR('SQ_CAL_SUB','GQ.COD.TAB',@RECORD<3>:'|':'TMDEFN':'|':'CT.ES'); SUBR('SQ_CAL_SUB','OEM2ANSI',@1) into CATS( @RECORD<3>,REUSE('|TMDEFN|CT.ES')); SUBR('SQ_CAL_SUB','GQ.COD.TAB',@1); SUBR('SQ_CAL_SUB','OEM2ANSI',@2) For UniData I think it is: SUBR('-CATS',@RECORD<3>,REUSE('|TMDEFN|CT.ES')); SUBR('SQ_CAL_SUB','GQ.COD.TAB',@1); SUBR('SQ_CAL_SUB','OEM2ANSI',@2) If I have only muddied the waters please ask, either on- or off-list, for clarification or tell me to go away. Don't give up. Chuck Stevenson ------- u2-users mailing list [email protected] To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list [email protected] To unsubscribe please visit http://listserver.u2ug.org/
