[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Reading Flat Files from SQR



Hi Srini,
It sure is possible......here's some sample code from an SQR that I've
written........


!*******************************************************
!    * define the input file
!*******************************************************
     move 'acctdept' to $filename
     let $input_file = 'c:\temp\' || $filename || '.dat'
     open $input_file as 1 for-reading record=80 status=#Open1
     if #Open1 = -1
        STOP QUIET
     end-if


This logic is in the Begin-Report section...it reads the file into a
variable, then separates each field into it's own variable.

        read 1 into $INPUT:80
        if #end-file = 1
           STOP QUIET
        end-if
        let $IN_ACCOUNT = RTRIM(SUBSTR($INPUT,1,5),' ')
        let $IN_DEPT    = RTRIM(SUBSTR($INPUT,6,5),' ')
        let $IN_PRODUCT = RTRIM(SUBSTR($INPUT,11,3),' ')



> ----------
> From:         Srinivasan S[SMTP:srinivasan.seetharaman@DB.COM]
> Sent:         Thursday, July 09, 1998 1:29 AM
> To:   Multiple recipients of list SQR-USERS
> Subject:      Reading Flat Files from SQR
>
> Hi all,
>      Is it possible to read a flat file(ASCII) file from SQR. We have a
> requirement where in , we would have to read a flat file and populate a
> table.
>
> TIA,
>
> Srini
>