PxPlus User Forum

Twitter Twitter Twitter

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - RobL

Pages: [1]
1
Language / Re: password protected data files
« on: October 12, 2020, 04:26:16 PM »
Hi Paula,

You could try opening the files with a dummy (or null) password and then process the returned error code. Here's an example;

begin
!
! create a file with no password
erase "FileNoPass",err=*next
keyed "FileNoPass",[1:1:10],0,0
!
open (1)"FileNoPass"
write (1)"test","some data"
close (1)
!
! create a file with a password
erase "FileWithPass",err=*next
keyed "FileWithPass",[1:1:10],0,0
!
open lock (1)"FileWithPass"
password (1)"secret" required for open and on data
write (1)"test","some data"
close (1)
!
! process list of files
for filename$ from "FileNoPass,FileWithPass,MissingFile,"
!
print "processing filename: ",filename$
!
filechan=unt; open input (filechan,key="",err=*next)filename$
if tcb(2) then if err=12 then print "   *** file ",filename$," is missing."
!
close (filechan)
!
next

Regards,

Rob Leighton

2
Programming / Re: Binary auto increment key
« on: October 09, 2020, 07:22:27 PM »
Hi Peter,

That's an interesting idea, but I think it has to do with type of auto-increment field being used. I tried creating a blank-filled and zero-filled auto-increment and those 2 types allowed the field to be initialized to either "" (null), " " (blank) or $00$. In all 3 cases the fields are part of an internal key.

Regards,

Rob


3
Programming / Re: Binary auto increment key
« on: October 09, 2020, 12:27:40 PM »
Hi Michael,

I'm no auto-increment key expert, but here's an example that seems to work correctly.

begin
!
! define the file
erase "testfile",err=*next
keyed "testfile",[0:1:4:"I"],0,-1000
!
testfile=unt; open (testfile,rec=testfile$,iol=testfile)"testfile"
testfile:iolist id$:[chr(4)],cust_num$,cust_name$
!
! write some data records
for recnum=1 to 5
testfile.id$=dim(4,$00$)
testfile.cust_num$=str(recnum:"000000")
testfile.cust_name$="Customer "+testfile.cust_num$
write (testfile)
next
!
! display records in file
select *,rec=testfile$ from testfile begin ""
print hta(kec(testfile))," - ",testfile.cust_num$," - ",testfile.cust_name$
input *; if ctl=4 then escape
next record

In Gords' post, he indicated that the variable containing the auto-increment must be blank, but I could only get it to work by filling it with $00$'s.

Hope this helps (and is correct!!)

Regards,

Rob Leighton

4
Programming / Re: Getting Text of a Program Line Number
« on: June 01, 2020, 12:37:04 PM »
Hi Jeffrey,

Take a look at the utility program "*pg.cnv". It can be used to convert a program file to a text file (and vice versa).

Regards,

Rob Leighton

5
Programming / Re: Selecting all list_box entries
« on: September 19, 2019, 01:02:13 AM »
Hi James,

I found the following in an email posted by Mike King (dated 12/03/2007) on the old PxPlus Mailing List.

<snip>
If you happen to be using PxPlus use the FIND option to read all the values then issue a WRITE to enable them.

For example:

0010 LIST_BOX 10,@(10,5,40,10),OPT="#"
0020 FOR I=1 TO 50
0030 LIST_BOX LOAD 10,0,STR(RND(10000):"0000")+STR(RND(10000):"0000")
0040 NEXT I
0050 LIST_BOX FIND 10,0,X$
0060 LIST_BOX WRITE 10,X$
0070 ESCAPE

The FIND on line 50 gets a string containing all the values, then you can write this back to the control in order to select all the items.

... so basically all you need to do is:

LIST_BOX FIND 10,0,X$
LIST_BOX WRITE 10,X$
</snip>

Is that what you're looking for?

Regards,

Rob Leighton
Riverwood Enterprises Inc.

6
Hi Mike,

I see my error. Thanks!

But... when I was trying to figure out if the issue was on my end, I tried doing an online update to PxPlus 2016 and PxPlus 2017 and I got the same "Unable to connect..." error message. However, I've just tried updating them again, and now I'm receiving the expected "There are no updates available..." message.

Regards,

Rob

7
Hi,

A message box containing the message "Unable to connect to the update server to obtain patch list" is displayed when I try to apply the September 2019 update to PxPlus 2019.

Can someone point me in the right direction to correct this issue?

Thanks in advance!

Rob Leighton
Riverwood Enterprises Inc.

8
Language / Re: XEQ() question
« on: September 11, 2018, 12:32:08 PM »
Hi Mike,

You are correct! It can be eliminated. There was a reason at the time, but not anymore. Thanks for the second look!

Regards,

Rob

9
Language / Re: XEQ() question
« on: September 10, 2018, 12:04:16 PM »
Chris:

Using a unique variable name is the approach I used in the past that I'm trying to avoid. Normally, I'd just use global functions, but in this instance I'm trying to create a standalone module that will have zero impact on the existing codebase.

There aren't alot of these functions, but they are used throughout this module. In some timing tests I did, using XEQ / CALL performed as quickly as global functions, and a nice side benefit is you can single-step through the code when debugging. I even thought about using objects, but that seems like overkill...
 
Mike:
Thanks! #1 is the obvious answer (now that you've pointed it out) and #2 will come in handy for something else!

Regards,

Rob

10
Language / XEQ() question
« on: September 07, 2018, 02:06:12 PM »
Hello all!

I'm experimenting with using a combination of a local function, XEQ() and a CALL routine, as a substitute for using a global function. I've got it working and I'm happy with the results, except for one issue. I can't figure out how to LOCALize the variable that returns the value from the CALL routine.

Here's an example:

! test
begin
extension$=".exe"
print "extension$ - before: ",extension$
file_ext$=fnget_extension$("myfile.jpg")
print "file_ext$: ",file_ext$
print "extension$ - after: ",extension$
end
!
def fnget_extension$(local filename$)=xeq("functions;get_extension",extension$,filename$,extension$) ! get the file extension from the specified filename

! functions
GET_EXTENSION:! get file extension from the specified filename
enter (filename$),extension$
extension$=""
p=pos("."=filename$,-1)
if p then extension$=filename$(p+1)
exit

Here's the output :
->run
extension$ - before: .exe
file_ext$: jpg
extension$ - after: jpg
->

I tried adding LOCAL to parameters in the XEQ() statement, but that results in an error 20.

Is there any way to prevent extension$ from being modified?

Regards,

Rob Leighton
Riverwood Enterprises Inc.

Pages: [1]