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

Reading file loading DB2 tables using COBOL Pgm and JCL


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

New User


Joined: 11 Aug 2012
Posts: 9
Location: India

PostPosted: Sun Aug 12, 2012 11:20 pm
Reply with quote

Hi,

I need to read a file and write to 4 files corresponding to tables to be inserted in DB2 after deleting all the rows from the 4 tables.

My questions are :please let me know if i am wrong anywhere

1. There are s9(9) in db2 table but when i read from file it is x(9) so i need to covert them --> i am moving the variables from x(9) to z(08)9 then moving the z(08)9 to s(9). Will it work fine. Please let me know if there are any alternative way to do this.

2. I need to delete all the data from the 4 tables before loading the table with new data from the input file. --> We can do this in COBOL program and also in JCL please let me know which will have high performance if there are records in thousands and millions. And also the process in JCL.

3. Also is there is any utility through which we can load tables by writing a file according to the table variables in JCL.


Thanks in advance for you suggestion.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Aug 13, 2012 2:27 am
Reply with quote

Hello and welcome to the forum,

1. i believe you need to change this. what is the column definition in db2? why have you used z(08)9?

2. how many rows are in the table? performance will depend on how the rowa are deleted. if all of the rows are to be deleted, suggest you Not delete them one-at-a-time,

3. not sure i understand the question, but you can create a file that can be directly loaded using the db2 LOAD. there are examples in the forum - use search.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Aug 13, 2012 3:40 pm
Reply with quote

Quote:
There are s9(9) in db2 table
Please help me to understand, what are you referring to by this?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Aug 13, 2012 3:54 pm
Reply with quote

I think you do not understand what JCL does. For a start it does not have table variables. Also, it cannot delete data from DB2 tables. JCL tells the processor what program(s) you want to run and what dataset(s) is/are required - including where program control cards are. Program control cards are NOT JCL. So - running a COBOL program will involve submitting JCL to tell the computer what resources the cobol program requires. That is a generl view - you can bypass some of the JCL by using dynamic allocation.
Back to top
View user's profile Send private message
raj sam

New User


Joined: 11 Aug 2012
Posts: 9
Location: India

PostPosted: Mon Aug 13, 2012 10:26 pm
Reply with quote

dick scherrer wrote:
Hello and welcome to the forum,

1. i believe you need to change this. what is the column definition in db2? why have you used z(08)9?

2. how many rows are in the table? performance will depend on how the rowa are deleted. if all of the rows are to be deleted, suggest you Not delete them one-at-a-time,

3. not sure i understand the question, but you can create a file that can be directly loaded using the db2 LOAD. there are examples in the forum - use search.



Hi
1. actually it can be used as 9(9) also just used that to supress the zeroes which i need to for display purpose
2. there might be 10 thousands to 100 thousands of records. So what according to use will be high performance. Deleting in JCL by using a parm or deleting in COBOL program itself.
3. Ya i know this can be done through a DB2 utility DSNUTILB but need some info from all the experts here before proceeding so posted the question
Anyways thanks buddy for ur suggestion
Back to top
View user's profile Send private message
raj sam

New User


Joined: 11 Aug 2012
Posts: 9
Location: India

PostPosted: Mon Aug 13, 2012 10:28 pm
Reply with quote

Anuj Dhawan wrote:
Quote:
There are s9(9) in db2 table
Please help me to understand, what are you referring to by this?


It means that the column is defined as INTEGER S(9) in the table
Thanks
Raj
Back to top
View user's profile Send private message
raj sam

New User


Joined: 11 Aug 2012
Posts: 9
Location: India

PostPosted: Mon Aug 13, 2012 10:37 pm
Reply with quote

Nic Clouston wrote:
I think you do not understand what JCL does. For a start it does not have table variables. Also, it cannot delete data from DB2 tables. JCL tells the processor what program(s) you want to run and what dataset(s) is/are required - including where program control cards are. Program control cards are NOT JCL. So - running a COBOL program will involve submitting JCL to tell the computer what resources the cobol program requires. That is a generl view - you can bypass some of the JCL by using dynamic allocation.


