PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Jim Morton on November 27, 2024, 12:51:30 PM

Title: Select statement not returning values
Post by: Jim Morton on November 27, 2024, 12:51:30 PM
On pxplus 15.10 debian version the below select statement does not return values from the record.
Pxplus 15.10 redhat version works properly.

What gives?

0010 open (hfn)"data/SO/SORSOH"; sorsoh=lfo
0020 select a0$,a5$,*,c5$,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,a4$ from sorsoh begin %a0$ end %a0$+%lc$
0030 print "Select returned '"+a0$+a5$+c5$+a4$+"'"
0040 print len(a0$+a5$+c5$+a4$)
0050 break
0060 next record
0100 read (sorsoh,key=%a0$,dom=*next)
0110 read (sorsoh,end=EOF)a0$,a5$,*,c5$,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,a4$
0120 print "Read returned '"+a0$+a5$+c5$+a4$+"'"
0130 print len(a0$+a5$+c5$+a4$)
0140 EOF:stop
-;
-;run
Select returned ''
 0
Read returned '01033482IDBNN           NNNN          '
 38
-;
Title: Re: Select statement not returning values
Post by: Devon Austen on November 27, 2024, 03:37:30 PM
I would suspect it has something to do with "end %a0$+%lc$" in the SELECT directive.

If you do the same without a end do you get the records for %a0$ plus whatever is after them?

If so you may just need to get the end correct.
Title: Re: Select statement not returning values
Post by: Jim Morton on November 27, 2024, 04:41:06 PM
I removed the end and get the same thing.
%a0$="01" is the company number and there are 11,000 + records that begin with "01"
%lc$=$8E$
As I said it works properly using the redhat version of pxplus.

-;list
0010 open (hfn)"data/SO/SORSOH"; sorsoh=lfo
0020 select a0$,a5$,*,c5$,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,a4$ from sorsoh begin %a0$
0030 print "Select returned '"+a0$+a5$+c5$+a4$+"'"
0040 print len(a0$+a5$+c5$+a4$)
0050 break
0060 next record
0100 read (sorsoh,key=%a0$,dom=*next)
0110 read (sorsoh,end=EOF)a0$,a5$,*,c5$,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,a4$
0120 print "Read returned '"+a0$+a5$+c5$+a4$+"'"
0130 print len(a0$+a5$+c5$+a4$)
0140 EOF:stop
-;?%a0$
01
-;run
Select returned ''
 0
Read returned '01033482IDBNN           NNNN          '
 38
-;
Title: Re: Select statement not returning values
Post by: Devon Austen on November 28, 2024, 08:50:29 AM
This may be a bug that results in undefined behavior. That may be why you see it at one install but not another.

Can you try a newer version of PxPlus? That version is out of support and there have been many improvements to the SELECT directive logic since then. It is possible if this is a bug that it already has been fixed.

Other thoughts is it may have to do with a difference between the two installs. Maybe there is a difference in system parameters or something that could explain it not working. The 'SO' system parameter perhaps?
Title: Re: Select statement not returning values
Post by: Jim Morton on December 04, 2024, 08:31:48 AM
Parameter 'SO' is off for both installs. We tried up to V17.10 with same results.
We will try V19 when we get new keys and I will let you know.