I just wanted to suggest Debug to you as an alternative to using wdinfo all through your code - see Studio|Labs|Debug.
Sometimes writing to a log file or using wdinfo is the only option, but I find Debug much easier, more informative & less intrusive than those methods. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of PackRat > Sent: Monday, 25 February 2008 08:55 > To: Programming forum > Subject: Re: [Jprogramming] Beg Q--what am I doing wrong in > this select/case? > > Thanks, Bill, for your suggestions! However, I could get > none of them > to work correctly. > > I have simplified my select/case examples to the following two, a > numeric match and a literal match: > > select6 =: 3 : 0 NB. seek numeric match > opID =: 6 > select. opID > wdinfo 'val:'; opID > wdinfo 'shape:'; ($opID) > wdinfo 'datatype:'; (3!:0 opID) > case. 1;2;3 do. > wdinfo 'case 1,2,3'; opID > case. 4;5;6 do. > wdinfo 'case 4,5,6'; opID > case. do. > wdinfo 'no case match'; '' > end. > ) > > select6a =: 3 : 0 NB. seek literal match > opID =: '6' > select. opID > wdinfo 'val:'; opID > wdinfo 'shape:'; ($opID) > wdinfo 'datatype:'; (3!:0 opID) > case. '1';'2';'3' do. > wdinfo 'case 1,2,3'; opID > case. '4';'5';'6' do. > wdinfo 'case 4,5,6'; opID > case. do. > wdinfo 'no case match'; '' > end. > ) > > Invoking select6'' and select6a'' , neither of these two functions > seem to match correctly--they both report "no case match". What am I > missing about matching values in J? > > By the way, in my original script the value of the first > argument (the > one passed to a function containing select/case) was the > literal value > '6' extended to 11 characters via fill (to match the other boxed > argument values). This means the literal value '6 ' > (that's 6 > followed by 10 spaces, in case it's mangled in email) is passed to my > original DoFileRead function. How does one "trim" all trailing (or, > for that matter, leading) spaces from text/literal values so > that they > can be used for matching in select/case (and other) situations? > (Perhaps this "extended" literal caused some other problems in my > original matching attempt besides what I'm asking about above.) > > Thanks to everyone for any insights, explanations, and guidance to > documentation! ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
