Operating System - HP-UX
1827855 Members
1455 Online
109969 Solutions
New Discussion

Re: pro*c and UNIX problem

 
seek
Occasional Contributor

pro*c and UNIX problem

My program contain code like

EXEC SQL WHENEVER NOTFOUND goto nff;
EXEC SQL SELECT 'X' into :temp from CCHCONTROLBAT
WHERE SPID=:spid
and LOCATION=:location
and TERMTYPE=:termtype
and TERMID=to_number(:termid)
and BATCHNO=to_number(:batchno)
and BATCHTYPE=:batchtype
and OPERDATE=to_date(:operdate,'yyyymmdd');
olddata=0;
reject:
if(olddata==0)
fprintf(fp,"%s%s%s%s%s%s - duplicate batch\n",spid.arr,location.arr,termtype.arr,termid.arr,batchno.arr,batchtype.arr);
else
fprintf(fp,"%s%s%s%s%s%s - more than 12 months\n",spid.arr,location.arr,termtype.arr,termid.arr,batchno.arr,batchtype.arr);
fflush(fp);
goto nff1;
nff:
/* some code */
when i compiled i got error
"batregacrecycle.c", line 1742.1: 1506-006 (S) Label nff is undefined.
make: 1254-004 The error code from the last command is 1.

can you help me please
Thanks
seek

4 REPLIES 4
Manish Srivastava
Trusted Contributor

Re: pro*c and UNIX problem

Hi,

I do not know much of Pro*C. But it will be a good idea to check the .c file which is generated as part of the compilation of the the .pc file. Check the line no. 725 and th 29th column.
I hope this points at the problem.

Manish.
seek
Occasional Contributor

Re: pro*c and UNIX problem

MY PROGRAM HAS 501 LINES ONLY BUT IT SHOWS ERROR AT 525 LINE HOW CAN MODIFI AT 525.
Thanks
R. Allan Hicks
Trusted Contributor

Re: pro*c and UNIX problem

Manish is correct.

Your source is batregarecycle.pc. The pro*c program is a pre-compiler. It processes the .pc file and creates a .c file. If you check the .c file you will find that it is quite a bit larger than your .pc file.

As to the error message you are getting....
It is complaining about the nff label.

Your whenever notfound goto nff; should (if memory serves) create a piece of code similar to the following:

if(sql.code == 1401) goto nff;

I see the nff: label in your snipet so that doesn't make sense.

Using GOTOs and jumping around in the code can make it hard to follow. You might consider using

whenever notfound call nff

and placing the nff code into a subroutine named nff.

That will make it more modular and hopefully easier to follow. It also keeps structured programmers such as me from breaking out in a rash.

--Good Luck

BTW I notice that you have handed out 0 points for your last 7 questions. Handing out a point of two is a nice way of saying thanks :-)


"Only he who attempts the absurd is capable of achieving the impossible
seek
Occasional Contributor

Re: pro*c and UNIX problem

Thanks for ur reply i will try.