[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] Writing Variables to a file - only writes first line
- Subject: RE: [sqr-users] Writing Variables to a file - only writes first line
- From: "Bob Stone" <bstone@fastenal.com>
- Date: Wed, 31 Jan 2007 14:25:53 -0600
- Delivery-date: Wed, 31 Jan 2007 15:28:53 -0500
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
- Thread-index: AcdFccyslld0Eh0RRF+SyzlHrgvcbgAApxSgAAA2/iA=
- Thread-topic: [sqr-users] Writing Variables to a file - only writes first line
...oooh. I wonder if you're not reading the line INSIDE the loop. Or
if it's set up like a for loop, if you're not reading the 2nd line at
the end.
---------check that it's inside the loop
WHILE 1=1 !always loop
read 1 into $line
IF #END-FILE or ltrim(rtrim($line,' '), ' ') = ''
BREAK
END-IF
if T
do stuff
else
do other
end-if
END-WHILE
---------check that you read the 2nd line at the end
read 1 into $line !this is line 1
WHILE 1=1 !always loop
if T
do stuff
else
do other
end-if
read 1 into $line !this is line 2,3,etc.
IF #END-FILE or ltrim(rtrim($line,' '), ' ') = ''
BREAK
END-IF
END-WHILE
-----Original Message-----
From: Bob Stone
Sent: Wednesday, January 31, 2007 2:20 PM
To: 'This list is for discussion about the SQR database reporting
language from Hyperion Solutions.'
Subject: RE: [sqr-users] Writing Variables to a file - only writes first
line
if I understand what you're trying to do in pseudocode
open-read-file
open-write-file
while loop
read line(i)
if T
set-vars-1-way
else
set-vars-the-other-way
end-if
write-line-to-new-file
end-while
close-read-file
close-write-file
--------------------
you show us the 'WRITE-LINE-TO-NEW-FILE' (write-interface) procedure,
where if it's a T you write the columns 1 way, if it's not you write it
the other way. If you're only getting 1 of the lines back in the file,
and what's written below is your exact procedure, then the problem isn't
there. The problem must be when you're calling DO WRITE-INTERFACE.
Make sure you're calling it OUTSIDE of the IF statement that's parsing
the variables. Or if you'd rather have it inside, have it inside both
the IF and the ELSE.
-----Original Message-----
From: sqr-users-bounces+bstone=fastenal.com@sqrug.org
[mailto:sqr-users-bounces+bstone=fastenal.com@sqrug.org] On Behalf Of
Joe
Sent: Wednesday, January 31, 2007 1:52 PM
To: This list is for discussion about the SQR database reportinglanguage
from Hyperion Solutions.
Subject: [sqr-users] Writing Variables to a file - only writes first
line
I have a program that opens a flat file, extracts the data, appends a
character to one of the fields, then writes the data to another flat
file.
When I try this code:
============================================
begin-PROCEDURE Write-Interface
let #Batch_Counter2 = 0
IF $OUT-TYPE <> 'T'
Write 2 FROM
$OUT-TYPE:1
$OUTD-CRE-DATE:8
$OUTD-TRAN-UNIQ:2
$OUTD-SEQ:3
$OUTD-BUS-UNITz:5
$OUTD-MDCY:8
$OUTD-ACCOUNT:10
$OUTD-DEPTID:10
$FILLER1:8
$OUTD-PROD-ID:6
$OUTD-AMOUNT:11
$OUTD-DELIM:2
add 1 to #Batch_Counter2
ELSE
Write 2 FROM
$OUT-TYPE:1
$OUTT-COUNT:8
$OUTT-DEBITS:12
$OUTT-CREDITS:12
$UNKNOWN:2
$OUTT-DELIM:2
add 1 to #Batch_Counter2
END-IF
end-PROCEDURE Write-Interface
=============================================
I only get one row of data written to the file.
I tried setting a variable #STOP to 0 and only changing it to 1 at the
end of the ELSE statement above and then use 'While #STOP = 0" at the
beginning of this procedure, which causes the first row to be written
over and over again to the output file.
The data should contain about 40 different rows with an ending trailer
row.
Am I correct in trying to use a While statement? How have I miscoded
this?
TIA,
Joe
_______________________________________________
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