[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: dynamic variables question
- Subject: Re: dynamic variables question
- From: Wayne Ivory <wivory@WSL.COM.AU>
- Date: Wed, 29 Jul 1998 09:54:14 +0800
Clark, I really don't understand why you are doing this.
Analogy
------------
I have a job and I am trying to get from my house to my job. The following is a snippet of the task :
if CURRENTBLOCK = 2
WALK PAST FIRST HOUSE IN BLOCK 2
WALK PAST SECOND HOUSE IN BLOCK 2
WALK PAST SHOP IN BLOCK 2
WALK PAST THIRD HOUSE IN BLOCK 2
AVOID SAVAGE DOG ON BLOCK 2
WALK PAST FOURTH HOUSE IN BLOCK 2
END IF
I am doing this *40* times on the way to work, with more examples just like it.
I know one way to efficiently handle this is to use my car, but I don't
like messing with cars. Then I thought about turning myself into an electical
impulse and phoning myself to work but that doesn't seem to be working.
If I can get my conversion to electrical impulses to work I can replace the 40+
iterations of the above steps with only one. Here's what I have in testing :
------------------------
End of Analogy
I'm sorry if I seem to be having a bit of fun at your expense, but I think if there is a way to efficiently handle (as you yourself said) the problem at hand, then you should use it. A dozen arrays of 40 occurrences would not be a huge memory burden, and you don't have to invent some new-fangled way of tackling the problem (unless you are doing the dynamic variables thing just for the fun of it, which would be another matter).
Regards (and no offence intended)
Wayne Ivory
Information Services
Westralian Sands Limited
>>> "C. Willis III" <ceprn@hotmail.com> 28/7/98 11:28:41 pm >>>
Hello all,
I have an sqr, and I am trying to save some bytes within it. The
following is a snippet of the code :
if #REMITLINES = 2
LET $2B_INVOICE_ID = $OB_INVOICE_ID
LET $2INVOICE_DT = $OB_PAY_DOC_DT
LET $2B_VOUCHER_ID = $OB_VOUCHER_ID
LET $2B_PAID_AMT = $OB_PAID_AMT
LET $2B_PAID_AMT_GROSS = $OB_PAID_AMT_GROSS
LET $2B_DISCOUNT_TAKEN = $OB_DISCOUNT_TAKEN
LET #X_PAID_AMT = #OX_PAID_AMT
LET $2B_PYMNT_MESSAGE = $OB_PYMNT_MESSAGE
LET $2B_INVOICE_ID = RPAD($2B_INVOICE_ID, 16,' ')
LET $2B_VOUCHER_ID = RTRIM($2B_VOUCHER_ID,' ')
LET #PGSUB_PAID_AMT_GROSS = #PGSUB_PAID_AMT_GROSS + #X_PAID_AMT_GROSS
LET #PGSUB_DISCOUNT_TAKEN = #PGSUB_DISCOUNT_TAKEN + #X_DISCOUNT_TAKEN
LET #PGSUB_PAID_AMT = #PGSUB_PAID_AMT + #X_PAID_AMT
END-IF
I have this *40* times in the program, with more examples just like it.
I know one way to efficiently handle this is to use arrays, but I don't
like messing with arrays. Then I though 'dynamic variables', but that
doesn't seem to be working. If I can get dynamic variables to work I
can replace the 40+ iterations of the above code with only one. Here's
what I have in testing :
while #counter < #max_counter ! first code line
let $number = edit(#counter, '99') ! second code line
let $test_var = '$'||$number||'_paid_amount' ! 3rd
let [$test_var] = edit(#some_variable, '99999999999') ! 4th
end-while ! 5th
When I place a show statement within the code, $test_var does =
$1_paid_amount (for the first one), like it should, but I get the
following error on the 3rd line of code:
Error on line 3:
(SQR 4000) Result #variable or $variable or '=' missing in
expression.
let [$test_var] = edit(#some_variable, '99999999999')
Errors were found in the program file.
I am using sqr v4.1 when I run this. Any ideas? Is this something that
is not allowed, or am I getting something wrong in the syntax?
clark
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com