Thanks everyone for your comments.
I did put this to devsup as well and with help from Dan Ell & Dan
Klein, a more elegant solutions was found.
Thanks for both of them as well.
see below.
Dan Ell's First offered this solution using an I descriptor
001 I
002 DCOUNT(@RECORD<1>,’,’)
003
004 Commas in 1
005 8R
001 I
002 DCOUNT(@RECORD<3>,@VM)
003
004 VM in 3
005 8R
This didn't work for me first time (as DCOUNT subroutine doesn't exist
on jBASE 3.x, Dan thought i was running jb4/5)
Dan Klein, then kindly suggested all i needed to do was to create the
DCOUNT sub, and catalog it so it would be available system-wide
001 SUBROUTINE DCOUNT(result, param1, param2)
002 result = DCOUNT(param1, param2)
003 RETURN
This did the trick nicely....
Over to Jim's point.
Im sorry, but with respect, i think you've got completely wrong end of
the stick.
If i was storing information for db purposes it would be a terrible
model, the fact is, i was storing it as a quick dirty report i needed
(that i was too lazy to write another program for, when i just wanted
a quick ref count on how many MVs i had from each key. (ie the
majority would be a count of 1 and a small few would be > 1), i would
simply then select the keys > 1 and see what sort of data set i was
dealing with.
I put the commas count eg in as literally an example (be it a very bad
example in hindsight) - nothing else.
I would never store multiple values separated by commas in a data
model. (even if i did, i wouldn't be silly to mention it on this a
board)...
Thanks for your reply though, a always enjoy reading your posts :)
Charlie, i found an excellent 4 page pdf (scrapped off the spectrum
website years ago), which describes in detail all the DICTs & ACCESS
commands (similar to JQL). It lists all TCL commands and uses of
correlatives (for A types not I)
If anyone would like a copy of it, let me know and i can put it on a
public dropbox link.
Ian
On Jul 20, 3:20 am, Charlie Noah <
cwn...@comcast.net> wrote:
> Hi Jim,
> It's been a while!
> For the most part you are correct. However, it could be useful to count csv values within an attribute (we're dealing with csv more and more), and it obviously can be useful to know how many multivalues there are. I don't know how many times I've run across definitions that don't take a null attribute into account. Besides, most of us work with systems we've inherited, and which may not have been real well designed in the first place. Many were built by users who found Multivalue based environments so easy to build things in that they considered them developers, even though they were not at all qualified. We still have to work with them, though, and I don't know about you, but I'm getting too old and tired to redesign every system I run across.:-P
> Besides, the OP asked for a technical solution to a specific need, not describing the overall scenario, and that's what he got.
> It's a shame Jbase didn't incorporate DCOUNT into JQL (perhaps by now it has).
> Best,
> Charlie
> On 07-19-2011 6:02 PM, Jim Idle wrote:
>
> Actually, woah mule, woah mule!!!
>
>
>
>
>
>
>
> 1. The fact that it is awkward to do should be telling you something.
>
>
>
> 2. It should be telling you that your data model is completely screwed up.
>
>
>
> 3. In the MV model, the separators are AM, VM and SVM.
>
>
>
> 4. If you have comma separated values in an attribute mark, then it means you have utterly disregarded the MV data model
>
>
>
> 5. You should have multivalues.
>
>
>
> 6. You should correlate them if order is important.
>
>
>
> 7. Now you find you must count the commas because you are ignoring the data model and have set out down the path to a terribly organized database.
>
>
>
> 8. However, don’t feel so...
>
> read more »