MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

LOAD problem

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Mon Feb 26, 2007 10:02 am    Post subject: LOAD problem Reply with quote

Hi,

I am facing a typical problem in LOAD this time.
I have table having three fields.What I need to do is load the first two columns of the table and while I do so.I need to insert XYZ in the third column.suppose If i load 2 million records in the first two columns there should be 2 million XYZ in the third.How to do that?

Regds,
Kingo
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Mon Feb 26, 2007 11:58 am    Post subject: Reply with quote

kingo,

you have couple of options

1.Define the col3 with default value of 'xyz' in your Create table statement.

Code:

CREATE TABLE your_tbl                                                 
       (COL1                 CHAR(10)             NOT NULL WITH DEFAULT
       ,COL2                 CHAR(5)              NOT NULL WITH DEFAULT
       ,COL3                 CHAR(3)              NOT NULL WITH DEFAULT 'XYZ')
;


so whenever you are inserting a new row if you don't provide a value for col3 it will be populated by xyz.

2. Create the load dataset to 'XYZ' in the col3 position.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Mon Feb 26, 2007 11:13 pm    Post subject: Reply with quote

Kolusu can you please explain the second option please.

Regds,
Kingo
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Tue Feb 27, 2007 12:14 am    Post subject: Reply with quote

Create a dataset with the required data and append 'XYZ' to every record of your load dataset
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Tue Feb 27, 2007 12:21 am    Post subject: Reply with quote

Thanks programmer1

Regds,
Kingo
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Tue Feb 27, 2007 12:28 am    Post subject: Reply with quote

Is there anyway to LOAD data when i declare the third column with not null alone?

Regds,
Kingo
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Tue Feb 27, 2007 12:31 am    Post subject: Reply with quote

What exactly is your requirement ? I can't understand you.
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Tue Feb 27, 2007 12:41 am    Post subject: Reply with quote

Actually i have a table with three columns.Need to load first two fileds and when i do so i
need to insert XYZ in third field.I didnt create with not null with default 'XYZ'.So I need any other way to populate the value.

Regds,
Kingo
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Tue Feb 27, 2007 6:58 am    Post subject: Reply with quote

Write a program that reads each record and writes it out with 'XYZ' appended to it.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Tue Feb 27, 2007 10:54 pm    Post subject: Reply with quote

Thanks

Regds,
Kingo
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Feb 28, 2007 4:55 am    Post subject: Reply with quote

Why not drop the table and recreate it with the default defined? Quick and easy and one less program to maintain!
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group