I have a cobol program and trying to use oracle. I am getting an error that I don't understand. Can anyone help?
I am passing in data from a control card. See below for layout.
01 CC-CONTROL-CARD.
05 CC-RUN-DATE.
10 CC-RUN-DATE-CC PIC X(02).
10 CC-RUN-DATE-YY PIC X(02).
10 CC-RUN-DATE-D1 PIC X(01).
10 CC-RUN-DATE-MM PIC X(02).
10 CC-RUN-DATE-D2 PIC X(01).
10 CC-RUN-DATE-DD PIC X(02).
05 FILLER PIC X(01).
05 CC-DAYS-OF-HISTORY PIC 9(04).
05 FILLER PIC X(01).
05 CC-DAYS-IN-FUTURE PIC 9(04).
05 FILLER PIC X(01).
05 CC-NUMBER-OF-HOURS PIC 9(02).
05 FILLER PIC X(53).
Now I want to take the date passed in from the control card and manipulate it to get a date range. I also wnat to subtract a certain number of hours from the sys date.
EXEC SQL
DECLARE DATECSR CURSOR FOR
SELECT
TO_CHARCC-RUN-DATE - :CC-DAYS-OF-HISTORY,
'YYYY-MM-DD'),
TO_CHARCC-RUN-DATE + :CC-DAYS-IN-FUTURE,
'YYYY-MM-DD'),
TO_CHAR(SYS-DATE - CC-NUMBER-OF-HOURS / 24)
,'YYYY-MM-DD-HH24.MI.SS')
FROM
DUAL
END-EXEC.
When I compile this I am getting these errors:
Error at line 320, column 12 in file /DD/SYSIN
320 EXEC SQL
320 ...........1
320 PCB-S-00576, PLS-412: list of values not allowed as argument to this function or procedure
Error at line 320, column 12 in file /DD/SYSIN
320 EXEC SQL
320 ...........1
320 PCB-S-00576, PLS-0: SQL Statement ignored
321 DECLARE DATECSR CURSOR FOR
322 SELECT
323 TO_CHARCC-RUN-DATE - :CC-DAYS-OF-HISTORY,
324 'YYYY-MM-DD'),
325 TO_CHARCC-RUN-DATE + :CC-DAYS-IN-FUTURE,
326 'YYYY-MM-DD'),
327 TO_CHAR(SYS-DATE - CC-NUMBER-OF-HOURS / 24)
328 ,'YYYY-MM-DD-HH24.MI.SS')
329 FROM
330 DUAL
331 END-EXEC.
....AND....
05 CC-DAYS-IN-FUTURE OF CC-CONTROL-CARD Not a valid host variable
/DD/SYSIN 87 325 325
05 CC-DAYS-OF-HISTORY OF CC-CONTROL-CARD Not a valid host variable
/DD/SYSIN 85 323 323
05 CC-NUMBER-OF-HOURS OF CC-CONTROL-CARD Not a valid host variable
/DD/SYSIN 89 327 327
I am passing in data from a control card. See below for layout.
01 CC-CONTROL-CARD.
05 CC-RUN-DATE.
10 CC-RUN-DATE-CC PIC X(02).
10 CC-RUN-DATE-YY PIC X(02).
10 CC-RUN-DATE-D1 PIC X(01).
10 CC-RUN-DATE-MM PIC X(02).
10 CC-RUN-DATE-D2 PIC X(01).
10 CC-RUN-DATE-DD PIC X(02).
05 FILLER PIC X(01).
05 CC-DAYS-OF-HISTORY PIC 9(04).
05 FILLER PIC X(01).
05 CC-DAYS-IN-FUTURE PIC 9(04).
05 FILLER PIC X(01).
05 CC-NUMBER-OF-HOURS PIC 9(02).
05 FILLER PIC X(53).
Now I want to take the date passed in from the control card and manipulate it to get a date range. I also wnat to subtract a certain number of hours from the sys date.
EXEC SQL
DECLARE DATECSR CURSOR FOR
SELECT
TO_CHARCC-RUN-DATE - :CC-DAYS-OF-HISTORY,
'YYYY-MM-DD'),
TO_CHARCC-RUN-DATE + :CC-DAYS-IN-FUTURE,
'YYYY-MM-DD'),
TO_CHAR(SYS-DATE - CC-NUMBER-OF-HOURS / 24)
,'YYYY-MM-DD-HH24.MI.SS')
FROM
DUAL
END-EXEC.
When I compile this I am getting these errors:
Error at line 320, column 12 in file /DD/SYSIN
320 EXEC SQL
320 ...........1
320 PCB-S-00576, PLS-412: list of values not allowed as argument to this function or procedure
Error at line 320, column 12 in file /DD/SYSIN
320 EXEC SQL
320 ...........1
320 PCB-S-00576, PLS-0: SQL Statement ignored
321 DECLARE DATECSR CURSOR FOR
322 SELECT
323 TO_CHARCC-RUN-DATE - :CC-DAYS-OF-HISTORY,
324 'YYYY-MM-DD'),
325 TO_CHARCC-RUN-DATE + :CC-DAYS-IN-FUTURE,
326 'YYYY-MM-DD'),
327 TO_CHAR(SYS-DATE - CC-NUMBER-OF-HOURS / 24)
328 ,'YYYY-MM-DD-HH24.MI.SS')
329 FROM
330 DUAL
331 END-EXEC.
....AND....
05 CC-DAYS-IN-FUTURE OF CC-CONTROL-CARD Not a valid host variable
/DD/SYSIN 87 325 325
05 CC-DAYS-OF-HISTORY OF CC-CONTROL-CARD Not a valid host variable
/DD/SYSIN 85 323 323
05 CC-NUMBER-OF-HOURS OF CC-CONTROL-CARD Not a valid host variable
/DD/SYSIN 89 327 327