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: 755
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
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
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 Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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