[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
[sqr-users] Re: SQR Help....
Harold,
It looks like you've already successfully posted this message
to the sqr-users group. You should get a good response.
The basic read loop looks like this:
open $input_name as 1 for-reading record=32767:vary
open $output_name as 2 for-writing record=32767:vary
while 1
read 1 into $line:32767
if #end-file
break
end-if
if isblank(substr($line,1,1))
let $line = 'D' || substr($line,2,length($line)-1)
end-if
write 2 from $line
end-while
close 1
close 2
Ray
On Wed, Oct 22, 2003 at 05:33:48AM -0400, DJ Bishop wrote:
> Ray -
>
> I came across your website while scanning the posts at sqrug.org. I
> joined the group and am anxiously awaiting the okay to post. In the
> meantime I need your help.
>
> I've just started working in SQR, and I've been "thrown into the fire"
> literally with my current project. I've spent most of the day scanning
> posts and reviewing sample code (both online and in print).
>
> Given:
> File Name: FLATtest.txt (straight flat file, no commas or ticks)
>
> Primary Mission:
> (1) Read/Scan File...
> (2) Where position 1 is blank, insert letter 'D' into position 1 and
> null positions 26 - 36.
>
> ***** ROUGH CODE SO FAR *****
>
> Begin-Procedure Read-AT-File
> !
> ! Open FLATtest.txt
> !
> open 'FLATtest.txt' as 1 for-reading record=78:vary
>
> Do-Read-AT-File
>
> if #end-file
> break ! End of file reached
> end-if
>
> ! Close FLATtest.txt
> close 1
>
> End-Procedure ! Read-AT-File
>
>
>
> Begin-Procedure Update-AT-File
> !
> ! Open FLATtest.txt
> !
> open 'FLATtest.txt' as 2 for-writing record=78:vary
>
> Do-Update-AT-File
>
> if position (+1) is null
> write 'D' into position (+1)
> write ' ' into position (+26)
> write ' ' into position (+27)
> write ' ' into position (+28)
> write ' ' into position (+29)
> write ' ' into position (+30)
> write ' ' into position (+31)
> write ' ' into position (+32)
> write ' ' into position (+33)
> write ' ' into position (+34)
> write ' ' into position (+35)
> write ' ' into position (+36)
> end-if
>
> while 2 ! loop until break
>
> if #end-file
> break ! End of file reached
> end-if
>
> ! Close FLATtest.txt
> close 2
>
> End-Procedure ! Update-AT-File
>
> ************* EOF ***********
>
> If Possible:
> (1) Save original file as FLATtest.orig
> (2) Save updated file as FLATtest.new
>
> NOTE: Please be reminded that I just started coding in SQR and I'm just
> getting used to how it works. My machine isn't even configured to
> compile yet, so I'm not even sure if the syntax so far is correct. I
> have the logic down, it's just translating it properly is my issue now.
>
> Any assistance would be greatly appreciated.
>
> Thanks,
> H. Peacock
> hpeacock@yahoo.com
----------------------------------------------------------------------
Ray Ontko rayo@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788
Ray Ontko & Co. Software Consulting Services http://www.ontko.com/
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users