Hi Ken,

There is an easier way.

Instead of fiddling around with unpredictable params you just pass your whole symbol table = local variables
to your background job like this and use what you need in background

JOB ##class(%SYSTEM.OBJ.FM2Class).All():(:1):5

look for process-params + switch  here
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

Evgeny,

in SQL you have a CASE ... END block for selection

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

CASE 
  WHEN search_condition THEN value_expression
  [ WHEN search_condition THEN value_expression ... ]
  [ ELSE value_expression ]
END

CASE value_expression
  WHEN value_expression THEN value_expression
  [ WHEN value_expression THEN value_expression ... ]
  [ ELSE value_expression ]
END

That's fine and nothing new.
You missed my point:

With the Class Query it's not self explaining if params got to Prepare() or to Execute()
http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?P...

I just learned from  John Murray a few comments above

Prepare() is for dynamic SQL, but in your case it's a class query you want to run.
So change your rs.Prepare call to be an rs.Execute one.


that you don't need a prepare with a Class Query.
I wasn't aware of that until a few hours ago.

Then it's obvious that any param has to go to Execute().

If the owner of a table is _PUBLIC, users do not need to be granted object privileges to access the table.

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

based on that you can build an OWNER that has also limited rights (only SELECT, REFERENCES, .. or whatever) 

So you do it for this Owner only

As you said all are unique

I try to summarize it simple:
IDkey is used in storing object s. Best to be translated : Global subscript of data store.
Could be defaulted to %Integer >0

Unique key defines an index with unique values of a property in parallel to IDkey. Checked during object save.

PrimaryKey comes from SQL world and could be interpreted  mostly as a synonym to IDkey
 

ENSDEMO>d $system.SQL.Shell()
SQL Command Line Shell
----------------------------------------------------
 
The command prefix is currently set to: <<nothing>>.
Enter q to quit, ? for help.
ENSDEMO>>select * from Ens_Config.Credentials
1.      select * from Ens_Config.Credentials
 
ID      BusinessPartner PasswordObject  Password        SystemName      Username
 
.... Rows(s) Affected

try 

Do ##class(%SQL.Util.Procedures).CSVTOCLASS(2, .rowType, pFileName, pDelimiter,,1) 
;; no defaults if not required or the EXACT count:  9 params = 8 comma   
;; I counted 9 

and/or

Property Name As %String (MAXLEN="");

and/or

;; the last comma in rowType looks also suspect to me.

set  rowType=" . . . .    ,ActiveStatus Boolean" 

HTH