﻿ Replies by Benjamin Irwin for InterSystems Developer Community

Rochdi,

Can you please expand on your needs.  Does what you are showing above work for you or are you getting errors?

The key is in your picture "Value DoesNotMatch" "3N.1""-""2N.1""-""4N"

This is MUMPS/Cache/IRIS pattern matching.  This pattern is looking for 3 numbers, a hyphen, 2 numbers, a hyphen, and 4 numbers.  In your custom rule you would be checking for 13 numbers at a minimum.  You could check for a gender match on that digit.  Also verify the citizenship digit.

"Value DoesNotMatch" "13N"

Wesley,

I am a retired Cache/MUMPS developer and have far too much time on my hands.  However, I think I have found a smooth and reliable way to accomplish what you need.  This was fun.  Thanks for the challenge.

CSZ
New X,CSZ
Set CSZ(\$Increment(CSZ(0)))="CANTON,TX.,75103"
Set CSZ(\$Increment(CSZ(0)))="MILFORD, OH 45150"
Set CSZ(\$Increment(CSZ(0)))="MILFORD OH 45150"
Set CSZ(\$Increment(CSZ(0)))="KANSAS CITY, MO, 12345"
Set CSZ(\$Increment(CSZ(0)))="KANSAS CITY MO, 12345"
Set CSZ(\$Increment(CSZ(0)))="ST. LOUIS MO, 12345"
Set CSZ(\$Increment(CSZ(0)))=" ST. LOUIS MO, 12345"
For X=1:1:CSZ(0) Write \$\$CSZ2(CSZ(X)),!
Quit
CSZ2(CSZ)
New CSZF,SC,CITY,STATE,ZIP
Set CSZF=CSZ
Set CSZF=\$Zconvert(CSZF,"U")
Set CSZF=\$Translate(CSZF,",."," ") // Translate to spaces
Set CSZF=\$Zstrip(CSZF,"<=>"," ") // Remove Leading, Trailing, and multiple spaces.
Set SC=\$Length(CSZF," ") // Count the number of spaces
Set CITY=\$Piece(CSZF," ",1,(SC-2)) // Select the multiple of city pieces
Set STATE=\$Piece(CSZF," ",(SC-1)) // Select one less the the max piece.
Set ZIP=\$Piece(CSZF," ",SC) // Select the max piece.
Quit CITY_"|"_STATE_"|"_ZIP

VISTA>D CSZ^CSZ
CANTON|TX|75103
MILFORD|OH|45150
MILFORD|OH|45150
KANSAS CITY|MO|12345
KANSAS CITY|MO|12345
ST LOUIS|MO|12345
ST LOUIS|MO|12345

Wesley,

Your example is a great usage of the \$Piece statement.

Set REC="CANTON,TX.,75103"

Set CTY=\$Piece(REC,",",1)

Set STA=\$Piece(REC,",",2)

Set ZIP=\$Piece(REC,",",3)

Sorry, I didn't see all the responses before answering.

Beyond Compare works outside of Studio and can compare files, folders, and it even does an Ok compare of Word files.  I have used it to track project changes as a manager to keep track of the changes the developers were making.  It worked great and we were able to catch some issues early in the project so that they could be fixed quickly.

This is really helpful Vitaliy Serdtsev.  Thanks for this information.  I set this up with Beyond Compare and it works great.  Do you know of anyway to get it to work across namespaces?  It would be nice to be able to compare a routine from one namespace to another.

 Compare Compares an open file to one that you select with Browse. You must have specified an external compare tool with the Compare setting in Options > Environment > General. To work correctly, the compare tool must be able to accept command line parameters as tool.exe file1 file2. Tested compare tools are Microsoft Windiff and Perforce p4Diff.exe.

One of the best tools that I have found for comparing routines is called "Beyond Compare".  You can create a small CSP that will serve up the a routine depending on the routine name in the query string of the URL.  Then you can put that URL directly in the file open dialog of "Beyond Compare" that it will bring up the routines and display a nice side-by-side compare.  It can also save the comparison in an HTML file for sharing with others.

I may not understand the question, but the best way to avoid the above error would be to correctly specify the namespace in the batch file.  For example the "VISTA" namespace in the following command line needs to be an existing namespace.

C:\InterSystems\Cache\bin\Csession.exe cache -U VISTA "^WBSS"

Allan,

There are Cache versions on the VA anonymous drive.  They usually keep the latest and a few previous versions available.

I actually have a cache-2017.1.1.111.0-win_x64, but I am not sure if Intersystems would want me to share it.

Thanks, Ben