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
 

 

Can we extract records from DB2 TABLE to a FLAT File

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
komal

New User


Joined: 09 May 2005
Posts: 18

PostPosted: Wed Oct 25, 2006 7:01 pm    Post subject: Can we extract records from DB2 TABLE to a FLAT File
Reply with quote

Hi

Can we extract records from DB2 TABLE to a FLAT FILE using JCL?

Using cursors in COBOL we can do this (i mean a simple select statement using some condition placed in a cursor) but instead of coding cobol prog, i want to do this.

If any of U know the solution plz send the JCL code ASAP.

Kiran
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Wed Oct 25, 2006 7:07 pm    Post subject: Re: JCL and DB2
Reply with quote

You can code your SQL queries in the JCL itself to retreive records from a DB2 Table and generate output in a dataset.

Look here for how to code SQLs in JCL...
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Wed Oct 25, 2006 10:34 pm    Post subject: Re: JCL and DB2
Reply with quote

Hi There !

You can use utility DSNTEP2, often called batch-spufi, to submit
SQL-Selects in a BatchJob.

//S1 EXEC PGM=IKJEFT01
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//*
//SYSTSIN DD *
DSN SYSTEM(DB2T)
RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2) -
PARMS('NOCOUNT/')
//SYSIN DD *
SELECT DISTINCT VE.VE_ID
FROM S308.VE_DARL VE
JOIN S308.GRUNDKONTO GK
ON GK.KONTO_ID = VE.VE_ID
WHERE GK.KONTONR = 608004552
;
//*

Regard's UmeySan
Back to top
View user's profile Send private message
ihatesugar
Warnings : 1

New User


Joined: 22 Oct 2006
Posts: 43

PostPosted: Thu Oct 26, 2006 1:17 pm    Post subject: Re: JCL and DB2
Reply with quote

u can also use the utility DSNTIAUL

anyways .. can anyone share the jcl to upload a table from dataset!!!!
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Thu Oct 26, 2006 1:58 pm    Post subject:
Reply with quote

A LOAD example can be found in the fine manual.

O.
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


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