473,320 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

writing the text output to a external flat file from a db2 stored procedure

Hi

My requirement is that i have to write a stored procedure in db2 and that will be executed in a batch file . Any system error or validation error that occurs inside the db2 sp during the execution need to be written in external flat file ( Log file to know the error ) .
Is there anything similar in db2 like UTL_FILE in oracle .

Please find the sample coding in oracle which will write the output to a external flat file .

SAMPLE ORACLE CODE :
Expand|Select|Wrap|Line Numbers
  1. BEGIN 
  2.  
  3.     -- variable declaration
  4.  
  5.      log_file                     UTL_FILE.FILE_TYPE;
  6.  
  7.     -- external flat file open 
  8.  
  9.       log_file := UTL_FILE.FOPEN( ‘c:/’, 'filename.log', 'w' );
  10.  
  11.     -- write to the external flat file 
  12.  
  13.       UTL_FILE.put_line(log_file,' write the output to the flat file '));
  14.  
  15.     -- close the external flat file 
  16.  
  17.       UTL_FILE.FCLOSE(log_file);
  18.  
  19. END 
Thanks & Regards
Sathiyamurthy
Dec 27 '07 #1
2 6100
Are you in a mainframe environment that uses JCL? Sounds like you may have to do some JCL coding
Dec 30 '07 #2
Are you in a mainframe environment that uses JCL? Sounds like you may have to do some JCL coding
Thanks for your reply .

Not in mainframe . we are using unix .
Dec 31 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Dimitris | last post by:
I'm using ADO.NET to call a stored procedure that runs the "BACKUP" command on selected databases. Is there any way I can capture the text output of the stored proc and return it to ADO.NET for...
4
by: Dan | last post by:
I've run into an interesting problem, and seemed to have stumped 3 newsgroups and 2 other forums. For some reason when I try to insert a record into a SQL table that has a Text column, the...
0
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
4
by: laurenq uantrell | last post by:
I'm using the function below to output all of my stored procedures into a text file. Fice, except that the output file does not reflect the names of the stored procedures correctly if the name has...
2
by: lauren quantrell | last post by:
I'm using the function below to output all of my stored procedures into a text file. Fice, except that the output file does not reflect the names of the stored procedures correctly if the name...
16
by: Claudio Grondi | last post by:
I have a 250 Gbyte file (occupies the whole hard drive space) and want to change only eight bytes in this file at a given offset of appr. 200 Gbyte (all other data in that file should remain...
2
by: Praveen_db2 | last post by:
Hi all Db2 8.1.3 windows Is there any way to write data into a text file using a stored procedure? The way we return a cursor output to the calling application, can we return data in a text...
1
by: galivio | last post by:
I need a code in C where accepts inputs coming from an external text file and will give an output stored on another text file. For example, a C program to compute the sum of the two integers. The...
0
by: pvjagadeesh | last post by:
Hi All, I am using Db2 8.0 and i need to write one of the result set of the stored procedure to an external output file. is there any way to do this.please help me to do this. Thanks in...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.