Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Switching accounts within a program

66 views
Skip to first unread message

Simon Verona

unread,
Jan 20, 2022, 3:00:21 AM1/20/22
to OpenQM
I'm looking to be a little more "efficient" with the use of virtual machines in our datacentre.

Currently, we run a sandbox for each one of our customers with a QM account for that customer.   The application is run from a web service interface which runs outside of QM with a no of phantoms which service a FIFO queue generated from that service.

That's all background.

Each web call that comes in has the system id in it.  

What I proposed was to host multiple small systems on one machine by duplicating the data account - one per "system" and having the software run in another account.

What that means though is that I need to be able to either switch data account within the program (effectively a LOGTO within the program) or to be able to dynamically open a file in a different account.

I know in jBASE for example you can do OPEN 'd:\dataaccounts\customername\filename' .... to do just this.

I know I could build Q -pointers on the fly for the process, but even then it won't be ideal as we regularly use statements such as EXECUTE 'SSELECT FILE' RTNLIST List   which would use the local file.

Any thoughts ?

Martin Phillips

unread,
Jan 20, 2022, 4:50:34 AM1/20/22
to ope...@googlegroups.com

Hi Simon,

 

Could you use QM’s extended filename syntax to do this? Something like

   OPEN “MYACC:MYFILE” TO FVAR

where MYACC:MYFILE is the account and filename with a colon between them.

 

There is, of course, no reason why the name could not be constructed dynamically by the application.

 

Use of the extended syntax require the FILERULE configuration parameter to be set appropriately as it slightly weakens system security.

 

 

Martin

 

From: ope...@googlegroups.com <ope...@googlegroups.com> On Behalf Of Simon Verona
Sent: 20 January 2022 08:00
To: OpenQM <ope...@googlegroups.com>
Subject: Switching accounts within a program

 

EXTERNAL EMAIL




--
You received this message because you are subscribed to the Google Groups "OpenQM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openqm+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openqm/d8cccf16-0b04-46b5-ab59-5ff51b84b176n%40googlegroups.com.

================================
Rocket Software, Inc. and subsidiaries ■ 77 Fourth Avenue, Waltham MA 02451 ■ Main Office Toll Free Number: +1 855.577.4323
Contact Customer Support: https://my.rocketsoftware.com/RocketCommunity/RCEmailSupport
Unsubscribe from Marketing Messages/Manage Your Subscription Preferences - http://www.rocketsoftware.com/manage-your-email-preferences
Privacy Policy - http://www.rocketsoftware.com/company/legal/privacy-policy
================================

This communication and any attachments may contain confidential information of Rocket Software, Inc. All unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify Rocket Software immediately and destroy all copies of this communication. Thank you.

KOSDAY SOLUTIONS

unread,
Jan 20, 2022, 4:51:04 AM1/20/22
to OpenQM
Hi Simon
In QM you can do 
myaccount="TEST.ACCOUNT"

OPEN myaccount:":MYFILE" TO F.MYFILE ELSE ABORT
and 
EXECUTE "SELECT ":myaccount:":MYFILE" RTNLIST XXX

Only you need change your "FILERULE" configuration parameter to 7 in qmconfig

HTH
Angel

Steve Trimble

unread,
Jan 20, 2022, 9:43:19 AM1/20/22
to OpenQM Group
Simon:
I have used Coyote as my web server since around 1996.
Since 'Coyote' is itself an account on QM, I have used the 'FILERULE' to open or perform selects. I have mine set at '7'. I use a hybrid method.
I have a agent/company file that contains client information.
One of the fields describes the 'account name' and another field contains the 'data portion'. An account example value looks like this: 'WEBMATE:' A data portion looks like this 'CDMI'.
I have an INCLUDE_OPENFILES record that is part of every program. Here is a program code snippet:

NOTE: Only open the files needed (or open ALL of them). I am stingy and ONLY open then files needed for this particular program.

OPENFILES = ''
OPENFILES<-1> = \VCAT.CTL\
OPENFILES<-1> = \VCAT.INDEX\
OPENFILES<-1> = \VCAT.MERCH\
OPENFILES<-1> = \VCAT.TEMPLATE\
$INCLUDE WEBMATE:ECO.PGMS INCLUDE_OPENFILES
IF ERRMSG # '' THEN GOTO 20000


here is a snippet of INCLUDE_OPENFILES
THEPATH     = COOKIE<4>
DATAPORTION = COOKIE<8>
FILESERR    = ''
*
NUMFILES = DCOUNT(OPENFILES,@AM)
FOR II = 1 TO NUMFILES
   OPENFILE = OPENFILES<II>
   BEGIN CASE
      CASE OPENFILE = \BILLTO\
         THEFILE = THEPATH:\BILLTO,\:DATAPORTION
         OPEN THEFILE TO BILLTOFILE ELSE FILESERR<-1> = THEFILE
      CASE OPENFILE = \CUSTOMER\
         THEFILE = THEPATH:\CUSTOMER,\:DATAPORTION
         OPEN THEFILE TO CUSTOMERFILE ELSE FILESERR<-1> = THEFILE
      CASE OPENFILE = \EMAILOUT\
         THEFILE = THEPATH:\EMAILOUT,\:DATAPORTION
         OPEN THEFILE TO EMAILOUTFILE ELSE FILESERR<-1> = THEFILE

   END CASE
