Write CLOB XML output to a file on UNIX box (file size 32 K)

All,
Can someone give me a sample code of how to write a CLOB output in a CLOB variable (holds XML output generated from DBMS_XMLQUERY) to a text file on UNIX box?
I found on ask tom a technique which only write upto 32K length. My CLOB output is more than 32K.
from ASK TOM:
create or replace
procedure clob_to_file( p_dir in varchar2,
p_file in varchar2,
p_clob in clob )
as
l_output utl_file.file_type;
l_amt number default 32000;
l_offset number default 1;
l_length number default
nvl(dbms_lob.getlength(p_clob),0);
BEGIN
l_output := utl_file.fopen(p_dir, p_file, 'w', 32760);
while ( l_offset < l_length )
loop
utl_file.put(l_output,
dbms_lob.substr(p_clob,l_amt,l_offset) );
utl_file.fflush(l_output);
l_offset := l_offset + l_amt;
end loop;
utl_file.new_line(l_output);
utl_file.fclose(l_output);
end;
Thanks

Fortran and C strings are different. When passing a string to Fortran from C, you have to know the Fortran string's length, and pad the trailing part of the string with blanks (spaces). Modern C functions never write a string without a NUL terminator, so you cannot write directly to the Fortran string unless you ensure there is at least one extra character. My guess is that your output strings contain embedded NUL characters, which somehow causes problems in the file I/O routines, but not to stdout.
According to your C fread() calls, I am assuming that you use hard-wired lengths of len(nis)==15 and len(sys)==32.Here is an example that may work, (without the #includes). It is similar to yours, but blanks-pads the result starting from the first control or NUL character. It is also a subroutine (void result) because 'bit' was just returned uninitialized in your code. Like yours, there is no error checking, but NIS should end up all blanks if there is an error.
#define NIS_LEN 15
void operating_sys(char nis[NIS_LEN]) {
  int i;
  FILE *stream;
  nis[0]=0;
  stream=popen("/bin/nisdomainname","r");
  fgets(string,sizeof(string),stream);
  fread(nis,1,NIS_LEN,stream);
  pclose(stream);
  for (i=0;i<NIS_LEN;i++) {
    if (nis<' ') {
memset(&nis[i],' ',NIS_LEN-i);
break;

Similar Messages

  • Recovered files now UNIX Executable Files???

    After my previous external hard drive failed I had the data recovered and placed onto a new external drive. After looking at the files I have found that a number of them have become "unix executable files." I don't know what this is or how to fix it. It seems to have only happened to things such as saved emails, but there are some photos from my digital camera that have converted to this as well.
    While looking into the problem I found that the company that recovered the data placed it all onto an external hard drive that is an MS-DOS File System (FAT32) format instead of a Mac OS format. Could this be the problem since all of my files were Mac files, and the hard drive they were recovered from was formatted to Mac OS?
    If this is the case, is it something I can fix myself without loosing anything, or should I take it back to the place that recovered the data?
    ANY help would be greatly appreciated!

    Welcome to Apple Discussions!
    Yes the file naming probably was messed about with when they copied stuff over to FAT32. The files are probably there. However, the just need the correct file suffix to associate with the correct programs. A good way to test the files without hurting them is to view them in the Terminal with the program called More. Go to Applications -> Utilities -> Terminal and you will be greeted by a prompt. At the prompt type the word
    more
    followed by a space (do NOT hit enter)
    and drag the file into the terminal following the word "more" and then when the path appears, hit enter. If there is intelligible text, the file is probably an e-mail. If there is no intelligible text, it probably is an image, or a system file. Preview can open the files which are images and save them to specific formats. Depending on the number of files you had rescued, it might be better to ask them to rescue it again, but to a properly formatted volume. You can try yourself if you still have the old disk with Prosoft Data Rescue.
    In anycase, this is a very good lesson to always backup your data in the future as my FAQ explains:
    http://www.macmaps.com/backup.html
    Good luck!

  • Is there ODBC driver for excel flat file in Unix Box

    Hello guys
    I have a question about importing flat file sitting on Unix box into OBIEE. Normally, if the file is somewhere in Windows, I could just use a DSN for text file where I can set the location of the flat file and then be able to import using admin tool.
    However, if the file is sitting on the unix box, I wouldn't be able to define the path using that DSN driver since the location of the file doesnt belong to C: drive or E: drive like it does in Windows.
    So in this case, how would i be able to proceed? What third party ODBC could I use for flat file in Unix? Also, there is a file called ODBC.INI in Unix OBIEE directory, do I have to modify the content of that file too? If so how would I do it in order to be able to import flat file from Unix using Admin tool?
    Your thoughts?
    Thanks

    You'd need to export the Excel file to CSV or something like that, and then read it in from there.
    Thanks rnm.
    I am more curious about what you said above.. Could you explain a little more?
    Do you mean changing the flat file into CSV format? If so, the flat would still be in Unix location after the changing right? Or am I not understanding you completely?
    Thanks and please advice
    Cheers

  • JSP page download a file from unix box in DOS format

    Hi to all ..
    I have found many example to download a file from the server to the client like this
    <%
    StringBuffer buffer = new StringBuffer();
    try {
         FileInputStream fis = new FileInputStream("c:\\myfile.txt");
         InputStreamReader isr = new InputStreamReader(fis,"UTF8");
         Reader in = new BufferedReader(isr);
         int ch;
         while ((ch = in.read()) > -1)
              buffer.append((char)ch);
    out.print (buffer);
         in.close();
    } catch (IOException e) {
         e.printStackTrace();
    %>
    My problem is that the file is a text file and when i download I have in the file strange character ....
    How can i convert the file in DOS ???
    thank's in advance

    One of the main features of FTP's ascii mode is that it adjusts the line-ending characters based on the server's and client's operating system. It's a reasonable guess that these characters are the source of the OP's problem and that he's a beginner who doesn't know what he's doing. (The use of JSP scriptlets supports that theory.)
    In which case that Java code could be adapted to do the same thing, although it would have to determine the operating system of the client. This is sort of possible, but not for somebody who is just looking for code snippets to get their job done.
    However that's just one guess. There are other possible problems including character encoding: the input file can be read as UTF-8, which is hard-coded into the code, but perhaps the client is interpreting the non-ASCII characters in some other encoding. This would also cause "weird characters" to appear.
    At any rate it would be useful for the OP to do some basic research like finding out what these bad characters are.

  • Why does InDesign files create multiple boxes the size of the document when exporting as a PDF?

    Sometimes I need to place customer-supplied files into Illustrator templates to prepare for printing. If they have been originally created in InDesign and I need to make some adjustments in the file, I cannot isolate individual elements in the file. If I try to delete the box, half of the whole design may be deleted.

    This is an answer I posted to a similar question. The context isn't InDesign, but the kernel of the issue is the same: clipping masks. There are any number of recipes for producing PDF's and most of them result in a stack of media-sized clipping masks, or so that's how they parse when opened in Illustrator.
    PDF's output from drafting packages and other "foreign" sources, when opened for editing in Illustrator, quite often contain clipping masks and compound paths based on component associations that Illustrator (and its users) wouldn't typically make or recognize. Your drawing will come into Illustrator behaving like one big group that won't ungroup. That's because it isn't a group; it's a clipping mask based on the extents of the drawing. The first thing I do is select all, (Ctrl+A), then release clipping mask, (Ctrl+Alt+7). Pressing (Ctrl+Alt+7) repeatedly often reveals that there are other clipping masks nested within the large outer one. Most of the time, you can release all the masks this way without changing the appearance of anything. Each released mask usually leaves behind an invisible frame. (no stroke or fill), that you can delete or leave, depending on how intensive your editing will be. The release of nested masks may also result in groups and sub-groups that I also like to release similarly by pressing Ctrl+A then Ctrl+Shift+G repeatedly. Once you've done this, you should be able to select and treat any of the individual components on the artboard as desired, although you may still run into some compound path items that will hinder your selection process. These can also be released, but you'll want to be more cautious with respect to how it might alter appearances, especially if there are filled paths involved.

  • FTP files from Unix box to Windows ( Shell script )--inplemention in Apps

    Hi,
    I have an requirement like need to send files generated at a particular path in the UNIX sever into Windows machine.
    This should be a scheduler( can we create any shell script
    ) for this...
    Note : files generated at Unix move into Windows box....
    Please check and help on this... and let me know if any clarification required on my requirement.
    Thanks,
    Pavan K

    This is relatively easy to do. You will need to write the shell script code and register it as a concurrent program of type "Host". Pl see the Application Developer Guide (for 11i and R12) at http://www.oracle.com/technology/documentation/applications.html for details on how to register a shell script "Host" custom program.
    ML Docs 266268.1, 147455.1, 1013907.6 and 156636.1 have some more info too.
    HTH
    Srini

  • How to write a file in unix server through oracle plsql code

    Hi All,
    My requirement is to create and write a file (any file for eg txt file) in unix box with in a specified directory through oracle plsql code.
    Oracle sits in windows server.
    using utl_file package we can create directory where oracle resides and write it there in oracle server in our case windows..
    But here we need to create,write a file but in unix server which is different server than where the oracle server resides..
    we are using Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    Can any one one please help me out in this issue...
    Thanks in Advance.
    Prakash

    Mr Prakash,
    Why are you asking this question multiple times in every forum you can spell?
    Valid responses have been presented to you already two times.
    Can you explain why you can't follow them up, but continue to abuse this forum by repeating doc questions?
    Sybrand Bakker
    Senior Oracle DBA

  • Can you use command lines to copy files in UNIX to Oracle Apps

    Hi! We have installed the oracle apps 11.5.0 to a unix operating system. And we use ftps to upload the rtf and xml files to the unix server. Is there any command lines we can use to copy all the rft and xml files in the server to the real location of where the report files stored without going through the XML Publisher font end through the internet explorer? Thanks for your help!

    Hi,
    From what you have mentioned, I believe you are writing custom xml pub report
    1) Storing all your template and sample xml data file on Unix box by FTPing it. This step is not required as XML publisher picks template from XDO tables (where it is stored in CLOB), unless you are explicitly Coding to use templates from a fixed location like <CUST_TOP>/<xml_templates>
    2) As part of XML setup, you need to define the template and datasource using the front end. This causes the Template and XML data (sample) to be stored in XDO tables (as clobs). This step is basically required and unavaoidable.This step can be automated using FNDLOAD tool (not sure).
    Hope it helps somewhat.
    Neeraj

  • Upload the file in Unix at some specified directory

    Hi,
    I have to store some file in Unix Box at some specified location through OAF Page.
    I have seen all the threads, they work for storing the file in Database. I have done that previously and that works fine.
    Please let me know the approach and the way I should follow to store the file in Unix.
    Appriciate for an early reply.
    Thanks
    Anoop

    Anoop,
    What do you mean by the link has nothing? Do you mean that the link doesn't work?
    FIle Upload
    I can see it.
    If it still doesn't, try searching the forumns for the thread with subject "FIle Upload" posted by "user526196".

  • Flat File in Unix to DB in Windows

    HI
    As part of POC I am trying to interface from a flat file in Unix server to a Oracle DB in Windows machine.
    I can access the file in Unix box using telnet/FTP. The directory and the file has rw-rw-rw- permissions.
    I have ODI installed in Windows machine. I do not have an agent or anything installed in Unix machine.
    When the file is in Windows machine, I am able to interface data as required. But, when I try with file on unix machine, I get directory does not exist. I tried both absolute path using $HOME/<directory>.
    Is it possible to achieve such integration or is it mandatory to install ODI Standalone Agent (at least) on the unix machine.
    Regards,
    G V Ranjith

    Another option without installing the Unix agent is to install the samba share on the Unix and access that from Windows.
    This post will help you:
    Re: File not able to see in designer

  • Photoshop .psd files converted to Unix Executable files

    I'm an illustrator and I store my art on CDs and DVDs. After a period of time my files are converted from Photoshop .psd files to Unix Executable files and I can't open them. What can I do to get my work back??? -and keep this from happening in the future. Why does it do this????
    Thanks for any help.

    The file sizes range from 22.2 MB to 67.9 MB.
    Size isn't the issue then. Linc was asking that question because we see that with other file types. Older fonts in particular, which have all of their data in the resource fork. If that gets stripped, you end up with a zero byte file.
    Does that mean I'll have to go through the Adobe authorization process for Photoshop again?
    If the version of Photoshop you're currently using is already activated, then no. Either way, it has nothing to do with .psd files showing as UNIX executables.
    In Windows, any file that doesn't have an association to a program is displayed as a white, dog-eared piece of paper with the Windows logo in the middle. That's Windows' way of saying, "I have no idea what this is." In OS X, (except for those files which actually are UNIX executables), displaying them as such is OS X's way of saying the same thing.
    I thought I was home free when the icon changed to a thumbnail picture of the illustration, but PS refuses to open it saying it is not a Photoshop file. ???
    Now that is weird. As of Snow Leopard, Apple put the old Type and Creator codes to rest. It will read them as a last resort to try and identify an older file, but none of Apple's applications add them to any file they save. For better compatibility with Windows, and OS X's own underlying UNIX core, file extensions have taken their place. So adding a .psd extension should have worked. Without playing with one of your files, I couldn't tell you why Photoshop declared it wasn't a valid .psd image.
    On a side note, Apple added Uniform Type Identifiers to OS X to keep things separate. A big problem in Windows is that multiple apps may use the same file extension. EPS is a big one in printing. So you have Photoshop, Illustrator, Freehand, Quark and others all using .eps for Encapsulated PostScript files. However, Windows can only associate one application to any given extension. So if Illustrator happens to be the one tagged to .eps files, it will try to open any file ending in .eps, no matter what program actually created it. OS X keeps them separate with Uniform Type Identifiers. So even though multiple files may have .eps file extensions, the extra metadata keeps track of what program it actually belongs to.
    This is what is part of the LaunchServices database, and was why it was my first suggestion. If that database is wonky, you'll see weird things like this. Have you tried clearing it yet?
    The files are fine when newly burned to CD. It is only months, or years, later that they become Unix Executable Files.  This has happened to just about all of my CD backups and it's frustrating to think that CD backup doesn't work across newer OSs and Photoshop upgrades. I suspect that may be the problem, but it just shouldn't happen.
    That shouldn't make a difference. I've got a bunch of very old files created in Photoshop back from OS 8 on CD. No file extensions, as nothing did at the time. Just Type and Creator codes. They all open fine in PS CS5.5 in Snow Leopard, though the native Photoshop files do need to have a .psd extension added.

  • Quark files show as unix executable files.

    I have a strange issue. This is an all mac enviornment. The iMac's are running 10.4.11, and Quark express 6.0 One of the iMac's show the quark files as unix executable files. All of the other mac's can open the files without any issue.
    On the iMac that has an issue, some of the folders show up as unix executable files as well. Also, there is a network share that is a log in item that should auto mount when the user logs in, it no longer mounts automatically. The only way to mount the share is by navigating through finder.
    I was able to open one of the quark files by using open, then save the file using save as. this appended the file extension. I also enabled file extensions in finder, and manually appended the extension and they still would not associate with Quark. The file I did a save as does associate with Quark but it is the only one.
    I repaired disk permissions and that did not help. Anyone have any ideas on this one?

    I also couldn't find the download link for xsupport on the link you provided.
    Looks like they have changed their business model. I just copied the URL out of the aboutbox of my copy of the Xsuppport toll but didn't crosscheck it.
    Does that give any indication on what the problem is?
    Not really, perhaps a corrupted or unreadable (by permission) .DS_Store file in the folder where your Xpress files reside, but then again that should affect other clients as well.
    Which leads to the question:
    When some clients have the correct mapping document <-> Quark Xpress and one (or more) other(s) don't, do you connect with different users to the server or are the users always the samr but the connection made from different machines?
    If youuse different users to connect, then the problem very like is on the server side (addess rights, etc). If the same user has different results on different machines, the problem's most likely a local one. In which case you coud try all of ManiMenu's clean and deep clean actions.

  • Unix Executable Files and VLC index.dat file -Samsung Digimax S800

    Hi and thanks for any enlightenment in advance .
    I got my new iMac in January and it's great . I'm using it mostly for games iWeb and pro apps like Logic . I continue to use my trusty old eMac for email and internet chores .
    I was preparing to install Finale today and noticed the installation DVD had Adobe Reader 7.0.8 this led me to check "Adobe" with spotlight to make sure I already had it (I do) and I discovered a folder for Photoshop 7 settings so I looked to see if I had Photoshop (I don't:( ) , but I did find a folder titled Photoshop7 containing three files 2 Unix Executable Files titled AAAAAAAA2 and AAAAAAAA2M and a VLC index.dat file .
    "Command I" tells me they are all 4KB and were created March 4 2007 and are located at Library/Application Support/Adobe/Filebrowser .
    I think this was the time I was trying to get my new camera (Samsung Digimax S800) to download a movie . It didn't work and I have given up trying .
    So my question is , " Can I delete these "
    iMac 2.33 GHz- Powerbook - eMac   Mac OS X (10.4.8)  

    Hi terence
    Would I have any other adobe apps that came with my iMac besides Reader 7.0 ?
    I appear to have opened a can off worms trying to open Adobe for the first time .
    http://discussions.apple.com/thread.jspa?threadID=978019
    iMac 2.33 GHz- Powerbook - eMac   Mac OS X (10.4.8)  

  • Autosaved as Unix Executable Files after editing font size?

    When I open a .txt file in TextEdit, and change the font, in the Finder I see a new Unix Executable File appear, with (Autosaved) after the file name. This is in addition to the original .txt file - so there are now 2 files of the same name showing.
    However, when I manually save the file, the Unix exe file disappears from the Finder, leaving the newly saved .txt file.
    Is this normal? If not, please let me know what else I can try to fix it. I've already tried both suggestions in this thread & neither of them worked.
    Thanks!

    Ok I noticed that TextEdit preferences shows an option to "delete the automatic backup file" so that's why it's disappearing...
    ...but what happens if TextEdit quits on me unexpectedly (which it has before)? Will I be able to open the autosaved Unix executable file with TextEdit or will it be "unrecognized?"
    If anyone can give me confirmation that their autosaved files are Unix exe files and/or if they've been able to open the Unix exe backup files in the program they were created from, that would help.

  • Mac olm outlook files exported as unix executable files

    Hi There,
    I had to export all my mail in outllook 2011 on my MacBookPro due to size limitations with my company exchange account.  When I tried to import the exported file, I noticed it was identified as "unix executable file" & outlook could not import it.  I have tried to change the file extension but my Mac continues to handle the file as "unix executable file".  I am in complete panic as my entire email archive is contained in this exported file & I am unable to access it.  Any help is appreciated.  Thanks. 

    I just tried it and my .olm file is simply a blank document with no application assigned to open it. You need to do a Get Info on the file and select the application to open the file. You might have better luck getting your question answered at the Microsoft Office for Mac Outlook forum - http://answers.microsoft.com/en-us/mac/forum/macoutlook.
    Good luck,
    Clinton

Maybe you are looking for

  • How do I Get iTunes to Show How Many Albums/Songs In My Library?

    This took me a long time, I have very good sound at a low price, an important issue for me. I needed small speakers for my tiny space. I like to crank up my music and dance around my bedroom occasionally. I tried several different sets, over the last

  • WIN/Vista, PSE 7.0:  Organizer problems with dates

    Im working with our scanned photos now, so there is no EXIF data and the only dates are the scanned date and any later corrections in Photoshop CS3 before or after importing into PSE 7.0. I now have two date related problems that I didnt have with PE

  • Converting difficult PDF to Word

    I need to convert a PDF to Word.  I've tried "Save as" and "Export to" using Adobe XI, but still get many errors in the Word document.  Any tips or tricks?  Thanks!

  • ORA-01034 has me stumped!

    oracle 11.2.0.3 EE on OL 5.5 under VMworkstation This should be a no brainer, but all the usual suspects check out. Am configuring an repository db for Cloud Control. DB is on separate box from EM installation. EM install complained about existence o

  • Not able to active iCloud mail on mac

    I am not able to enable iCloud mail on Mac running Mac OS X lion 10.7.2. When I ticks Emails and Notes in the iCloud setting on my Mac. It says starting for a very long time and then it seem to end okay. But next time I enter the settings again the c