| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> ORA-01036 and Pro*COBOL
Platform: IBM/390 2.7 (MVS)
COBOL 370
Oracle 8.0.4.4.0
Pro*Cobol Release 1.8.26.0.0
Precompiler parms:
LNA=/DD/SYSOUT ONA=/DD/SYSPUNCH INA=/DD/SYSIN
Hi Group,
I am trying a execute a COBOL program with embedded SQL. Please note
that I can get the program and all of its sub-programs to compile
cleanly. However, when I execute the program, I receive error messages
of ORA-01036. I have determined that the errors are generated when the
following statments is executed:
exec sql
select count(*)
into :query-size
from dprog
where dprog = :ws-dprog and
instidq = :ws-instidq and
instid = :ws-instid and
instcd = :ws-instcd and
lyt >= :ws-catlyt and
dpfyt <= :ws-catlyt
exec sql
select instcd, dprog, lyt, dpfyt, dptitle1, dptitle2,
dpcips, dpmask, dpstatus
into :dpq-instcd, :dpq-dprog, :dpq-lyt, :dpq-fyt,
:dpq-dptitle-1 :indic-var,
:dpq-dptitle-2 :indic-var,
:dpq-cips :indic-var,
:dpq-dpmask :indic-var,
:dpq-status :indic-var
from dprog
where dprog = :ws-dprog and
instidq = :ws-instidq and
instid = :ws-instid and
instcd = :ws-instcd and
lyt >= :ws-catlyt and
dpfyt <= :ws-catlyt
I don't know how much help it will be, but I have pasted a copy of the
program below. Also, when the program executes, the count returns
zero. Any help you can provide on this would be greatly appericiated.
Thank you,
John C.
Athens, OH
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
WORKING-STORAGE SECTION.
******************************************************************
**
**
** local variables
**
**
**
******************************************************************
exec sql include sqlca end-exec.
* exec sql include conparms end-exec.
exec sql include degsqldd end-exec.
exec sql begin declare section end-exec.
01 i pic s9(4) comp value +0.
01 ws-instidq pic x(2) value spaces.
01 ws-instid pic x(8) value spaces.
01 ws-dpkey.
05 ws-instcd pic x(3) value spaces.
05 ws-dprog pic x(15) value spaces.
05 ws-catlyt pic x(6) value spaces.
** 2/22/01 added field to capture size for count
01 query-size pic S9(4) comp value 0.
**** the junk-data values hold data not required by dars
**** but required by informix so an order by clause can be used
01 junk-data.
05 junk-idq pic x(2) value spaces.
05 junk-id pic x(8) value spaces.
05 junk-cd pic x(3) value spaces.
05 junk-dprog pic x(15) value spaces.
05 junk-fyt pic x(6) value spaces.
05 junk-seq-no pic s9(9) comp value 0.
01 indic-var pic s9(4) comp value 0.
**** The previous variable is used as an indicator variable in
select
**** statements for null column processing.
01 hold-element.
05 hold-rname pic x(9) value spaces.
05 hold-grp1 pic x value spaces.
05 hold-grp2 pic x value spaces.
05 hold-orflg pic x value spaces.
05 hold-optflg pic x value spaces.
05 hold-sumgrp pic x value spaces.
05 hold-crlink pic x value spaces.
05 hold-altcflg pic x value spaces.
05 hold-sortflg pic x value spaces.
05 hold-extend pic x value spaces.
05 hold-calcgrp pic x value spaces.
05 hold-calcflg pic x value spaces.
exec sql end declare section end-exec.
LINKAGE SECTION.
copy "comstrls".
copy "deguwmdd".
copy "dumvardd".
******************************************************************
PROCEDURE DIVISION USING COM-TABLE
DP
CLIENT-DEFINED-FIELD-1
CLIENT-DEFINED-FIELD-2
CLIENT-DEFINED-FIELD-3
CLIENT-DEFINED-FIELD-4
CLIENT-DEFINED-FIELD-5.
******************************************************************
**
**
** readdp-routine:
**
**
**
**
**
READDP-ROUTINE.
**
**
move "READDP" to err-module.
exec sql include sqlinit end-exec.
if COM-TEST = "X"
display "READDP: Attempting to find: " COM-DPKEY
display function current-date
end-if.
move spaces to DP-SQL.
move 0 to i
DPQ-SEGCT.
move -1 to COM-DARETCD.
perform read-dprog thru read-dprog-exit.
move 1 to COM-DARETCD.
move DP-SQL to DP.
compute DP-SEGCT = DPQ-SEGCT.
if COM-TEST = "X"
display "SELECTDP EXIT " COM-DARETCD " DPKEY: " DPQ-KEY
" FYT: " DPQ-FYT
display function current-date
end-if.
jmc GOBACK.
******************************************************************
/*****************************************************************
**
**
**
**
**
**
**
**
**
**
**
move COM-DPKEY to ws-dpkey.
move COM-INSTIDQ to ws-instidq.
move COM-INSTID to ws-instid.
if COM-TEST = "X"
display "Read-dprog key: " ws-dpkey.
* 2/22/01 added code to check how many programs and stop proc.
jmc exec sql
jmc select count(*)
jmc into :query-size
jmc from dprog
jmc where dprog = :ws-dprog and
jmc instidq = :ws-instidq and
jmc instid = :ws-instid and
jmc instcd = :ws-instcd and
jmc lyt >= :ws-catlyt and
jmc dpfyt <= :ws-catlyt
jmc end-exec.
jmc
jmc display " READDP: query-size: " query-size.
if query-size > 1
compute COM-DARETCD = -1
move "U" to COM-COMPLETE
move "More than one program for catlyt" to COM-UMESS
if COM-TEST = "X"
display "Multiple programs found for catlyt"
end-if
go to read-dprog-exit
end-if.
jmc DISPLAY " READDP: SELECT DPROG"
move "SELECT DPROG" to err-location.
exec sql
select instcd, dprog, lyt, dpfyt, dptitle1, dptitle2,
dpcips, dpmask, dpstatus
into :DPQ-INSTCD, :DPQ-DPROG, :DPQ-LYT, :DPQ-FYT,
:DPQ-DPTITLE-1 :indic-var,
:DPQ-DPTITLE-2 :indic-var,
:DPQ-CIPS :indic-var,
:DPQ-DPMASK :indic-var,
:DPQ-STATUS :indic-var
from dprog
where dprog = :ws-dprog and
instidq = :ws-instidq and
instid = :ws-instid and
instcd = :ws-instcd and
lyt >= :ws-catlyt and
dpfyt <= :ws-catlyt
end-exec.
if sqlcode not = 100
perform read-dp-req thru read-dp-req-exit.
read-dprog-exit.
exit.
******************************************************************
read-dp-req.
move "DECLARE CSR_DP_REQ" to err-location.
exec sql
declare csr_dp_req cursor for
select dprname, grp1, grp2, orflg,
optflg, sumgrp, crlink, altcflg,
sortflg, extend, calcgrp, calcflg,
instidq, instid, instcd, dpfyt, dprog,
user_seq_no
from dprog_req
where dprog = :DPQ-DPROG and
instidq = :ws-instidq and
instid = :ws-instid and
instcd = :DPQ-INSTCD and
dpfyt = :DPQ-FYT
order by dprog, instidq, instid, instcd, dpfyt,
user_seq_no
end-exec.
move "OPEN CSR_DP_REQ" to err-location.
exec sql
open csr_dp_req
end-exec.
perform fetch-dp thru fetch-dp-exit until sqlcode = 100.
move "CLOSE CSR_DP_REQ" to err-location.
exec sql
close csr_dp_req
end-exec.
read-dp-req-exit.
exit.
******************************************************************
fetch-dp.
move "FETCH CSR_DP_REQ" to err-location.
add 1 to i.
move spaces to hold-element.
exec sql
fetch csr_dp_req into :hold-rname :indic-var,
:hold-grp1 :indic-var,
:hold-grp2 :indic-var,
:hold-orflg :indic-var,
:hold-optflg :indic-var,
:hold-sumgrp :indic-var,
:hold-crlink :indic-var,
:hold-altcflg :indic-var,
:hold-sortflg :indic-var,
:hold-extend :indic-var,
:hold-calcgrp :indic-var,
:hold-calcflg :indic-var,
:junk-idq,
:junk-id,
:junk-cd,
:junk-fyt,
:junk-dprog,
:junk-seq-no
end-exec.
if sqlcode = 0
** 1-25-01 added code to prevent going over 80 occurences
if DPQ-SEGCT = 80
if COM-TEST = "X"
display "INSTCD: " DPQ-INSTCD " DPROG: " DPQ-DPROG
" FYT: " DPQ-FYT " OVER REQ'T LIMIT OF 80"
end-if
string DPQ-INSTCD
" "
DPQ-DPROG
" "
DPQ-FYT
" OVER REQ'T LIMIT OF 80"
delimited by size
into COM-UMESS
MOVE "U" TO COM-COMPLETE
COMPUTE COM-DARETCD = -1
move 100 to sqlcode
go to fetch-dp-exit
end-if
add 1 to DPQ-SEGCT
move hold-element to dpq-v-element(dpq-segct)
if COM-TEST = "X"
display "DPQ-SEGCT: " DPQ-SEGCT
DPQ-V-ELEMENT(DPQ-SEGCT)
end-if
end-if.
fetch-dp-exit.
exit.
******************************************************************
copy "sqlerror".
Received on Fri Jul 20 2001 - 15:05:52 CDT
![]() |
![]() |