Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to specify attributes inside an attribute?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to specify attributes inside an attribute?
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    Post subject: Re: How to specify attributes inside an attribute?
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: 2360
Location: Israel

PostPosted: Sun Aug 06, 2006 9:37 am    Post subject:
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    Post subject: Re: How to specify attributes inside an attribute?
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Add system date inside of a PS file a... pramitdas DFSORT/ICETOOL 5 Sun Aug 28, 2016 12:06 am
No new posts How to change dataset attributes of m... ignich7 JCL & VSAM 3 Thu Jul 21, 2016 9:17 pm
No new posts CALL MACRO EXECUTE FORM - Setting the... sudarshan.srivathsav PL/I & Assembler 7 Tue Feb 09, 2016 10:32 pm
No new posts REXX code to expand all submodules in... Chhandak Chakraborty CLIST & REXX 25 Thu Jul 23, 2015 10:22 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us