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

[sqr-users] Flat-File Manipulation 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

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users