Hi All,
I have got a requirement where i need to read values from the file and select data from db2 table based on this.
I can do it through a simple cobol-db2 program but i wanted to acheive this through any of db2 Utilty/JCL.
Example :
Sample File
Col1 Col2
AA BBB
CC DDD
I should select data from the table for this file input like
Select * from Table where col1= AA and Col2=BBB with ur;
The above has to be accomadated for all file input.
Any help here is greatly appreciated .Thanks.
Select Data from table based on File Input
Moderators: Kalicharan, Moderator Group
-
- Member
- Posts: 7
- Joined: Sat Apr 06, 2013 9:11 am
- Location: Chicago
-
- Member
- Posts: 7
- Joined: Sat Apr 06, 2013 9:11 am
- Location: Chicago
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
Re: Select Data from table based on File Input
What are you saying/asking here?Vishwanath G N wrote:The above has to be accomadated for all file input.
Regards,
Anuj
Anuj
-
- Member
- Posts: 7
- Joined: Sat Apr 06, 2013 9:11 am
- Location: Chicago
My question was ,
Is there any db2 utility which would read a input file(Control card or Sysrec),fetch the records for all these input values and write the same onto the file.
Currently I am doing the below steps and wanted to know if something better can be done
Step1:
Create a header file with below details
GLOBAL
LOCK NO
DB2 FORCE;
UNLOAD TABLESPACE
SELECT COL4 INTO COL01 CHAR
FROM TABLENAME
WHERE COL1 IN (
Step 2:
A flat file having all Input values that has to be passed to the step1 In clause
Step 3:
Trailer record detail
)
WITH UR;
OUTDDN SYSREC01
LOADDDN SYSCTL01
FORMAT DSNTIAUL STRICT
OPTIONS
NULLID NO
PIC('P',LEAD,',','00.0')
I concatenate all step 1 to 3 to create the final sql and then execute the same
Is there any db2 utility which would read a input file(Control card or Sysrec),fetch the records for all these input values and write the same onto the file.
Currently I am doing the below steps and wanted to know if something better can be done
Step1:
Create a header file with below details
GLOBAL
LOCK NO
DB2 FORCE;
UNLOAD TABLESPACE
SELECT COL4 INTO COL01 CHAR
FROM TABLENAME
WHERE COL1 IN (
Step 2:
A flat file having all Input values that has to be passed to the step1 In clause
Step 3:
Trailer record detail
)
WITH UR;
OUTDDN SYSREC01
LOADDDN SYSCTL01
FORMAT DSNTIAUL STRICT
OPTIONS
NULLID NO
PIC('P',LEAD,',','00.0')
I concatenate all step 1 to 3 to create the final sql and then execute the same
Visi
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page