Hi Nick,

--i was referring to DB2 utilities and JCL utilities where we can delete/insert/update any tables by passing parms.
--We can load tables through a DB2 utility called DSNUTILB and pass the a dataset as a parm and load tables by using the utility the dataset is structured according to the table structure and the variables are also similarly defined for the record written.
Any ways thanks for the info.... please let me know your expert views if i am missing something here
Also it will be great if you can describe hoe the DSNUTILB works.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Mon Aug 13, 2012 10:59 pm
Reply with quote

raj sam wrote:
Anuj Dhawan wrote:
Quote:
There are s9(9) in db2 table
Please help me to understand, what are you referring to by this?


It means that the column is defined as INTEGER S(9) in the table
Thanks
Raj

It can't be.

A DB2 column would have to be defined as INTEGER. A COBOL host variable might be defined as S9(9) COMP-5, or S9(9) COMP if TRUNC(BIN) were in effect. OTOH that same host variable could be defined as FIXED BIN (31) in PL/I; it would make no difference to DB2.

Despite your proclaimed skill set, you seem confused about what you're trying to do and how to go about doing it.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 13, 2012 11:04 pm
Reply with quote

Rajesh Samal wrote:
JCL utilities

a JCL utility is a utility that manipulates jcl,
which is not what you were trying to say
and that was nic's point.
if you would use proper terminology,
you could find the information on your own,
or format better questions so that people could respond.

Rajesh Samal wrote:
Also it will be great if you can describe hoe the DSNUTILB works.


if you would bother to google, search
or do anything except ask poorly phrased questions,
you would have found this post (in this very website!)
which would start you on your way, as well as provide you with
a link to the manuals,
which you can read, yourself (which is what the big-boys do)
we do not paraphrase manuals, they are already well written.

Besides, it takes so much effort to decipher your questions,
we have little energy left.
Back to top
View user's profile Send private message
raj sam

New User


Joined: 11 Aug 2012
Posts: 9
Location: India

PostPosted: Mon Aug 13, 2012 11:17 pm
Reply with quote

Akatsukami wrote:


A DB2 column would have to be defined as INTEGER. A COBOL host variable might be defined as S9(9) COMP-5, or S9(9) COMP if TRUNC(BIN) were in effect. OTOH that same host variable could be defined as FIXED BIN (31) in PL/I; it would make no difference to DB2.

Despite your proclaimed skill set, you seem confused about what you're trying to do and how to go about doing it.



yes u r right its defined as s9(9) COMP
Back to top
View user's profile Send private message
raj sam

New User


Joined: 11 Aug 2012
Posts: 9
Location: India

PostPosted: Mon Aug 13, 2012 11:22 pm
Reply with quote

dbzTHEdinosauer wrote:
Rajesh Samal wrote:
JCL utilities

a JCL utility is a utility that manipulates jcl,
which is not what you were trying to say
and that was nic's point.
if you would use proper terminology,
you could find the information on your own,
or format better questions so that people could respond.

Rajesh Samal wrote:
Also it will be great if you can describe hoe the DSNUTILB works.


if you would bother to google, search
or do anything except ask poorly phrased questions,
you would have found this post (in this very website!)
which would start you on your way, as well as provide you with
a link to the manuals,
which you can read, yourself (which is what the big-boys do)
we do not paraphrase manuals, they are already well written.

Besides, it takes so much effort to decipher your questions,
we have little energy left.


Hi Dick,

i have referred to many examples but i was just confused about the various usages so i asked here.
i think u misunderstood me.
thanks for your advice.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Aug 13, 2012 11:43 pm
Reply with quote

Hello,

Most (all?) of the misunderstanding was caused by the way you chose to present your idea/question.

I suspect you best approach would be to talk with senior people in your organization ans learn how they have done this. They wioll know far more that we do about your system and which methods are acceptable there.
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top