Following up to Alnoor's edited post above. Below is the revised script that is in production Alnoor added some debug lines to determine where the intitial failure point. Working like a champ now. Hats off to Alnoor's 911 support!
! rename "..\\hrms\Transfer Files\RHC HRMS\RHC_TaxUpdateFile.csv" to "..\\hrms\Transfer Files\RHC HRMS\Archived\RHC_TaxUpdateFile"+DTE(0:"%Ys%Mz%Dz%Hz%mz%sz")+".csv"
Dbg = 0
! tmpFileName$ is VI variable for just source file name
! tbl$ is VI variable for full path of source file name
IF Dbg {
IF coSession'CS {
PRINT 'DIALOGUE'(10,10,90,40); SET_PARAM 'NL','MC' ; ESCAPE
} ELSE {
PREINPUT -1301; PREINPUT -1302; SET_PARAM 'NL','MC' ; ESCAPE
}
}
LOCAL tmpDATE$=DTE(0:"YYYY-MM-DD")
LOCAL tmpTIME$=DTE(0:"%Hz-%mz")
LOCAL tmpMoveTo$ = "\\pcs9100\Client\Archive\" !CHANGE THIS
LOCAL tmpDestFile$, tmpSrcFile$, tmpMoveCMD$
tmpDestFile$ = STP(tmpMoveTo$,1,DLM) + DLM + "SFSPayroll_" + tmpDATE$ + "_" + tmpTIME$ + "_" + STP(tmpFileName$,1,DLM) !CHANGE THIS
tmpSrcFile$ = STP(tbl$,1,DLM) ! Strip trailing slashes if it exists
tmpSrcFile$ = SUB(tmpSrcFile$,"[wdx]","") ! Strip the [wdx] which exists in tbl$ if OnHost not checked
tmpMoveCMD$ = "Move " + QUO + tmpSrcFile$ + QUO + " " + QUO + tmpDestFile$ + QUO
IF coSession'CS AND NOT(ImportFileOnHost$ = isYES$) {
CALL coSession'Wdx$ + "..\SOA\SYZDLL;PROCESS_FILES",tmpMoveCMD$
} ELSE {
CALL "..\SOA\SYZDLL;PROCESS_FILES",tmpMoveCMD$ !covers CS with ImportFileOnHost AND Mas90 style
}
WAIT .5
! If you get an Error 27 add another line that says EXIT or RETURN
------------------------------
Jeff Schwenk
Owner
Bottomline Software, Inc.
Waynesboro VA
(540) 221-4444
Improving bottom lines for over 25 years!
------------------------------
Original Message:
Sent: 10-31-2024 13:32
From: Alnoor Cassim
Subject: VI Failing
Ah nice scheme to use scheduled .BAT files (or even PowerShell scripts) to move these to an archive folder at end of day! Thx for sharing that. Given we do custom programming, the all-in-one is normal for me. Sometimes though custom imports are not ProvideX but scheduled BOI scripts where the VBScript equivalent is done for archiving to a different folder.
------------------------------
Alnoor Cassim
Accounting Systems, Inc. (ASI)
------------------------------
Original Message:
Sent: 10-31-2024 13:14
From: Kevin Moyes
Subject: VI Failing
Good to know, thanks Alnoor!
For the archive folder, in the past I have convinced clients to do that at the end of the day (separate / scheduled batch commands), and not really received resistance to the idea. Having your script to do it all-in-one step may come in handy if someone insists in the archive-folder-move being done immediately. :-)
------------------------------
Kevin Moyes
Technical Systems Analyst
Munjal White Consulting Co.
Toronto ON
Original Message:
Sent: 10-31-2024 12:01
From: Alnoor Cassim
Subject: VI Failing
Kevin - That's a nice scheme to rename to .imported, which is in fact hard to confuse, so long as they let you use the same folder. I have one similar to that. In Jeff's case it's a different folder. One thing quickly though is change the close line to be like this below. The one you have, originally from Slade, was for earlier Sage versions where the import file was opened on channel 1.
close (Imp_CH, err=*next)
------------------------------
Alnoor Cassim
Accounting Systems, Inc. (ASI)
Original Message:
Sent: 10-31-2024 10:57
From: Kevin Moyes
Subject: VI Failing
I try to keep things simple. My version of the rename script changes the file extension to ".imported"... which is hard to confuse with a file that still needs to be processed.

