Still having trouble with conversion of ascii file 
Author Message
 Still having trouble with conversion of ascii file

First I want to thank the members of the group for their answers, hints.
Being new at writing more than just a couple of lines of code I guess
I misunderstand some hints or pieces of advice.
The file to be converted is flat ascii (not csv) fixed record
length (128)+CRLF.  A record can contain blanks, characters, numbers.
I already tried the following approaches, without success.
1. Defining dict. for FILE1 driver ASCII, record named Line, type String,

                      FILE2 driver TOPSPEED, record name Line, type String,

   generation of source, compiling, executing results in : FILE2 shows the
correct
   number of records but NO records.
2. Without generating of source (as described in help file), resulting in an
empty FILE2.
3. Writing the following source, compiles OK, executes without errors,
resulting in no FILE2 at all.
   Please check source and indicate where and what I am doing wrong.  I
would really like to get
   this up and running.
     ASC_DBF     PROGRAM
                 include('equates.clw')
                 MAP
                 END
     DOS_FIL     FILE,DRIVER('ASCII'),Name('dos_fil.dat'),PRE(DOS)
     RECORD      RECORD
     Line        String(128)
                 END
                 END
     CLAR_FIL    FILE,DRIVER('Clarion'),NAME('clar_fil.dat'),PRE(CLA)
     RECORD      RECORD
     Line        String(128)
                 END
                 END
     CODE
        OPEN(DOS_FIL)
        CREATE(CLAR_FIL)
        BUILD(CLAR_FIL)
        OPEN(CLAR_Fil)
        LOOP UNTIL EOF(DOS_FIL)
        CLA:Line=DOS:Line
        APPEND(CLAR_FIL)
     END
     RETURN



Mon, 20 Sep 1999 03:00:00 GMT  
 Still having trouble with conversion of ascii file

Quote:
>      CODE
>         OPEN(DOS_FIL)
>         CREATE(CLAR_FIL)
>         BUILD(CLAR_FIL)
>         OPEN(CLAR_Fil)
>         LOOP UNTIL EOF(DOS_FIL)
>         CLA:Line=DOS:Line
>         APPEND(CLAR_FIL)
>      END
>      RETURN

Your code should be:

  CODE
  OPEN(DOS_FIL)
  CREATE(CLAR_FIL)
  OPEN(CLAR_Fil)
  LOOP
    NEXT(DOS_FIL)
    IF ERRORCODE() THEN
      BREAK
    END
    CLA:Line=DOS:Line
    APPEND(CLAR_FIL)
  END
  BUILD(CLAR_FIL)
  RETURN

NOTE: The main problem is you weren't calling NEXT() to load the DOS
record.  Also NEVER, EVER use EOF, it will double the amount of time
processing the file (at least).

--

WebSite: <a
href="http://www.GreyMatter.co.uk">http://www.GreyMatter.co.uk</a>
Post: Grey Matter Ltd., Prigg Meadow, Ashburton, Devon, UK. TQ13 7DF
Tel: +44 (0)1364 654 100                    Fax: +44 (0)1364 654 200



Tue, 21 Sep 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Trouble importing ascii file into .tps database file.

2. Roberto Bozzolo- I'm having trouble opening your files

3. Having trouble writing to a file

4. Having trouble writing to a file.

5. Having trouble reading from a file....

6. RM-COBOL to ASCII file conversion

7. Bot-kit - having trouble using light sensors

8. Anyone else having trouble with GIFs?

9. Is Clarion Foundry Site Having Trouble?

10. If you are having trouble reaching ISE...

11. Having trouble with Lecroy 2373 Memory Lookup Unit

12. Having trouble printing front panel with consistent magins

 

 
Powered by phpBB® Forum Software