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
 

 

JCL for PS(I/P) -> table(Select query) -> PS(O/P)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
nkothako

Active User


Joined: 26 Nov 2008
Posts: 125
Location: chennai

PostPosted: Sat Jan 04, 2014 12:45 am    Post subject: JCL for PS(I/P) -> table(Select query) -> PS(O/P)
Reply with quote

I/P
1 - 8 char
9 - 12 char
13-16 char

Select query
select col1,col2, col3, col4 ...etc., from table a
where col1(1-8 i/p file) and col2(9-12 i/p file) and col3(13-16 i/p file)

o/p
The result of select query output should be written in output file

note : My input file can be blank and at that time JCL should write all the rows of the table(col1, col2, col3,col4...etc..)

Is this possible using JCL without writing a cobol pgm...
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


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

PostPosted: Sat Jan 04, 2014 1:05 am    Post subject:
Reply with quote

Of course, you are jesting with us, as after more than five years you must know that JCL does nothing but establish environments and execute programs.

To fulfill your goal, I recommend SQL formatted by Rexx and executed by DSNTIAUL.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 646
Location: Pennsylvania

PostPosted: Sat Jan 04, 2014 1:25 am    Post subject:
Reply with quote

The TS failed to tell us how many possible input records there could be.
Or the amount of data on the table.

The SQL may be:
IF ((col1 = '12345678' and col2 = '1234' and col3 = '1234') or
(col1 = '12345678' and col2 = '1234' and col3 = '1234') or
(col1 = '12345678' and col2 = '1234' and col3 = '1234') ......

An alternate approach....
Code:
STEP 1 - Sort to check if Input data exists
IF STEP1.RC=4   THEN DO (empty file)
   STEP2 DB2 Unload (all the data)
ELSE DO
   STEP3A DB2 Unload (all the data)
   STEP3B SORT JOINKEYS on Input file and DB2 Unload Data creating selected output file
END
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Sat Jan 04, 2014 1:41 am    Post subject:
Reply with quote

daveporcelan wrote:
An alternate approach....
Code:
STEP 1 - Sort to check if Input data exists
IF STEP1.RC=4   THEN DO (empty file)
   STEP2 DB2 Unload (all the data)
ELSE DO
   STEP3A DB2 Unload (all the data)
   STEP3B SORT JOINKEYS on Input file and DB2 Unload Data creating selected output file
END

A good idea; I hadn't thought of doing that way, but it's probably better than my recommendation.
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 Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm


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