I am receivinG maxcc = 16 & SQL state as 42601 with 104 sqlcode after submitting my job.
The JCL with the easytrieve program submitted was coded as below:
//WIP04DD JOB (T,476),'KSHITIJ',CLASS=1,MSGCLASS=X,
// NOTIFY=&SYSUID
//*************************************************************
//EZTSQL EXEC PGM=EZTPA00,REGION=4M
//*************************************************************
//STEPLIB DD DSN=SYSTEMS.LINKLIB,DISP=SHR
// DD DSN=DB2P.SDSNLOAD,DISP=SHR
//EZTVFM DD SPACE=(CYL,(20,20)),UNIT=SYSDA,DCB=BUFNO=40
//SYSPRINT DD SYSOUT=*
//SYSPUNCH DD DUMMY
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=Y
//SORTWK01 DD SPACE=(CYL,(5,50)),UNIT=SYSDA
//SORTWK02 DD SPACE=(CYL,(5,50)),UNIT=SYSDA
//INFILE DD DSN=CCS.WIP04.CMRREP,
// DISP=SHR
//* DISP=(NEW,CATLG,DELETE),
//* DCB=(RECFM=FB,LRECL=30),
//OUTFILEA DD DSN=CCS.WIP04.CMRO1,
// DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=80),
// DATACLAS=MB050
//* DISP=(NEW,CATLG,DELETE),
//* DCB=(RECFM=FB,LRECL=80),
//* DATACLAS=MB050
//SYSIN DD *
PARM +
BIND(DYNAMIC)+
DB2SSID('DB2P')+
DEBUG(FLOW)
FILE INFILE
IN-REC 1 080 A
IN-CLM-NO 01 12 A
FILE OUTFILEA
OUT-REC 1 080 A
OUT-SALN 1 8 A
OUT-GR-RSV 10 14 A
OUT-NET-RSV 25 14 A
OUT-RP-GR-RSV 40 14 A
OUT-RP-NET-RSV 55 14 A
WS-CRNCL W 12 A
WS-SALN W 08 A
WS-SALN1 W 08 A
WS-GR-RSV W 14 A
WS-NET-RSV W 14 A
WS-RP-GR-RSV W 14 A
WS-RP-NET-RSV W 14 A
*
SQL DECLARE GETRSRV CURSOR FOR +
SELECT GROSS_RESV_AMT,NET_RESV_AMT,RLP_GROSS_RESV_AMT, +
RLP_NET_RESV_AMT +
FROM DB2P.DFCSP.FI_UNIT_HISTORY +
WHERE SALN = :WS-SALN1 +
AND CURRENT_IND = 'C' +
WITH UR
JOB INPUT INFILE FINISH (WINDUP)
SQL +
SELECT SALN FROM DB2P.DFCSP.CLM_COVERAGE +
INTO :WS-SALN +
WHERE CRN_CLM_NO = :IN-CLM-NO +
WITH UR
IF SQLCODE NE 0
DISPLAY 'NO ENTERIES ' SQLCODE ' CRN CLM#: '
STOP
END-IF
IF SQLCODE = 0
WS-SALN1 = WS-SALN
END-IF
SQL OPEN GETRSRV
IF SQLCODE NE 0
DISPLAY 'CURSOR OPEN ERROR : ' SQLCODE ' CRN CLM#: '
STOP
END-IF
IF SQLCODE = 0
PERFORM FETCH-PARA
END-IF
*
FETCH-PARA. PROC.
SQL FETCH GETRSRV +
INTO :WS-GR-RSV, +
:WS-NET-RSV, +
:WS-RP-GR-RSV, +
:WS-RP-NET-RSV
IF SQLCODE = 100
DISPLAY 'NO MORE RECORDS FOR THIS SALN'
END-IF
IF SQLCODE = 0
DISPLAY 'NET RESERVE' WS-NET-RSV
OUT-GR-RSV = WS-GR-RSV
OUT-NET-RSV = WS-NET-RSV
OUT-RP-GR-RSV = WS-RP-GR-RSV
OUT-RP-NET-RSV = WS-RP-NET-RSV
OUT-SALN = WS-SALN1
PUT OUTFILEA
END-IF
IF SQLCODE NE 0 AND SQLCODE NE 100
DISPLAY 'CURSOR FETCH ERROR : ' SQLCODE
STOP
END-IF
SQL CLOSE GETRSRV
DISPLAY ' SQL CODE : ' SQLCODE
END-PROC.
WINDUP. PROC.
DISPLAY 'DONE '
END-PROC.
// NOTIFY=&SYSUID
//*************************************************************
//EZTSQL EXEC PGM=EZTPA00,REGION=4M
//*************************************************************
//STEPLIB DD DSN=SYSTEMS.LINKLIB,DISP=SHR
// DD DSN=DB2P.SDSNLOAD,DISP=SHR
//EZTVFM DD SPACE=(CYL,(20,20)),UNIT=SYSDA,DCB=BUFNO=40
//SYSPRINT DD SYSOUT=*
//SYSPUNCH DD DUMMY
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=Y
//SORTWK01 DD SPACE=(CYL,(5,50)),UNIT=SYSDA
//SORTWK02 DD SPACE=(CYL,(5,50)),UNIT=SYSDA
//INFILE DD DSN=CCS.WIP04.CMRREP,
// DISP=SHR
//* DISP=(NEW,CATLG,DELETE),
//* DCB=(RECFM=FB,LRECL=30),
//OUTFILEA DD DSN=CCS.WIP04.CMRO1,
// DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=80),
// DATACLAS=MB050
//* DISP=(NEW,CATLG,DELETE),
//* DCB=(RECFM=FB,LRECL=80),
//* DATACLAS=MB050
//SYSIN DD *
PARM +
BIND(DYNAMIC)+
DB2SSID('DB2P')+
DEBUG(FLOW)
FILE INFILE
IN-REC 1 080 A
IN-CLM-NO 01 12 A
FILE OUTFILEA
OUT-REC 1 080 A
OUT-SALN 1 8 A
OUT-GR-RSV 10 14 A
OUT-NET-RSV 25 14 A
OUT-RP-GR-RSV 40 14 A
OUT-RP-NET-RSV 55 14 A
WS-CRNCL W 12 A
WS-SALN W 08 A
WS-SALN1 W 08 A
WS-GR-RSV W 14 A
WS-NET-RSV W 14 A
WS-RP-GR-RSV W 14 A
WS-RP-NET-RSV W 14 A
*
SQL DECLARE GETRSRV CURSOR FOR +
SELECT GROSS_RESV_AMT,NET_RESV_AMT,RLP_GROSS_RESV_AMT, +
RLP_NET_RESV_AMT +
FROM DB2P.DFCSP.FI_UNIT_HISTORY +
WHERE SALN = :WS-SALN1 +
AND CURRENT_IND = 'C' +
WITH UR
JOB INPUT INFILE FINISH (WINDUP)
SQL +
SELECT SALN FROM DB2P.DFCSP.CLM_COVERAGE +
INTO :WS-SALN +
WHERE CRN_CLM_NO = :IN-CLM-NO +
WITH UR
IF SQLCODE NE 0
DISPLAY 'NO ENTERIES ' SQLCODE ' CRN CLM#: '
STOP
END-IF
IF SQLCODE = 0
WS-SALN1 = WS-SALN
END-IF
SQL OPEN GETRSRV
IF SQLCODE NE 0
DISPLAY 'CURSOR OPEN ERROR : ' SQLCODE ' CRN CLM#: '
STOP
END-IF
IF SQLCODE = 0
PERFORM FETCH-PARA
END-IF
*
FETCH-PARA. PROC.
SQL FETCH GETRSRV +
INTO :WS-GR-RSV, +
:WS-NET-RSV, +
:WS-RP-GR-RSV, +
:WS-RP-NET-RSV
IF SQLCODE = 100
DISPLAY 'NO MORE RECORDS FOR THIS SALN'
END-IF
IF SQLCODE = 0
DISPLAY 'NET RESERVE' WS-NET-RSV
OUT-GR-RSV = WS-GR-RSV
OUT-NET-RSV = WS-NET-RSV
OUT-RP-GR-RSV = WS-RP-GR-RSV
OUT-RP-NET-RSV = WS-RP-NET-RSV
OUT-SALN = WS-SALN1
PUT OUTFILEA
END-IF
IF SQLCODE NE 0 AND SQLCODE NE 100
DISPLAY 'CURSOR FETCH ERROR : ' SQLCODE
STOP
END-IF
SQL CLOSE GETRSRV
DISPLAY ' SQL CODE : ' SQLCODE
END-PROC.
WINDUP. PROC.
DISPLAY 'DONE '
END-PROC.
The error details are as follows:
SELECT SALN FROM DB2P.DFCSP.CLAIM_COVERAGE +
INTO :WS-SALN +
WITH UR
SQL - SQL ERROR, SQLCODE IS -104
SQL - DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL "?". SOME SYMBOLS THAT MI
SQL - ARE: <END-OF-STATEMENT> QUERYNO HAVING WHERE GROUP ORDER INTERSE
SQL - DSNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE
SQL - "SELECT INTO" IS VALID ONLY FOR SQLSYNTAX OF NONE AND STATIC-ONLY BIND
INTO :WS-SALN +
WITH UR
SQL - SQL ERROR, SQLCODE IS -104
SQL - DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL "?". SOME SYMBOLS THAT MI
SQL - ARE: <END-OF-STATEMENT> QUERYNO HAVING WHERE GROUP ORDER INTERSE
SQL - DSNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE
SQL - "SELECT INTO" IS VALID ONLY FOR SQLSYNTAX OF NONE AND STATIC-ONLY BIND
The select query seems fine & the fields (used in the query)seem to be populated as well.
Instead of DYNAMIC, i tried giving STATIC,NONE & STATIC-ONLY values in the BIND parameter, but the error 'parameter invalid' would come up.
Please let me know if anybody has come across this error & if you require more details on this.
Thanks a LOT !!!!