[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] Stuck in array He!!
- Subject: RE: [sqr-users] Stuck in array He!!
- From: "Don Duwe" <dduwe@nookind.com>
- Date: Thu, 13 Jul 2006 10:33:29 -0400
- Delivery-date: Thu, 13 Jul 2006 10:37:58 -0400
- Importance: Normal
- In-reply-to: <s4b61b08.083@gw.housing.umass.edu>
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
WHILE 1
READ 1 into $DATA:?
IF #END-FILE
BREAK
END-IF
CODE-------------------
END-WHILE
-----Original Message-----
From: sqr-users-bounces+dduwe=nookind.com@sqrug.org
[mailto:sqr-users-bounces+dduwe=nookind.com@sqrug.org]On Behalf Of Laura
Mayer
Sent: Thursday, July 13, 2006 10:06 AM
To: sqr-users@sqrug.org
Subject: [sqr-users] Stuck in array He!!
Morning,
I inherited this code from a prior employee and from what I can discern it
creates an infinite loop that keeps iterating through all the records in a
text file over and over again. I can't seem to fix it. I've even made it so
there are only 9 records in the text file.
Be advised it is the crudest code I have ever come across. What its supposed
to do is read a text file into an array and process the data. It never seems
to finish.
Is there a better way to write this mess?
Thanks for any and all help you can offer
Laura
!************************************************************************
Begin-Procedure Select_Records
!************************************************************************
! Reads input file. Selects Roommate data from Preference file
! Searches Roommate1 Array and Roommate2 Array for Roommate Matches
! Decides if the record needs to be printed
! Decides which report the record should be placed in
! Write data to Array (Prefer)
! For each inputID, if it is not in proccessing id array, put it in array.
! Then find its roommates. If found (Match), put its roommate's id into
array.
!************************************************************************
Read 1 into $Input_Str:8
let #index=0
While not #End-File
let $InputEmplid = substr($Input_Str, 1, 8)
let $EMPLID = $InputEmplid
Do Check_If_ID_Printed !if input Id has been proceed
if $ID_Printed='N' ! not processed
let IDPrinted.emplid(#Index) = $EMPLID !add id to array.
ID
processed
add 1 to #index
let $PrintFlag = 'Y'
let $period = $parm_proc_cd ! only run period
Do Get_Roommate ! find input id's pref record (building
if $Preference_Found='Y' ! found row in perf table
if $RoomMateFound='N' ! but both rm1 and rm2 empty
let $prType = 'S'
else !Has rmts
let $InputIdRM1= &A.UMH_PREF_ROOMMATE1
let $InputIdRM2= &A.UMH_PREF_ROOMMATE2
let $EMPLID= &A.UMH_PREF_ROOMMATE1 ! input id' roommate1
Do Get_Roommate !find rmt1'rmts for run period
if $Preference_Found='Y'
Do Get_Mutual_Type
else !no perf in run period, may try another period
!show 'not perf rmt1= ' $EMPLID
if $RunPeriod='2' or $RunPeriod='3' !105720 or 105730
Do Look_Next_Period
else ! run period is not 20 or 30
let $prType = 'N'
let $PrintFlag ='Y'
end-if
end-if
end-if
Do Fill_Array
end-if
end-if !end of no processed
Read 1 into $Input_Str:8
end-while
Do Show_Array
End-Procedure
!***************************************************************************
**
! Check arry to find if this id already processed.
Begin-Procedure Check_If_ID_Printed
!***************************************************************************
**
let $ID_Printed ='N'
Let #Start = 0
While (#Start <= #Index) and $ID_Printed = 'N'
If IDPrinted.emplid(#Start) = $EMPLID
let $ID_Printed = 'Y'
add 1 to #Start
end-if
end-while
End-Procedure
_______________________________________________
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