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
 

 

Reading file loading DB2 tables using COBOL Pgm and JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Reading file loading DB2 tables using COBOL Pgm and JCL
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

Site Director


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

PostPosted: Mon Aug 13, 2012 2:27 am    Post subject:
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

Senior Member


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

PostPosted: Mon Aug 13, 2012 3:40 pm    Post subject:
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: 1715
Location: UK

PostPosted: Mon Aug 13, 2012 3:54 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Mon Aug 13, 2012 10:59 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon Aug 13, 2012 11:43 pm    Post subject:
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    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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm


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