Stuart is an Avid Commentator
1 published comment for 2022
User bio
404 bio not found
Member since Jun 30, 2016

If you are trying to run arbitrary code from a Windows .BAT file, the following almost works:

ECHO ZN "%%SYS" DO ^^^^SECURITY HALT | C:\InterSystems\Cache\bin\cache.exe -s C:\InterSystems\Cache\mgr

The limitations are:

  • You have to specify the locations of the Caché or IRIS executable and the \mgr directory with an -s option.
  • One cannot redirect command input from the terminal, so what you run can't be interactive.
  • Quoting for Windows may annoy you.

If you are to store the encrypted identifiers in the database, database block encryption is your answer, but if you need to transmit them securely, before encrypting or hashing something as small as a nine-digit number add some salt. That is add enough random digits or letters to make a brute force attack unfeasible. Since you presumably want to be able to later decode these identifiers, use encryption in your case.

If you don't want to mess with SQL functions, this is still easy, especially taking advantage of date format 8 (ANSI):

    ; Return $HOROLOG date for first day of the month.
FIRST(y,m)    QUIT $ZDATEH(y*100+m*100+1,8)
    ; Return $HOROLOG date for last day of the month.
LAST(y,m)    SET m=m+1 SET:m>12 m=m-12,y=y+1
    QUIT $ZDATEH(y*100+m*100+1,8)-1

Test for this year with:

USER>FOR i=1:1:12 WRITE !,i," ",$$FIRST^DOM(2021,i)," ",$$LAST^DOM(2021,i)

1 65745 65775
2 65776 65803
3 65804 65834
4 65835 65864
5 65865 65895
6 65896 65925
7 65926 65956
8 65957 65987
9 65988 66017
10 66018 66048
11 66049 66078
12 66079 66109

Stuart has no followers yet.
Stuart has not followed anybody yet.
Global Masters badges:
Stuart has no Global Masters badges yet.