NEXT II
*
IF FILESERR # '' THEN
   NUMERRS = DCOUNT(FILESERR,@AM)
   FOR II = 1 TO NUMERRS
      IF ERRMSG # '' THEN ERRMSG = ERRMSG:\<\:\br>\
      ERRMSG = ERRMSG:\Can't open \:FILESERR<II>:\ file.\
   NEXT II
END

The account WEBMATE has files like this:
BILLTO,CDMI
CUSTOMER,CDMI
EMAILOUT,CDMI
etc
The above method lets me use the same DICT for selects, etc that look like this:
THEFILE = THEPATH:"CUSTOMER,":DATAPORTION
STMT = \SSELECT \:THEFILE:\ WITH ZIP = "72116" BY LNAME BY FNAME
EXECUTE STMT CAPTURING RESULT

IF SYSTEM(11) THEN
 SELECTE TO ITEMID.LIST
END ELSE
 CRT \No items selected while performing:\
 CRT STMT
 CRT \<Enter> \:;INPUT DIO
 STOP
END

Now is each client has its own account, all I do is revise the INCLUDE_OPENFILES to this (notice no DATAPORTION variable) :
THEPATH     = COOKIE<4>
FILESERR    = ''
*
NUMFILES = DCOUNT(OPENFILES,@AM)
FOR II = 1 TO NUMFILES
   OPENFILE = OPENFILES<II>
   BEGIN CASE
      CASE OPENFILE = \BILLTO\
         THEFILE = THEPATH:\BILLTO\
         OPEN THEFILE TO BILLTOFILE ELSE FILESERR<-1> = THEFILE
      CASE OPENFILE = \CUSTOMER\
         THEFILE = THEPATH:\CUSTOMER\
         OPEN THEFILE TO CUSTOMERFILE ELSE FILESERR<-1> = THEFILE
      CASE OPENFILE = \EMAILOUT\
         THEFILE = THEPATH:\EMAILOUT\
         OPEN THEFILE TO EMAILOUTFILE ELSE FILESERR<-1> = THEFILE

   END CASE
NEXT II
*
IF FILESERR # '' THEN
   NUMERRS = DCOUNT(FILESERR,@AM)
   FOR II = 1 TO NUMERRS
      IF ERRMSG # '' THEN ERRMSG = ERRMSG:\<\:\br>\
      ERRMSG = ERRMSG:\Can't open \:FILESERR<II>:\ file.\
   NEXT II
END

Fun stuff, right?

Computerized Data Mgmt Inc
Steve Trimble
(501) 772-3450 cell / text


Dennis Bartlett

unread,
Jan 26, 2022, 4:25:02 PM1/26/22
to OpenQM
There's a simpler way. 

Have separate VOC files - one for each account, with all the files/settings pointing to that account, remote pointers to paragraphs etc. 
Write a file opens include that reads the VOC record for each file and opens the file accordingly. 

When you want to change accounts, simply open the new VOC to F.VOC, set a parameter flag, and call your standard file opening routine.  
The flag tells every program to 
- open all files again, 
- read new parameter records from Control, and 
- redo selects.

Simon Verona

unread,
Jan 31, 2022, 7:48:42 AM1/31/22
to OpenQM
Thanks for all the input.

with regards to switching VOC files - how do I actually do that ?   Is there a setting as to which file is the current "VOC" ?    I can easily create a VOC for each system in exactly the way you describe.   

If I CREATE.FILE a new file - how do I ensure it's stored in the correct account?  

Thanks
Simon

Roger Flatt

unread,
Jan 31, 2022, 8:16:59 AM1/31/22
to ope...@googlegroups.com
Would "LOGTO xxxx" be useful here? 
[Like the SQL "USE" equivalent.]
R.

Dennis Bartlett

unread,
Feb 1, 2022, 12:29:34 PM2/1/22
to ope...@googlegroups.com
All of this runs in a control account, XXX where only parameter files for itself exist

In the control account, have multiple files VOC_AAA, VOC_BBB, etc, each a copy of that account's VOC

To change Account, say to BBB, overwrite the current VOC definition with that of VOC_BBB, and logto XXX, set a named common flag to reopen files, redo selects, etc

In the logto to itself, ie whilst in XXX logto XXX, 

You received this message because you are subscribed to a topic in the Google Groups "OpenQM" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openqm/YLTyMTLayhE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openqm+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openqm/CABO8Bkem_cOBDncCwE_u3Y_eAPTwFnQ%2BczVdJ9d2d2F_eiAg-w%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages