El problema lo tienes en que debes de poner una variable al describir el fichero en vez de un literal. Y rellenar la variable en tiempo de ejecución con el contenido deseado.
Cambia esto
SELECT PreviRed ASSIGN DISK "C:\INFORMES\WS-PREVIRED" por
WS-PREVIRED Y rellena el nombre de fichero deseado en esa variable antes de hacer el open.
O prueba esto..........
En vez de poner esto:
Código COBOL:
SELECT PreviRed ASSIGN DISK "C:\INFORMES\WS-PREVIRED"
ORGANIZATION IS LINE SEQUENTIAL
FILE STATUS FILE-STATUS.
Pon esto:
Código COBOL:
SELECT PreviRed ASSIGN DISK WS-PREVIRED
ORGANIZATION IS LINE SEQUENTIAL
FILE STATUS FILE-STATUS.
Y antes de hacer el OPEN, rellena el nombre de fichero. Por ejemplo:
Código COBOL:
WORKING-STORAGE SECTION.
01 fecha pic x(6).
01 WS-PREVIRED pic x(80).
*
*
*
PROCEDURE DIVISION.
accept fecha from time.
initialize WS-PREVIRED.
string "C:\INFORMES" delimited by size
fecha delimited by size into WS-PREVIRED
O rellenar el nombre del fichero con algo parecido a esto:
Código COBOL:
string "C:\INFORMES\fichero-" delimited by size
fecha(1:2) '-' fecha (3:2) '-' fecha (5:2) delimited by size into WS-PREVIRED