Network access on Windows Host file commands

Good morning

I'm probably overlooking something very basic, but I'm running on Win2016 with Cache  2016.2 - All the work I am doing is in INT routines, but I'm making some calls to the Host File system using $ZF(-1).

I have a few mapped Network drives that are mapped in Windows, typically these are locations where I want to back up some files.

My process is quite simple:

1. Read data

2. Zip data files using RAR

3. Create folder on Network drive

4. Move RAR files to new network share.

I've tried a few different commands:

S LOC="G:\RAN\Backup1\",CMD="MD "_LOC,X=$ZF(-1,CMD)

S LOC="\\data1\data\RAN\Backup1\",CMD="MD "_LOC,X=$ZF(-1,CMD)

I'm unsure if its a limitation of Cache to do this sort of thing, or if I should created a BAT file and then kick off a Windows call to run the BAT file.

Basically I just want to be able to create and move files to a Network drive (which is something I've never had to do before in Cache) and was surprised it just didnt work.

Any hints or tips gratefully received.  I should note that this is probably a Newbie question, but have been doing flavours of M for 29 years....so when someone tells me the obvious basic answer, I can slap my own wrists!

 

  • + 1
  • 1
  • 134
  • 3
  • 3

Answers

As you describe it I'd create a nice BAT file that you execute.
It coud be static or created ad hoc just by writing it from Caché

And then execute it using $ZF(-1...) ,$zf(-2....) or CPIPE 

Though Caché has powerful utilities around %File class you will be faster that way

[based on ~40 yrs of M]

Thanks for this...needed a sanity check.

I have just tried a BAT file, works when I run from Windows explorer, not if I run from the terminal.

Tried ##class(%File).CreateNewDir too and just got a -1808 returned.

#GivenUp!

Error shows that it's access/user error:

ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT

    1808 (0x710)

    The account used is a computer account. Use your global user account or local user account to access this server.

perhaps user OpenM must be created with admin permissions in the server you want to store files.

Cache runs as a service under SYSTEM account.

Check that this user has access to a network drive.