Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : Q. If there is a situation, where we need to code more than 255 steps in a JOB? A. We need to split jcl into two jcls , at the end of the first jcl check the condition code and initiate the second jcl.

Google
 
Web mainframegurukul.com

Programmers Voted for below topics.      Please Vote for good Posts. Votes Salutes
Topic Title Votes Salutes
HOW TO FIND LINKAGE LENGTH 6
SOC 7 abend - interview question 6
splitting of records using cobol 6
EJECT Verb in COBOL 5
jcl sort to add leading zeroes 5
Infosys Training Program for freshers 5
Changes in copybook 4
Comparing two files 3
What are the issues related with correlated subqueries? 3
VSAM File status 23 ,but records are present in the file 3
what is index or subscript in cobol. please give me brief ex 3
IKJ56500I COMMAND DSN NOT FOUND 3
Cobol Multiple Choice Questions By Shravan Wipro 3
Cobol Multiple Choice Questions By Shravan Wipro 1 1
Hexadecimal to decimal conversion - SORT JCL INREC OUTREC 1 1
What is the difference between SYNONYM and ALIAS? 1 1
PROCLIB 1 1
sort two files with same sort condition 1 1
What is the difference between Copy and Include? 1 1
EZtrv+ - Is there a way to suppress ez-code from printing... 1 1
Merging two files into one based on certain key fields: 1 1
what is index or subscript in cobol. please give me brief ex 1 1
Copy GDG to GDG (one to one). 1 1
jcl sort to add leading zeroes 5
VSAM File status 23 ,but records are present in the file 3
Urgent Help needed !! 3
Hexadecimal to decimal conversion - SORT JCL INREC OUTREC 3
How we can access PDS and its Members thru COBOL ? 3
Cobol Multiple Choice Questions By Shravan Wipro 2
SOC 7 abend - interview question 2
How to read HEX file and convert it into decimal in REXX. 2
Various Locking mechanism for cursors and other SQL? 2
How to fetch and compare the system date in JCL 2
stored procedure in cobol 2
VERTICAL ARRAY IN CICS 2
what s the difference between DB2 & ADB2? 2
What is auditing? 2
Reg DFSORT utility. 2
Computer based tutorial on IMS DB/DC 2
what is index or subscript in cobol. please give me brief ex 2
How to compare two ps files having millions of records ? 2
How to convert Julian date format into yyyymmdd date format? 1
What is the difference between Static and Dynamic Binding? 1
In jcl please help me. 1
Access DB2 region using rexx 1
DFHAC2016 - Trans XXXX cannot run because program XXX is Not 1
EZtrv+ - Is there a way to suppress ez-code from printing... 1
How to use XREF.. 1
DB2 checkpoint-restart doubts 1
Comparing 2 files based on Acct number without using tables 1
JCL-I need to FTP from MF to Local computer 1
cics 1
sort two files with same sort condition 1
U4093 IMS Abend 1
writing 2 records for each qualifying input record. 1
Is it possible to get last modified date of PDS members... 1
Merging two files into one based on certain key fields: 1
How to run only 2 steps out of 100 steps??? 1
Corresponding statement 1
Difference between an Object Module and Load Module 1
Moving cursor to next field in ISPF dialog 1
DB2 query !! 1
JCL Interpreter :?: 1
Comparing Date with current date 1
SORT verb - help 1
How to assign System Date/Time to a parameter in a JCL pgm? 1
is the answer correct?? 1
Mainframe Developer Requirement - Coimbatore 1
Man of the year 1
I need to FTP from MF to UNIX 1
Control flow from one STEP to another 1
DB2 table -selective download to a flat file

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DB2 SQL - DB2 PROGRAMMING
  View previous topic :: View next topic  
Author Message
mainframe_puli
Member


Joined: 10 Apr 2007
Posts: 2

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Apr 13, 2007 9:19 am    Post subject: DB2 table -selective download to a flat file Reply with quote

Hi,

I have Agent DB2 table& a Transaction file. The transaction file has a field Agent No. I have to query the AGENT table which consists of both agent no& Employee no, to get the Employee no corresponding to the Agent no.s in the transaction file. Is this Possible?

1 more doubt.While I tried to unload the table using selective query, it was showing "SELECT" stmt is illegal.Can you tell me the reason?
Or isnt it possible to do the selective download of a DB2 table to a flat file?

Thanks,
Rinu
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Veera
Moderator


Joined: 22 Feb 2006
Posts: 111

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Apr 13, 2007 11:23 pm    Post subject: Reply with quote

Rinu,


I have Agent DB2 table& a Transaction file. The transaction file has a field Agent No. I have to query the AGENT table which consists of both agent no& Employee no, to get the Employee no corresponding to the Agent no.s in the transaction file. Is this Possible?

Code:

yes it is possible.

SELECT EMPOLYEE_NO ,AGENT_NO                 
  FROM AGENT
  WHERE AGENT_NO = :WS-Agent_No ----> This field should be from ur TRANS FILE.


We need to consider few things in the above query

1--> IT will give correct results only if you have UNIQUE AGENT_NO in the AGENT TABLE.
     other wise there is a posibility that you will get duplicates for that either
     you need to handle duplicates by -811 or code a CURSOR.