Then set up a daily command line batch file on the server (Windows Task Scheduler) to move *.imported files into the Archive folder. A two piece solution, but easy to support / troubleshoot.
! Rename the source file (originally created by Slade Hornick)
!
! Put the Import file in something more manageable
f$=ImportFileName$
!
! Close the source file, before trying to move it
close (1,err=*next)
!
! Create a name for the new file
f_new$=f$+"-"+dte(0:"%Y%Mz%Dz-%Hz%mz%sz")+".imported"
rename f$, f_new$
exit
------------------------------
Kevin Moyes
Technical Systems Analyst
Munjal White Consulting Co.
Toronto ON
Original Message:
Sent: 10-31-2024 08:48
From: Jeff Schwenk
Subject: VI Failing
Wow, THANKS!!!
------------------------------
Jeff Schwenk
Owner
Bottomline Software, Inc.
Waynesboro VA
(540) 221-4444
Original Message:
Sent: 10-31-2024 00:32
From: Alnoor Cassim
Subject: VI Failing
Jeff,
As you alluded to, permissions for the service account could cause that error as well but here is another thought in case the target location is fully accessible from the client side.
Instead of a single RENAME command and worrying about how the Sage service is setup and it's access to the target folder, it can be done from the client side. This method below directly uses the operating system Move command. So if you like, start by placing a ! in front of your RENAME as I've done below to comment the line out then paste in the rest. I did the renaming a bit differently than you. Note I haven't actually tested this so just verify the tmpMoveTo$ points to the correct target path.
! RENAME \\hrms\Transfer Files\RHC HRMS\RHC_TaxUpdateFile.csv TO \\hrms\Transfer Files\RHC HRMS\Archived\RHC_TaxUpdateFile +DTE(0:"%Ys%Mz%Dz%Hz%mz%sz")+".csv"
! tmpFileName$ is VI variable for just source file name
! tbl$ is VI variable for full path of source file name
LOCAL tmpDATE$=DTE(0:"YYYY-MM-DD")
LOCAL tmpTIME$=DTE(0:"%Hz-%mz")
LOCAL tmpMoveTo$ = "\\hrms\Transfer Files\RHC HRMS\Archived\"
LOCAL tmpDestFile$, tmpSrcFile$, tmpMoveCMD$
tmpDestFile$ = STP(tmpMoveTo$,1,DLM) + DLM + "RHC_TaxUpdateFile_" + tmpDATE$ + "_" + tmpTIME$ + "_" + STP(tmpFileName$,1,DLM)
tmpSrcFile$ = STP(tbl$,1,DLM) ! Strip trailing slashes if it exists
tmpSrcFile$ = SUB(tmpSrcFile$,"[wdx]","") ! Strip the [wdx] which exists in tbl$ if OnHost not checked
tmpMoveCMD$ = "Move " + QUO + tmpSrcFile$ + QUO + " " + QUO + sDestFile$ + QUO
IF coSession'CS AND NOT(ImportFileOnHost$ = isYES$) {
CALL coSession'Wdx$ + "..\SOA\SYZDLL;PROCESS_FILES",tmpMoveCMD$
} ELSE {
CALL "..\SOA\SYZDLL;PROCESS_FILES",tmpMoveCMD$ !covers CS with ImportFileOnHost AND Mas90 style
}
WAIT .5
! If you get an Error 27 add another line that says EXIT or RETURN
------------------------------
Alnoor Cassim
Accounting Systems, Inc. (ASI)
Original Message:
Sent: 10-30-2024 19:09
From: Jeff Schwenk
Subject: VI Failing
Thanks all. I am now heading in the right direction. Alnoor, great observation. To your first thought, I did hit accept and the import did work. The resulting error message indicated the file was in use (it wasn't). So to your second thought, that is the likely culprit. The folder on the other server is probably not allowing the service account access.
I will post back tomorrow.
------------------------------
Jeff Schwenk
Owner
Bottomline Software, Inc.
Waynesboro VA
(540) 221-4444
Original Message:
Sent: 10-30-2024 16:23
From: Alnoor Cassim
Subject: VI Failing
Hey Jeff - The syntax looks OK but 2 things:
- Know that On Completion perform logic does NOT run when you click Test button so this bit will not fire off. You have to click Accept.
- The execution of the perform logic might be firing off from the server which means it would use the Sage App Server service account. If that service is using say LocalSystem or a non-domain Windows account, then it won't be able to deal with the UNC path. TO KNOW FOR SURE, try running the import while logged in Mas90 style.
------------------------------
Alnoor Cassim
Accounting Systems, Inc. (ASI)