Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using oracle with cobol

Status
Not open for further replies.

hawley

Programmer
Dec 16, 2002
37
US
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_CHAR:)CC-RUN-DATE - :CC-DAYS-OF-HISTORY,
'YYYY-MM-DD'),
TO_CHAR:)CC-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_CHAR:)CC-RUN-DATE - :CC-DAYS-OF-HISTORY,
324 'YYYY-MM-DD'),
325 TO_CHAR:)CC-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

 
Hi hawley,

Are those variables declared as host variables?

Dimandja
 
What I am trying to say is that putting a column in front of a variable does not make it a host variable.

If your data is coming from CC-CONTROL-CARD, then CC-CONTROL-CARD should be declared as host; if not, move the data to a declared host variable you can use in the EXEC SQL.

Dimandja
 
As far as I know my variabes are host variables. What would make them not? They are declared in the working storage section.
 
Do you have the variables within EXEC SQL BEGIN DECLARE SECTION and EXEC SQL END DECLARE SECTION?
 
Thanks for the help but I got it to compile. All I did was change below
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).
to
05 CC-RUN-DATE PIC X(10).
and added To_date around the cc-run-date in the sql.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top