Hi.
The underscore character is used by the ViewPoint and Sequel SQL syntax checking program and is a special character used to block variable value substitution. The first advise is to not use an underscore in the Variable name.
Next, if you want to include an underscore in the variable substitution, then you would need to concatenate the underscore character in your chgvar commands.
See my example below. We can pretty much get any part of a date you need, in my example, I am getting Year and Month from current date.
Copy/paste this example into a new script design and you should get a good idea of how to handle the file name with special characters.
DCL VAR(&YR) TYPE(*CHAR) LEN(15)
DCL VAR(&XX) TYPE(*CHAR) LEN(15)
CHGVAR VAR(&XX) VALUE(char(yyyymm(current date)))
CHGVAR VAR(&YR) VALUE('_' cat '&&XX')
SEQUEL/EXECUTE VIEW(SEQUELEX/CUSTLIST) PCFMT(*XLS) TOSTMF('/tmp/test_ABC&&YR.xls') REPLACE(*YES)