When running a script via AutoSys (CMD job), files are generated without the expected date suffix in the filename. However, when the same script is executed manually from the server command line, the date is correctly appended to the filenames.
Example:
FILENAME_20260227.txtFILENAME.txtThere are two primary causes identified for this behavior:
FileProperties.txt) causes the variable assignment to fail or return an empty string.std_out_file or within the script immediately upon execution.Review any files being sourced by your script for syntax errors. In this case, a trailing double quote in an sqlplus command was preventing the variable VAR_LWD from being populated.
Incorrect Line: Last_Week_Day=\echo "..." | sqlplus -s /@DATABASE"``
Corrected Line: Last_Week_Day=\echo "..." | sqlplus -s /@DATABASE`` (Note: The extra double quote before the final backtick was removed.)
To ensure that profiles and their variables are available immediately upon job execution, update the agentparm.txt on the System Agent:
agentparm.txt file in the agent installation directory.If the variable is still not populating, ensure it is being constructed using available environment variables in the script:
export LWD_DATE='date+%Y%m%d'
export VAR_LWD="_${LWD_DATE}"