Home » SQL & PL/SQL » SQL & PL/SQL » How to write Linefeed Symbol (L above F) via UTL_FILE on VMS?
How to write Linefeed Symbol (L above F) via UTL_FILE on VMS? [message #208096] Fri, 08 December 2006 02:53 Go to next message
gleduc
Messages: 2
Registered: December 2006
Junior Member
Hi All,

For one of our customers we have redesigned and developed a piece of software. The goal of this software is to create some specific output files on the file system.

The original software was written in Cobol and has been re-written in Oracle (Database package) to make the software Operating System independent. The Operating System used at the moment is (Open)VMS.

Now I have the following issue:
In the Cobol software a special character (X'0A') is written at the end of each line representing a Linefeed Symbol (L above F, like L/F but then above each other). In the new solution all code is in a database package which creates the output files via UTL_FILE. When writing a line to the output file a linefeed is added (automatically) to the line but apparently this isn't the same as the linefeed symbol used in the Cobol code.

I've tested several possibilities by adding various characters
(see code below) but none of them does the trick. If I send a linefeed from the package it is being carried out in the file but I need to 'concatenate' the linefeed symbool to each line.

Does anyone perhaps know which character I can add to each line which represents the linefeed symbol (L above F) in the output file ?

Database version is 9.2.0.5. Operating is VMS (Alpha I think).

Any information is welcome.

With regards,
Guido

Code used for testing
---------------------
SET serveroutput on
SET feedback on

DECLARE
  v_file         utl_file.file_type;
  v_exportdir    varchar2(100) := 'EXPORT_DIR'; 
  v_bestandsnaam varchar2(100) := 'test_linefeed.log';  

BEGIN
  v_file := UTL_FILE.FOPEN(v_exportdir, v_bestandsnaam, 'w'); 
  
  -- Schrijven test regels  
  UTL_FILE.PUT_LINE(v_file, 'Test 01 - Schrijf output met Oracle LineFeed CHR(10) en Carriage return CHR(13) --> ' || CHR(10) || CHR(13));
  UTL_FILE.PUT_LINE(v_file, 'Test 02 - Schrijf output met Oracle LineFeed (CHR(10) --> ' || CHR(10));
  UTL_FILE.PUT_LINE(v_file, 'Test 03 - Schrijf output met Newline (\n) --> ' || '\n');
  UTL_FILE.PUT_LINE(v_file, 'Test 04 - Schrijf output met Linefeed Cobol character (X''0A'') --> ' || 'X''0A''');
  UTL_FILE.PUT_LINE(v_file, 'Test 05 - Schrijf output met aangepast Linefeed Cobol character (0X''0A'') --> ' || '0X''0A''');
  UTL_FILE.PUT_LINE(v_file, 'Test 06 - Schrijf output met aangepast Linefeed Cobol character (x''0A'') --> '  || 'x''0A''' );  
  UTL_FILE.PUT_LINE(v_file, 'Test 07 - Schrijf output met aangepast Linefeed Cobol character (\X''0A'') --> ' || '\X''0A''');         
  UTL_FILE.PUT_LINE(v_file, 'Test 08 - Schrijf output met UNIX LineFeed en Carriage return (\r\n) --> ' || '\r\n');
  UTL_FILE.PUT_LINE(v_file, 'Test 09 - Schrijf output met Hexadecimaal character voor Linefeed (\0A) --> ' || '\0A');
  UTL_FILE.PUT_LINE(v_file, 'Test 10 - Schrijf output met Decimaal character voor Linefeed (\010) --> ' || '\010');
  UTL_FILE.PUT_LINE(v_file, 'Test 11 - Schrijf output met Octaal character voor Linefeed (\012) --> ' || '\012');      
  UTL_FILE.PUT_LINE(v_file, 'Test 12 - Schrijf output met Oracle LineFeed toegevoegd, niet uitgevoerd --> ''CHR(10)''');
  UTL_FILE.PUT_LINE(v_file, 'Test 13 - Schrijf output met convert functie --> ' || CONVERT(CHR(10), 'WE8HP'));  
    
  --UTL_FILE.FFLUSH(p_file_type); 
  UTL_FILE.FCLOSE(v_file);
END;
/
Re: How to write Linefeed Symbol (L above F) via UTL_FILE on VMS? [message #208168 is a reply to message #208096] Fri, 08 December 2006 07:13 Go to previous messageGo to next message
misragopal
Messages: 125
Registered: June 2005
Location: New Delhi, india
Senior Member

instead of using CHR(10) || CHR(13)) use CHR(13) || CHR(10));
Re: How to write Linefeed Symbol (L above F) via UTL_FILE on VMS? [message #208502 is a reply to message #208168] Mon, 11 December 2006 01:48 Go to previous message
gleduc
Messages: 2
Registered: December 2006
Junior Member
misragopal, thanks for your reply. I'll test this and post my results in here.

Regards,
Guido
Previous Topic: another design issue - suggestion needed
Next Topic: Urgent : Errors :- ORA-01034 and ORA-27101
Goto Forum:
  


Current Time: Sat Dec 10 03:31:33 CST 2016

Total time taken to generate the page: 0.10472 seconds