sinmani wrote:Counter is a simple option Which would work.
But I wanted to know if we have any such specific SQL code for NO ROWS FOUND.
No.
I wrote a simple test program:
foo46: proc (parms) options (main) reorder;
dcl desc char (255),
parms char (100) var,
freq fixed bin (31);
EXEC SQL
INCLUDE SQLCA;
EXEC SQL
DECLARE A CURSOR FOR
SELECT DESC FROM EAMAY
WHERE FREQUENCY = :FREQ;
freq = parms;
EXEC SQL
OPEN A;
put skip edit ('SQLCODE on open is ', sqlcode) (a, f(6));
do while (sqlcode=0);
EXEC SQL
FETCH A INTO :DESC;
put skip edit ('SQLCODE on fetch is ', sqlcode) (a, f(6));
end;
end foo46;
and executed it with this JCL:
//hlqJ12 JOB ,'This is a test',CLASS=S,MSGCLASS=1,REGION=0M,
// SCHENV=DB2@HD0D
//*MAIN FAILURE=RESTART,LINES=(999)
//STEP1 EXEC PGM=IKJEFT1B
//STEPLIB DD DSN=hlq.WORK.LOAD,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(HD0D)
RUN PROGRAM(POO46) PLAN(POO46) PARMS('/8')
/*
(8 being a value that I happen to know is not held by
frequency on any row in that table). I got the following output:
SQLCODE on open is 0
SQLCODE on fetch is 100
So I believe it is time that your very senior person, as we say, put up or shut up.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day