IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to specify attributes inside an attribute?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Satyajit

New User


Joined: 25 Jan 2006
Posts: 27

PostPosted: Fri Aug 04, 2006 8:29 pm
Reply with quote

can i define the layout of the attribute inside a row?

ie MERCHANT_ADDRESS in the table below consists of the following fields.
How should i craeate the table? can i specify it in MERCHANT_ADDRESS field.

MERCHANT TABLE DETAILS

MERCHANT_ID CHAR(5) PRIMARY KEY
MERCHANT_NAME CHAR(10)
MERCHANT_ADDRESS CHAR(40)

(MERCHANT_ADDRESS CONSISTS OF

MERCHANT_STREET CHAR(15)
MERCHANT_CITY CHAR(10)
MERCHANT_STATE CHAR(10)
MERCHANT_ZIP CHAR(5) )
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Fri Aug 04, 2006 8:59 pm
Reply with quote

You cannot redefine a column like that. Why would you not want to either define the table as :

MERCHANT_ID CHAR(5) PRIMARY KEY
MERCHANT_NAME CHAR(10)
MERCHANT_ADDRESS CHAR(40)

or

MERCHANT_ID CHAR(5) PRIMARY KEY
MERCHANT_NAME CHAR(10)
MERCHANT_STREET CHAR(15)
MERCHANT_CITY CHAR(10)
MERCHANT_STATE CHAR(10)
MERCHANT_ZIP CHAR(5)

I think the second definition is probably better. If you need to select th 40 byte MERCHANT_ADDRESS you can do:

Code:

    SELECT MERCHANT_STREET ||
           MERCHANT_CITY ||
           MERCHANT_STATE ||
           MERCHANT_ZIP
      INTO :WS-MERCHANT-ADDRESS


Dave
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Sun Aug 06, 2006 9:37 am
Reply with quote

That's another reason to like ADABAS: it lets you create a "group" field that may include other fields...

O.
Back to top
View user's profile Send private message
Satyajit

New User


Joined: 25 Jan 2006
Posts: 27

PostPosted: Tue Aug 08, 2006 1:37 pm
Reply with quote

Can I retieve or insert data into the column in that order?
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Fri Aug 11, 2006 12:35 pm
Reply with quote

Hi,

There are two ways to do that.
1. you create the table with all three different attributes.
2. You can create a type MERCHENT_ADDRESS which has all three attributes. then you can have an attribute of type MERCHENT_ADDRESS

As far as I know, its possible in DB2 to create type. Not really sure. You should consult manuals.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts calling a JCl inside a JCL JCL & VSAM 3
No new posts SRCHFOR ‘string’ command inside P... TSO/ISPF 14
No new posts To find an array of words (sys-symbol... JCL & VSAM 9
No new posts Checking the total counts inside a re... JCL & VSAM 5
No new posts Altering output file attributes All Other Mainframe Topics 5
Search our Forums:

Back to Top