dbTalk Databases Forums  

Multiple Values within Multi-Value Fields...

comp.databases.pick comp.databases.pick


Discuss Multiple Values within Multi-Value Fields... in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Russ
 
Posts: n/a

Default Multiple Values within Multi-Value Fields... - 07-19-2005 , 04:43 PM






I'm currently working at creating a new data item and am stuck on this
one issue:

The data field that I am trying to get at is in the CM table and looks
like this:

022
\041-30-0374B\4\,,,,,,,11810]105\R02732988\4\89860]\041300374\4\89860

So there are two values (separated by the "]", but then each one has
multiple values separated by "\" and even some of those have multiple
values separated by the ","!

So I created a data item in the IC table that looks like this:

001 S
002 3
003 SECONDARY INS
004
005
006
007
008 TCM;X2:22:22
009 L
010 30

which should select the second data item from the CM table and that
gives me the following output:

IC........ SECONDARY INS.....

1575154 105
R02732988
4
89860

You will notice that instead of keeping the items separated by a "\",
the program translated it into a carraige return (it's not just the
length of the field - I've already tried that). So I was going to add
this to the field:

008 TCM;X2:22:22]G1\1

Trying to get at that second value (R02732988), but no dice.

Any suggestions?

Thanx,

Russ


Reply With Quote
  #2  
Old   
Peter McMurray
 
Posts: n/a

Default Re: Multiple Values within Multi-Value Fields... - 07-19-2005 , 05:31 PM






Hi Russ
You are looking at multi sub values CHAR(252) is the separator and you will
need to write some basic to extract them easily.
Peter McMurray
"Russ" <rscribner (AT) data-tx (DOT) com> wrote

Quote:
I'm currently working at creating a new data item and am stuck on this
one issue:

The data field that I am trying to get at is in the CM table and looks
like this:

022
\041-30-0374B\4\,,,,,,,11810]105\R02732988\4\89860]\041300374\4\89860

So there are two values (separated by the "]", but then each one has
multiple values separated by "\" and even some of those have multiple
values separated by the ","!

So I created a data item in the IC table that looks like this:

001 S
002 3
003 SECONDARY INS
004
005
006
007
008 TCM;X2:22:22
009 L
010 30

which should select the second data item from the CM table and that
gives me the following output:

IC........ SECONDARY INS.....

1575154 105
R02732988
4
89860

You will notice that instead of keeping the items separated by a "\",
the program translated it into a carraige return (it's not just the
length of the field - I've already tried that). So I was going to add
this to the field:

008 TCM;X2:22:22]G1\1

Trying to get at that second value (R02732988), but no dice.

Any suggestions?

Thanx,

Russ




Reply With Quote
  #3  
Old   
Dave Weaver
 
Posts: n/a

Default Re: Multiple Values within Multi-Value Fields... - 07-19-2005 , 06:21 PM



Peter McMurray is right. Here is more on the subject.

Attributes = Fields. Separator is CHAR(254), an attribute mark.
Values = Fields within Attributes. Separator is CHAR(253), a value
mark. Typically known as "multivalues", especially where there are two
or more Values within an Attribute.
Sub-Values = Fields within Values. Separator is CHAR(252), a sub-value
mark.

AQL, Access, English, Retrieve, Info-Access or whatever you know it as,
does not handle Sub-Values very well if at all. Peter is right -- you
need to use Basic to handle Sub-Values properly.

Sub-values do have their usefulness if used very carefully with the
knowledge that only Basic handles them well. Most programmers and
database design analysts avoid Sub-values unless absolutely necessary.

Then, there are those hot-shots that further divide Sub-Values into
even smaller sub-fields by using their own separators. Not a good idea
at all! Badly designed databases are a terrible mess to try to work
with IMHO.

Dave Weaver, Weaver Consulting

Peter McMurray wrote:
Quote:
Hi Russ
You are looking at multi sub values CHAR(252) is the separator and you will
need to write some basic to extract them easily.
Peter McMurray
"Russ" <rscribner (AT) data-tx (DOT) com> wrote in message
news:1121809413.091318.312950 (AT) g49g2000cwa (DOT) googlegroups.com...
I'm currently working at creating a new data item and am stuck on this
one issue:

The data field that I am trying to get at is in the CM table and looks
like this:

022
\041-30-0374B\4\,,,,,,,11810]105\R02732988\4\89860]\041300374\4\89860

