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

Re: Modify record in flat file



Hi Bruce.

        Inelegant solution 1:

        Create temp file that holds detail records
        Track number of detail records
        Write header record to new file
        read from temp file and write to new file

        Inelegant solution 2:

        Put a unique pattern in place of number of records
        After file created call 'perl' or 'tr' one liner from within SQR to
replace
                unique pattern with calculated value.

        Inelegant solution 3:

        Write details to array.
        Print header record
        Loop through array and print detail records

        Elegant Solution 1

        Change the specs.
        Place calculated value in TRAILER record.

HTH
John Milardovic

> -----Original Message-----
> From: Bruce Weinstein [SMTP:bruceweinstein@CANADA.COM]
> Sent: Tuesday, August 24, 1999 3:03 PM
> To:   Multiple recipients of list SQR-USERS
> Subject:      Modify record in flat file
> 
> I have a SQR that writes to a flat file.  Problem is the first record in
> the file is supposed to be a header record containing general info.  One
> item it is to contain is the number of records in the flat file.  I do not
> know this value until the very end of running this SQR.  What I need to be
> able to do is create my flat file with the header record as row 1, then
> when the SQR has finished writing to the file, go back and update  the
> header record with the number of records in the file.  My question is can
> I go back and update the header row (Row 1) after writing all the records
> to the file first?
>  
> Your help would be appreciated.
>  
> Bruce Weinstein
> E-mail: bruceweinstein@canada.com    
>