JEEP......here is what I use. I am not for sure what you are trying to accomplish, but what this does is places a prompt to the operator (which shows the actual stats count number) to use the "Stats Count" number from the "File Header" to put on their report for traceability. You will have to change the "Assign" number to suit your situation. I was issued this from another fine member of the board. It works like a charm for me.Basically, this VB steals the developed code from the original pcdmis file header(which houses the code) and places it in a prompt window for my operators. HTH.
ASSIGN/V3 = STR(GETTEXT(194,1,{FILEHEDR}))
ASSIGN/STATSCOUNT = STR(V3)
COMMENT/OPER,YES, IF YOU HAVE A NEW EPICOR SIGN OFF SHEET, WRITE THIS NUMBER IN IT'S PROPER
,FIELD. IF YOU NOT HAVE A NEW EPICOR SIGN OFF SHEET, JUST CLICK O.K
,STATSCOUNT
Ah, to set in the header: there are a bunch of tutorials that tell you how to do that.
Anyway, read CNC/READVARIABLE works on FANUC. I never got it to work on MAZAK. MazakConnect seems to have problems with it. Contact Hexagon because there have been improvements to Mazak Connect. Maybe they can send you the latest and greatest.
I'll try to PM you next week when I am back to work.