So there are two values (separated by the "]", but then each one has
multiple values separated by "\" and even some of those have multiple
values separated by the ","!

So I created a data item in the IC table that looks like this:

001 S
002 3
003 SECONDARY INS
004
005
006
007
008 TCM;X2:22:22
009 L
010 30

which should select the second data item from the CM table and that
gives me the following output:

IC........ SECONDARY INS.....

1575154 105
R02732988
4
89860

You will notice that instead of keeping the items separated by a "\",
the program translated it into a carraige return (it's not just the
length of the field - I've already tried that). So I was going to add
this to the field:

008 TCM;X2:22:22]G1\1

Trying to get at that second value (R02732988), but no dice.

Any suggestions?

Thanx,

Russ



Reply With Quote
  #4  
Old   
Russ
 
Posts: n/a

Default Re: Multiple Values within Multi-Value Fields... - 07-19-2005 , 11:29 PM



Thanks for the quick replies - I still a newbie at writing basic - I
think I understand how to extract the data - but how do you reference
the basic program in the tfile statement, and how does the value get
returned....

Thanx,

Russ


Reply With Quote
  #5  
Old   
Dave Mitchell
 
Posts: n/a

Default Re: Multiple Values within Multi-Value Fields... - 07-20-2005 , 01:30 AM



Hi Russ,

You'll want a subroutine that looks something like this:

SUBROUTINE GET.SECONDARY.INS(outp,inp)
outp = inp<1,2,2>
RETURN

where inp is attribute <22> of the file, and outp is what you want to
return. The parameters MUST be in that order (ie, the RETURNed parameter
must be the first in the argument list, with anything else used for the
calculation coming after)

Once that program is written, compile and catalog it.

In your dictionary for the file (you referred to it as the IC table, I
believe), you want an I-Descriptor as follows:

0001: I
0002: SUBR('GET.SECONDARY.INS',@RECORD<22>)
0003:
0004: SECONDARY INS
0005: 30L

An explanation:
Field <1> is the letter I, which means this will be an I-Descriptor
Field <2> tells the system this will be calling a program. The program
name, in quotes, must be the first argument, and any input arguments to the
subroutine come after
Field <4> is the column title
Field <5> is the length and justification

Field <3> can hold a conversion, if you so desire. If there is nothing in
this field, the results of the subroutine will be displayed exactly as they
are returned.


Once done, compile the I-Descriptor with the CD command:

CD CM

where CM is your filename.

I should note that this will work for UniVerse. I'm not very familiar with
the other platforms (D3, etc), so if you're using one of those, this may not
work (but it should be pretty close....)

Dave


"Russ" <rscribner (AT) data-tx (DOT) com> wrote

Quote:
Thanks for the quick replies - I still a newbie at writing basic - I
think I understand how to extract the data - but how do you reference
the basic program in the tfile statement, and how does the value get
returned....

Thanx,

Russ




Reply With Quote
  #6  
Old   
frosty
 
Posts: n/a

Default Re: Multiple Values within Multi-Value Fields... - 07-20-2005 , 10:29 AM



Russ wrote:
Quote:
I'm currently working at creating a new data item and am stuck on this
one issue:

The data field that I am trying to get at is in the CM table and looks
like this:

022
\041-30-0374B\4\,,,,,,,11810]105\R02732988\4\89860]\041300374\4\89860

