[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: "Karunakaran Perumbrayoor" <karunp@hexaware.com>
- Date: Thu, 13 Jul 2006 19:58:06 +0530
- Delivery-date: Thu, 13 Jul 2006 10:30:48 -0400
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
- Thread-index: Acamh/2flMzcyMSqT32ETZsxEa/huwAAKQ2w
- Thread-topic: [sqr-users] Stuck in array He!!
Laura...
I guess, you should have the "Read" inside the while loop. So it is just
iterating in the first line of the file. There would be an infinite loop
if more than one record is present in a file.
Just try making the change!!!
Regards...
Karun
-----Original Message-----
From: Laura Mayer [mailto:lmayer@gw.housing.umass.edu]
Sent: Thursday, July 13, 2006 7:36 PM
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
***************************************************************************************************************************
This e-mail communication and any attachments may be privileged and
confidential to Hexaware and are intended only for the
use of the recipients named above. If you are not the intended recipient,
please do not review, disclose, disseminate,
distribute or copy this e-mail and attachments. If you have received this email
in error, please delete the same alongwith
all attachments thereto and notify us immediately at mailadmin@hexaware.com .
***************************************************************************************************************************
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users