Jump to content


Click the link below to see the new game I'm developing!


Photo
- - - - -

Problem writing to an ASCII file


7 replies to this topic

#1 Raul Fernandez

Raul Fernandez

    Member

  • Members
  • PipPip
  • 10 posts
  • Gender:Male
  • Location:Carolina, Puerto Rico

Posted 17 June 2002 - 11:18 PM

Hello,

I'm working with C-ISAM file. I defined an ASCII file with external format flagged as YES and file type SEQ.

The problem:
my output file has fixed length, so I decide to define a field for each field requested. When I run the function I received the following error:

101 - INVALID EXTERNAL TYPE
< FILE NAME >
LS #: < ls screen were fields are assigned >

Then I decide to change the fields for just one with the full size (359 chars). I'm not longer getting the error describe above but instead I'm getting other one describe below:

Because the record is a fixed length I fill the field with space to complete the field length. The weird thing is that at the end of the record PROIV is not writing the spaces I'm telling to. By the way I'm writing CR+LF at the end of the line.

Thank You
Raul Fernandez

#2 Stuart Burton

Stuart Burton

    Advanced

  • Members
  • PipPipPip
  • 71 posts
  • Gender:Male
  • Location:Luton, United Kingdom

Posted 18 June 2002 - 05:18 AM

Setting the external type on the field of the sequential file to ALPHA should do the trick.

#3 Shaun Rudland

Shaun Rudland

    Expert

  • Members
  • PipPipPipPip
  • 165 posts
  • Location:Queensland, Australia

Posted 18 June 2002 - 05:26 AM

G'Day Raul,

See posting thread on 29/09/01 from S Kater.

Also, because PRO-IV strips trailing spaces you will need to place a character in the last position of your last field; maybe an asterisk (*) or some such.

Regards

Shaun
PRO-IV free for 385 Days B)

#4 Shaun Rudland

Shaun Rudland

    Expert

  • Members
  • PipPipPipPip
  • 165 posts
  • Location:Queensland, Australia

Posted 18 June 2002 - 05:28 AM

... apologies, should read September 20 not 29.
PRO-IV free for 385 Days B)

#5 Wim Soutendijk

Wim Soutendijk

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 216 posts
  • Gender:Male
  • Location:Netherlands

Posted 18 June 2002 - 05:44 AM

If you set the external file type to BIN instead of SEQ, PRO-IV will not strip the trailing spaces anymore.
It also won't add an CR/LF character, so you will have to take care of that yourself.

#6 Raul Fernandez

Raul Fernandez

    Member

  • Members
  • PipPip
  • 10 posts
  • Gender:Male
  • Location:Carolina, Puerto Rico

Posted 18 June 2002 - 12:45 PM

Hi, I set the external file type to BIN, but now I have all records just in one line. How can I put the records one by one?

Thanks,

Raul Fernandez

#7 Wim Soutendijk

Wim Soutendijk

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 216 posts
  • Gender:Male
  • Location:Netherlands

Posted 18 June 2002 - 01:12 PM

Add a field to your file definition called CRLF, len 2
Fill that with CHAR(10) if you are on unix or CHAR(13) + CHAR(10) if you are on Windows

#8 Aprile

Aprile

    Member

  • Members
  • PipPip
  • 15 posts

Posted 19 June 2002 - 01:14 PM

If you are simply trying to extract c-isam data records to a text file as a one-shot or occasional activity (not an automated process), you might try the demo version of Protrack utility from www.net-aware.com, as it has the capability to extract c-isam file data to a user-formatted ascii file. The DEMO version has limits on file size, but if your c-isam file isn't huge it might work for you.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Click the link below to see the new game I'm developing!