So there are two values (separated by the "]", but then each one has
multiple values separated by "\" and even some of those have multiple
values separated by the ","!

So I created a data item in the IC table that looks like this:

001 S
002 3
003 SECONDARY INS
004
005
006
007
008 TCM;X2:22:22
009 L
010 30
I notice you have colons instead of semicolons... is this a typo?
You want TCM;X2;;22 -- you can eliminate the first 22 because
it's for input conversion, not output conversion.

--
frosty




Reply With Quote
  #7  
Old   
Russ
 
Posts: n/a

Default Re: Multiple Values within Multi-Value Fields... - 07-20-2005 , 12:12 PM



Once again, thank you for your time on this. I have tried to implement
what you said, but I think there is still one thing I don't understand.
I am trying to create the I code in the IC table (attribute 3) - from
which I reference a record in the CM table (attribute 22), can I still
do this with a subroutine? I'm assuming the file would look something
like this:

0001: I
0002: SUBR('GET.SECONDARY.INS',@RECO*RD<3>,TCM;X2;22;22)
0003:
0004: SECONDARY INS
0005: 30L

but I just get an error "TCM syntax error", am I on the wrong track?

Thanx,

Russ


Reply With Quote
  #8  
Old   
Dave Mitchell
 
Posts: n/a

Default Re: Multiple Values within Multi-Value Fields... - 07-20-2005 , 12:35 PM



You shouldn't need the ,TCM;X2;22;22 as an argument for the SUBR command.
The code in the 'GET.SECONDARY.INS' subroutine should take care of
everything you need. (If you weren't using an I-Descriptor, you would use
TCM..., but as mentioned in previous posts, it doesn't handle
multi-sub-values too well.)

Also, are you using UniVerse to do this? This method may not work for
Unidata, D3, jBase, etc. If you're using something other than UniVerse, I'd
imagine the method would be similar, but someone else will have to jump in
with more detailed info.

Dave

"Russ" <rscribner (AT) data-tx (DOT) com> wrote

Once again, thank you for your time on this. I have tried to implement
what you said, but I think there is still one thing I don't understand.
I am trying to create the I code in the IC table (attribute 3) - from
which I reference a record in the CM table (attribute 22), can I still
do this with a subroutine? I'm assuming the file would look something
like this:

0001: I
0002: SUBR('GET.SECONDARY.INS',@RECO*RD<3>,TCM;X2;22;22)
0003:
0004: SECONDARY INS
0005: 30L

but I just get an error "TCM syntax error", am I on the wrong track?

Thanx,

Russ



Reply With Quote
  #9  
Old   
Russ
 
Posts: n/a

Default Re: Multiple Values within Multi-Value Fields... - 07-20-2005 , 04:26 PM



I am using UniVerse - but I don't see how to reference the second table
(CM) if I am creating the I-Descriptor in the primary table (IC).

If "0002: SUBR('GET.SECONDARY.INS',@RECO*RD<3>) " sends the value of
attribute 3 of the IC Table (which is the key field in the CM table)
then "inp" in the subroutine will be that key - but how do I use that
to access the information in the CM table?


Reply With Quote
  #10  
Old   
murthi
 
Posts: n/a

Default Re: Multiple Values within Multi-Value Fields... - 07-20-2005 , 04:50 PM



If you're going to use I-descriptors, why go to the trouble of a subroutine
at all, especially for such simple stuff?

ED DICT IC WHATEVER

WHATEVER
001 I
002 (TRANS('CM', @RECORD<3>, 22, 'C'))<1,2,2>
003 ....etc

should do it, no (assuming I got the syntax right)?

Chandru Murthi

"Russ" <rscribner (AT) data-tx (DOT) com> wrote

I am using UniVerse - but I don't see how to reference the second table
(CM) if I am creating the I-Descriptor in the primary table (IC).

If "0002: SUBR('GET.SECONDARY.INS',@RECO*RD<3>) " sends the value of
attribute 3 of the IC Table (which is the key field in the CM table)
then "inp" in the subroutine will be that key - but how do I use that
to access the information in the CM table?



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.