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
 

 

Sql query to compress a data field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sumit agarwalla

New User


Joined: 13 Nov 2008
Posts: 17
Location: hyderabad

PostPosted: Tue Dec 30, 2008 9:53 am    Post subject: Sql query to compress a data field
Reply with quote

I have to create a table in which one of the fields is CITY of datatype CHAR(15).....and I have to use some sort of compressing the alphabetic field CITY ......how do I compress the field while creating it...please help me on this?
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Dec 30, 2008 11:39 pm    Post subject:
Reply with quote

Hello,

Quote:
I have to use some sort of compressing the alphabetic field CITY
You have received no replies because you have not posted anything for people to use to help you. . .

You need to define what you mean by "compress" and what the compression rules are for this requirement.

Post a variety of city names as they "are" and how you want them to be compressed.
Back to top
View user's profile Send private message
sumit agarwalla

New User


Joined: 13 Nov 2008
Posts: 17
Location: hyderabad

PostPosted: Wed Dec 31, 2008 11:55 am    Post subject:
Reply with quote

ok...i will explain what i require....
I need to create an employee table named "EMPLOYEEDET" with the following characteristics

Code:

COLUMNNAME       DATATYPE     LENGTH            REMARKS
dept_id              numeric       4         foreign key which refers the
                                                      corresponding column in the
                                                      parent table "DEPARTMENT"
emp_no               numeric       4         primary key
firstname            alphabetic    15
lastname             alphabetic    15
city                 alphabetic    15        use some sort of compressing the
                                                      alphabetic field city
gender               alphabetic    1         gender should be M or F.it should not
                                                     allow to enter any other character
                                                     other than M and F
age                  NUmeric        4
salary               numeric        integer:8
                                    decimal:2
doj                   date             10
now i just have to create the table with following remarks being followed but i am not able to understand the remark of the city field. what does it mean?
what i did next to go forward was first i created the table with city fields datatype as CHAR and later on altered the table by changing the datatype from CHAR TO VARCHAR which I think will occupy less space then CHAR.Suggest me if I am wrong.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Wed Dec 31, 2008 4:28 pm    Post subject:
Reply with quote

Sumit,

My suggestion can be, create a table called CITY containing city_code CHAR(4) & city_nameCHAR(30). In this table use city_code CHAR(4).

CHAR TO VARCHAR : Depends on the REQUIREMENT.

Sushanth
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Dec 31, 2008 10:25 pm    Post subject:
Reply with quote

Hello,

Quote:
use some sort of compressing the
alphabetic field city
Basically - nonsense. . . icon_confused.gif "Some sort of compressing" is incredibly poor direction.
Quote:
later on altered the table by changing the datatype from CHAR TO VARCHAR which I think will occupy less space then CHAR.
A small amount of space might be saved, but keep in mind it would be a small amount.
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 Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm


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