[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] read variable length delimited fields from a file -ALSO, no CRLF at end of records.....
Sharon,
Here is something that I just wrote ... have fun.
This uses Oracle SQR (not PeopleSoft SQR).
===================================================================
Begin-Setup
Declare-Variable
Integer #Start #Index #EOL
Integer #Length #FileSize
End-Declare
End-Setup
Begin-Report
Let $Filename = 'r.sqr'
If Exists($Filename)
Show 'Required file "' $Filename '" not found'
Stop Quiet
Else
Let #FileSize = FileSize($Filename)
Open $Filename As 1 For-Reading Record=#FileSize:Fixed
Read 1 Into $B:#FileSize Status=#Status
Close 1
Let #Length = Length($B)
If #Length != #FileSize
Show 'Didn''t properly read "' $Filename '"'
Show ' Okay: ' #FileSize Edit 888888
Show ' Got: ' #Length Edit 888888
Stop Quiet
End-If
Encode '<13><10>' Into $EOL
Let #EOL = Length($EOL)
Let #Start = 1
Let #Index = InStr($B, $EOL, #Start)
While #Index
Let #Length = #Index - #Start
Let $R = SubStr($B, #Start, #Length)
Show $R
Let #Start = #Start + #Length + #EOL
Let #Index = InStr($B, $EOL, #Start)
End-While
End-If
End-Report
Peter
-----Original Message-----
From: sfedak@enwin.com [mailto:sfedak@enwin.com]
Sent: Wednesday, December 17, 2008 1:30 PM
To: sqr-users@sqrug.org
Subject: [sqr-users] read variable length delimited fields from a file - ALSO,
no CRLF at end of records.....
Hi Everyone,
I see a posting for this question:
Q. How can I read in variable length delimited fields from a sequential
file...........and I have viewed the results.
My only issue is that I also recieve these records in one continuous
string in the file - no CRLF. It's actually an EDI file There will be
some kind of character to show end of record (say it's 'XX'). Can you
help me with the code to look for this character? I'd appreciate any
help you can give :-)
Thanks and HAPPY HOLIDAYS!!!
Sharon
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users