dbTalk Databases Forums  

Subroutine called from dictionary is corrupting active select list.

comp.databases.pick comp.databases.pick


Discuss Subroutine called from dictionary is corrupting active select list. in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ChrisAdams
 
Posts: n/a

Default Subroutine called from dictionary is corrupting active select list. - 02-08-2007 , 09:31 AM






I am having a problem where I have created a subroutine which performs
a number of selects to return a quantity, sounds simple but, in this
subroutine I check SYSTEM(11) at the beginning to see if an external
select list is active, if so I READLIST to put it into an array,
therefore killing the select list. I then perform my necessary selects
and calculate the quanties checking the params that allows for a
period selection by historical months. .ie. -1, -2, -3...etc. At the
end I check the array from the external select list and then FORMLIST
to create an active external select list again.

This subroutine works when I call it from another program and all
lists are maintained as I would of expected. However, when I put my
subroutine into dictionaty items for calculating say 1 months and 2
months history

QUANTITY.1
001:V
002:SUBR('CALC.QUANTITY', @ID, '-1')
003:
004:Qty
005:5R
006:S

QUANTITY.2
001:V
002:SUBR('CALC.QUANTITY', @ID, '-2')
003:
004:Qty
005:5R
006:S

And I try to list the relevant file

LIST INVENTORY QUANTITY.1 QUANTITY.2

Inventory Qty1 Qty2
XXXXX*223233 20 0

I only get correct figures for the first dictionary and zeros for the
second. It is like the internal select list from the first is being
used in the second dictionary?!

When listed individually I get the correct figures.

LIST INVENTORY QUANTITY.1

Inventory Qty1
XXXXX*223233 20

LIST INVENTORY QUANTITY.2

Inventory Qty2
XXXXX*223233 10

I think the when READLIST'ing and FORMLIST'ing the pointer is getting
out of synch when performing each dictionary on after another.

Can anyone help? I'm going insane!!


Reply With Quote
  #2  
Old   
Mark Brown
 
Posts: n/a

Default Re: Subroutine called from dictionary is corrupting active select list. - 02-08-2007 , 01:47 PM






This is apparently not D3, so I claim no inside knowlege, but can you try
calling the subroutine twice from a program as happens when the dict
processing takes place? Does that work properly? Since it works as a
single column but fails on two, does it work when called twice as well? If
it does not fail, then there's an intrinsic difference between the basic
list handler and the query language.

When you are doing your other selects, is it possible you're doing an
execute? On D3, an execute will kill an active select list. Instead of
readnext and storing ids in an array, can you simply select your new data to
specific List Variables as in

select filename to myList
readnext id from myList...

instead of relying so heavily on the default file variable which is
obviously in use at a higher level.

Mark


"ChrisAdams" <cadams (AT) zafire (DOT) com> wrote

Quote:
I am having a problem where I have created a subroutine which performs
a number of selects to return a quantity, sounds simple but, in this
subroutine I check SYSTEM(11) at the beginning to see if an external
select list is active, if so I READLIST to put it into an array,
therefore killing the select list. I then perform my necessary selects
and calculate the quanties checking the params that allows for a
period selection by historical months. .ie. -1, -2, -3...etc. At the
end I check the array from the external select list and then FORMLIST
to create an active external select list again.

This subroutine works when I call it from another program and all
lists are maintained as I would of expected. However, when I put my
subroutine into dictionaty items for calculating say 1 months and 2
months history

QUANTITY.1
001:V
002:SUBR('CALC.QUANTITY', @ID, '-1')
003:
004:Qty
005:5R
006:S

QUANTITY.2
001:V
002:SUBR('CALC.QUANTITY', @ID, '-2')
003:
004:Qty
005:5R
006:S

And I try to list the relevant file

LIST INVENTORY QUANTITY.1 QUANTITY.2

Inventory Qty1 Qty2
XXXXX*223233 20 0

I only get correct figures for the first dictionary and zeros for the
second. It is like the internal select list from the first is being
used in the second dictionary?!

When listed individually I get the correct figures.

LIST INVENTORY QUANTITY.1

Inventory Qty1
XXXXX*223233 20

LIST INVENTORY QUANTITY.2

Inventory Qty2
XXXXX*223233 10

I think the when READLIST'ing and FORMLIST'ing the pointer is getting
out of synch when performing each dictionary on after another.

Can anyone help? I'm going insane!!




Reply With Quote
  #3  
Old   
ChrisAdams
 
Posts: n/a

Default Re: Subroutine called from dictionary is corrupting active select list. - 02-09-2007 , 02:39 AM



On Feb 8, 7:47 pm, "Mark Brown" <mbr... (AT) drexelmgt (DOT) com> wrote:
Quote:
This is apparently not D3, so I claim no inside knowlege, but can you try
calling the subroutine twice from a program as happens when the dict
processing takes place? Does that work properly? Since it works as a
single column but fails on two, does it work when called twice as well? If
it does not fail, then there's an intrinsic difference between the basic
list handler and the query language.

When you are doing your other selects, is it possible you're doing an
execute? On D3, an execute will kill an active select list. Instead of
readnext and storing ids in an array, can you simply select your new data to
specific List Variables as in

select filename to myList
readnext id from myList...

instead of relying so heavily on the default file variable which is
obviously in use at a higher level.

Mark

"ChrisAdams" <cad... (AT) zafire (DOT) com> wrote in message

news:1170948692.803319.170060 (AT) a75g2000cwd (DOT) googlegroups.com...



I am having a problem where I have created a subroutine which performs
a number of selects to return a quantity, sounds simple but, in this
subroutine I check SYSTEM(11) at the beginning to see if an external
select list is active, if so I READLIST to put it into an array,
therefore killing the select list. I then perform my necessary selects
and calculate the quanties checking the params that allows for a
period selection by historical months. .ie. -1, -2, -3...etc. At the
end I check the array from the external select list and then FORMLIST
to create an active external select list again.

This subroutine works when I call it from another program and all
lists are maintained as I would of expected. However, when I put my
subroutine into dictionaty items for calculating say 1 months and 2
months history

QUANTITY.1
001:V
002:SUBR('CALC.QUANTITY', @ID, '-1')
003:
004:Qty
005:5R
006:S

QUANTITY.2
001:V
002:SUBR('CALC.QUANTITY', @ID, '-2')
003:
004:Qty
005:5R
006:S

And I try to list the relevant file

LIST INVENTORY QUANTITY.1 QUANTITY.2

Inventory Qty1 Qty2
XXXXX*223233 20 0

I only get correct figures for the first dictionary and zeros for the
second. It is like the internal select list from the first is being
used in the second dictionary?!

When listed individually I get the correct figures.

LIST INVENTORY QUANTITY.1

Inventory Qty1
XXXXX*223233 20

LIST INVENTORY QUANTITY.2

Inventory Qty2
XXXXX*223233 10

I think the when READLIST'ing and FORMLIST'ing the pointer is getting
out of synch when performing each dictionary on after another.

Can anyone help? I'm going insane!!- Hide quoted text -

- Show quoted text -
Hi Mark,

Yeah this is not D3 it is Unidata, sorry, should of put that.

I did try to select my data to a specific numbered list andI had to
set $BASICTYPE "U" at the top of my subroutine to allow this but I did
a standard approach of "SELECT...... TO 1" ....READNEXT KEY FROM 1

But by doing this it had a different effect as all the resulting
"columns" showed the same data.

Thatnks for the suggestion but when I call it from another program
mulitple times it works as expected.

I am also using SELECTINDEX to select the indexed portion of the data
file first and then buillding a filtered select on that active select
list with a PERFORM to select the records?!!



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.