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 Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm


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