×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
I am trying to compile an RPG program that contains the sub-procedure shown below and am getting an SQL0314 error saying that host variable OBATCH is not unique. Originally the variable was called wBatch which was also defined globally, so despite the v7r2 SQL manual saying that the pre-compiler copes with the different variable scopes correctly I changed the name to be on the safe side. However, no matter what I change the name to I always get the SQL0314 error.
If I move the declaration to the mainline code and make the scope global then the pre-compiler is happy and no error is generated. It seems to me that if I have to declare the variable globally then I may as well either use a subroutine instead of a sub-procedure or change the sub-procedure to use native I/O instead. I have checked with our technical support guys and they have confirmed that we are 7.2 with cume 115310 and latest group and HIPER PTF's applied.
// Work Variables...
Dcl-s oBatch Packed(8) Inz(*Zeros);
// Retrieve the last batch number for the current date...
Exec Sql
select max(ptbchn)
into :oBatch
from acaptrn
where ptbchn >= ((((year(current date) - 1900) * 1000) +
dayofyear(current date))
* 100)
and ptcode = :iProduct;
// If there have been no batches today then the batch number should
// be generated in the form CYYDDDnn...
If oBatch = *Zeros;
Exec Sql
select (((year(current date) - 1900) * 1000) + dayofyear(current
date))
* 100 + 1
into :oBatch
from sysibm.sysdummy1;
Else;
// Otherwise batches exist so increment to get the next one. Not too
// worried about there being more than 99, if there are then the day
// number will increment as well to cater for it...
oBatch = oBatch + 1;
EndIf;
// Return the generated batch number to the calling procedure...
Return oBatch;
End-Proc;
________________________________
Proud partner of The Ageas Bowl and the Ageas Salisbury International Arts Festival.
Registered Address: Ageas House, Hampshire Corporate Park, Templars Way, Eastleigh, Hampshire, SO53 3YA Registered Number: 354568 England
Authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and the Prudential Regulation Authority
This e-mail together with any attachments are intended for the addressee only and may be private and confidential. If you are not the intended recipient, or the person responsible for delivering it to the intended recipient, you must not open any attachments, or copy, disclose, distribute, retain or use this e-mail, including any attachments, in any way whatsoever; please return it to us immediately using the reply facility on e-mail.
Consider the environment and think before you print this email.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.