Missing Date in Generated Filenames via Autosys
search cancel

Missing Date in Generated Filenames via Autosys

book

Article ID: 441038

calendar_today

Updated On:

Products

Autosys Workload Automation

Issue/Introduction

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:

  • Manual Execution: FILENAME_20260227.txt
  • AutoSys Execution: FILENAME.txt

Environment

  • Product: AutoSys Workload Automation
  • Component: System Agent (Unix/Linux)

Cause

There are two primary causes identified for this behavior:

  1. Syntax Error in Sourced Profile: A trailing double quote or incorrect character in a sourced properties file (e.g., FileProperties.txt) causes the variable assignment to fail or return an empty string.
  2. Profile Sourcing Timing: The environment profile may not be fully sourced at the exact time the command evaluates the variables, especially if they are used in JIL parameters like std_out_file or within the script immediately upon execution.

Resolution

Step 1: Correct Sourced File Syntax

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.)

Step 2: Configure Agent for Immediate Sourcing

To ensure that profiles and their variables are available immediately upon job execution, update the agentparm.txt on the System Agent:

  1. Locate the agentparm.txt file in the agent installation directory.
  2. Add or update the following parameters

    oscomponent.profiles.src.delay=false
    oscomponent.noforceprofile=false

  3. Restart the System Agent to apply the changes.

Step 3: Verify Variable Construction

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}"