2---> It is always good to query the table using the full key. So instead of unloading
      the only AGENT_NO try unloading the entire key fields from the file if you have
      all the fields.If you query the table with out key fields, there will be tremendous
      performance degradation, which is not wise to use.

3---> The above query should be executed for each record in the I/P FILE. I mean you have
      to read the TRANS-FILE until EOF, and for each succesfull read you have to execute the
      above query, and display or wirte into output file as per your requirement.



1 more doubt.While I tried to unload the table using selective query, it was showing "SELECT" stmt is illegal.Can you tell me the reason? Or isnt it possible to do the selective download of a DB2 table to a flat file?

Code:

This should be possible, how are u trying to do this..may be something wrong with ur query systax.


As Info:
********

I think if you are trying to unload the AGENT_NO from other table into TRANS-FILE and then
using that AGENT_NO from TRANS-FILE if you are trying to select list of EMPOLYEE_NO for
the corresponding AGENT_NO, then instead of unloading into TRANS-FILE.We can directly
achieve the above by join/co-related query on 2 tables with appropriate keys thru one pass to DB2.

Well anyway unloading into TRANS-FILE is also not a bad option.



Thanks,
Veera.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
mainframe_puli
Member


Joined: 10 Apr 2007
Posts: 2

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Apr 17, 2007 9:01 am    Post subject: Reply with quote

Hi Veera,

I forgot to mention that I am trying to implement the above using JCL only.
I am not supposed to use any COBOL programs for the same.Can you give me a solution for the same?
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
DavidatK
Active Member


Joined: 27 Mar 2007
Posts: 65
Location: Troy, MI USA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Apr 18, 2007 5:04 am    Post subject: Reply with quote

Rinu,

What you are asking of DB2 is not possible directly, but is achievable. You cannot do a query in JCL accessing a flat file. But there are ways.

Can you please post the structure of the agent table and the copybook for the transaction file? Also the copybook for the output.

I take it this is an academic exercise rather than a business problem, right? There are things that I would do as an academic exercise that I would not do as a business solution.

How much of a volume are we talking about here? Hundreds, thousands, or millions of rows/records?

Let?s see what we can come up with.

Dave
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Veera
Moderator


Joined: 22 Feb 2006
Posts: 111

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Apr 18, 2007 6:26 am    Post subject: Reply with quote

Rinu,

Ok let me define ur requirement first

1. You have a transaction file -> This File has field AGENT-NO

2. you have a table AGENT -> Which consists of AGENT-NO,EMPLOYEE-NO...and some more columns.


Now what is required is you need to get the EMPLOYEE-NO corresponding to the AGENT-NO from ur I/P trans file.

and you want to achieve this using only JCL.


Ok Rinu here is what i suggest..

Code:


STEP1 : Unload the AGENT table.

           ( All the columns OR only 2 columns AGENT-NO , EMPLOYEE-NO)

This can be done using the JCL , using a query.



you dint get back to us reg whether the TRANS FILE or the TABLE will have duplicates

on AGENT-NO and EMPLOYEE-NO.

well if there can be duplicates then you need few more steps .

Code:



STEP 2: SORT THE UNLOAD FILE FROM STEP1 ON AGENT-NO AND ELIMINATE ALL THE DUPLICATES.
        (SUM FIELDS = NONE , AND SORT FIELDS)

STEP 3: SORT THE TRANS FILE AND ELIMINATE DUPLICATES ON AGENT-NO

NOTE : STEP 2 AND STEP 3 are required only if you have any DUPLICATES

step 4:  write one EZT matching program or SORT and then match on AGENT-NO from
         both the files and when ever there is a match write into outfile from
         UNLOAD FILE , which has both AGENT-NO and EMPLOYEE-NO.



NOTE : If you are planning to use EZT for matching then better to sort both the files on fields which we match.

whatever is suggested can be done using ONLY JCL without using ANY PROGRAM COBOL OR COBOL + DB2.


P.S : WHAT EVER YOU HAVE ASKED FOR IS NOT CLEAR AS DAVE SAID IF YOU CAN COME UP WITH ALL THE DETAILS AND STRUCURE YOUR REQUIREMENT CLEARLY THEN WE CAN GET BACK WITH BETTER SOLUTIONS.

If the suggested solution can give you and Idea how to procees we will be Glad Smile

Thanks,
Veera.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DB2 SQL - DB2 PROGRAMMING All times are GMT + 5 Hours
Page 1 of 1



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts two reports to compare , both different format - URGENT 1 ar3 4999 Wed Jul 15, 2009 7:57 pm
Frank Yaeger View latest post
No new posts If both the JOBCAT & STEPCAT statements are coded in a s 1 Krishna 5712 Tue May 12, 2009 6:43 pm
Krishna View latest post
No new posts Commit both in DB2 and MQ 3 jackie 7193 Fri Jul 27, 2007 3:52 pm
dbzTHEdinosauer View latest post
No new posts How to use both lower and upper case letters in cobol? 1 Divya 9150 Fri Mar 09, 2007 10:27 pm
Veera View latest post
No new posts Stop Run in both called and calling programs !!! 2 arrbee 9755 Fri Mar 10, 2006 12:13 pm
jaydeeppal View latest post
 





Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-2415.html