PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: steven.rajski on July 20, 2021, 12:25:05 PM

Title: OPEN STATEMENT AND IOLIST
Post by: steven.rajski on July 20, 2021, 12:25:05 PM
I have code to OPEN and SELECT records from a file M1TEMP.  I want to print out the first 2 fields but get no data.

1340 OPEN:
1360 LET M1TEMP=%FILEOBJ'OPEN("M1TEMP")
2000 ! ^1000,20
2020 MAINLINE:
2080 SELECT * FROM "M1TEMP" BEGIN "" END $FF$
2140 PRINT M1TEMP.CUSTOMERNUMBER$," ",M1TEMP.SEQUENCENUMBER$; INPUT *
2160 NEXT RECORD
Title: Re: OPEN STATEMENT AND IOLIST
Post by: Devon Austen on July 20, 2021, 01:59:51 PM
line 2080 should probably be

2080 SELECT *,Rec="M1TEMP" FROM M1TEMP BEGIN "" END $FF$

Removing the quotes around M1TEMP in the from. M1Temp is the variable that holds the handle to the open file so you want to specify it. With the quotes you are specifying the string "M1TEMP"

You are also using a prefix before the field names but you do not have REC=prefix$ define in the select. You can either add the rec="M1TEMP" after the field list (in your case *) or you can modify the print to remove the M1TEMP. prefix on the fields.
Title: Re: OPEN STATEMENT AND IOLIST
Post by: steven.rajski on July 20, 2021, 02:10:33 PM
Thank you, Devon.  I'm new to pvx but I have been programming in BBx for many years.