02-16-2016 11:14 AM
We currently run a number of SAS jobs by launching a .bat file. Now i am aware there is a limit on the characters when submitting via batch:
Now i assumed I could use this option per:
However it will not work, when it accepts the option for LRECL it ignores the specification of the LOG and PRINT locations and goes to the default instead. I am using Powershell to initial SAS which works fine until now that i have added additional characters which pushed it over its limit can anoyone see what is wrong?
$CMD = "C:\Program Files\SAS\SASFoundation\9.2\sas.exe"
$batch = "-batch"
$lrecl = "-lrecl"
$lrcelconfig = "1000"
$sysparm = "-sysparm"
$sysparmcode = ((Get-Date).ToString('ddMMMyy:HH:mm:ss'))
$config = "-CONFIG"
$configfile = "C:\Program Files\SAS\SASFoundation\9.2\nls\en\SASV9_SCHEDULER.CFG"
$sysin = "-SYSIN"
$sysinfile = "\\xxxxxxxxxxx\xxxx\xxxxxxxxxxxxxxx\xxxxxxxxx\xxxx\xxxxx\code\sy_ct_main_v1.sas"
$print = "-PRINT"
$printfile = "\\xxxxxxxxxxx\xxxx\xxxxxxxxxxxxxxx\xxxxxxxxx\xxxx\xxxxx\log\sy_ct_main_v1_$((Get-Date).ToString('yyyyMMdd_HHmm')).lst"
$log = "-LOG"
$logfile = "\\xxxxxxxxxxx\xxxx\xxxxxxxxxxxxxxx\xxxxxxxxx\xxxx\xxxxx\log\sy_ct_main_v1_$((Get-Date).ToString('yyyyMMdd_HHmm')).log"
& $CMD $batch $lrecl $lrcelconfig $sysparm $sysparmcode $config $configfile $sysin $sysinfile $print $printfile $log $logfile
Running: SAS 9.2 TS2M3
When i Run the above SAS runs but for some reason it is ignoring the Print and the Log Locations, however if remove the lrecl option it says you have to specifiy the log location which i know is the error where it has run out of space on the command.
02-16-2016 04:19 PM
02-17-2016 03:07 AM
The LRECL= commandline option of SAS does not affect the length of the commandline, it affects the length limit for external files (like your .sas, .log and .lst files). The length of the commandline is a limit set by the operating system.
The real reason for your problems might not be SAS at all:
Windows imposes a limit on the length of absolute pathnames (this also means fully qualified filenames) which is 260 bytes.
Similar limits exist in other OS's and the respective file system drivers (jfs, ufs, ext3/ext4 and so on all have a limit of 255 characters)
Try to reduce complexity. At the start of the script, cd to a directory from where you have short, simple shortcuts to your program, log, print and config file locations. From there, use relative paths.
Or reduce your path length overall. Just imagining having to type such monstrosities makes me cringe.