473,890 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Not getting sqlcode 100 at end of fetch

I'm having a problem that I can't seem to find any solution for online.

I'm using a cursor in a cobol program to fetch some data. I know for a
fact that the select should return 2 rows. The fetch works as I would
expect it to on the 2 rows, but then when I do my next fetch, the
program ends abnormally.

My next step is to check for sqlcode 100, as I would expect it to be,
but my program never even gets to this step.

Any ideas? Here is some code, if it helps.

EXEC SQL
DECLARE ACH_SEARCH CURSOR FOR
SELECT
A.INDVD_NAME,
D.FILE_CRT_DATE ,
C.EFCTV_ENTRY_D ATE,
A.TRNSC_CODE,
A.RCVNG_DFI_ID,
A.DFI_ACNT_ID,
A.AMT,
A.INDVD_ID,
C.CMPNY_DSCRT_T EXT,
A.TRACE_NMBR,
B.PYMNT_RLTD_TE XT,
A.DSCRT_DATA_CO DE
FROM (((TPMNFLA B
RIGHT OUTER JOIN TPMNFBD A ON
A.TRACE_NMBR = B.TRACE_NMBR)
INNER JOIN TPMNFLB C ON
A.NACHA_SQN_NMB R = C.NACHA_SQN_NMB R AND
A.BATCH_NMBR = C.BATCH_NMBR)
INNER JOIN TPMNFLH D ON
C.NACHA_SQN_NMB R = D.NACHA_SQN_NMB R)
WHERE A.INDVD_NAME LIKE 'ROSEL C GOMEZ '
END-EXEC

PERFORM A8100-FETCH-SEARCH THRU
A8100-FETCH-SEARCH-EXIT
UNTIL 88-DONE

EXEC SQL
FETCH ACH_SEARCH
INTO
:NFBD-INDVD-NAME,
:NFLH-FILE-CRT-DATE,
:NFLB-EFCTV-ENTRY-DATE,
:NFBD-TRNSC-CODE,
:NFBD-RCVNG-DFI-ID,
:NFBD-DFI-ACNT-ID,
:NFBD-AMT,
:NFBD-INDVD-ID,
:NFLB-CMPNY-DSCRT-TEXT,
:NFBD-TRACE-NMBR,
:WS-ADDENDA INDICATOR :ADIND,
:NFBD-DSCRT-DATA-CODE
END-EXEC.

EVALUATE TRUE
WHEN SQLCODE = 0
do stuff
WHEN SQLCODE = 100
SET 88-DONE TO TRUE

WHEN SQLCODE < -900
SET DB2-SYS-ERROR TO TRUE
PERFORM S9910-PROCESS-SQL-ERROR
THRU S9910-PROCESS-SQL-ERROR-EXIT

Oct 10 '06
10 13255
Your code has a number of problems:
1. You didn't properly code for nullable columns in the database
2. You didn't code to check for ALL non-expected sqlcodes
3. You are using a coding style that forces duplication of logic.

You stated that the program abended and you appeared to be stuck there.
If you were using an interactive debugger or the COBOL batch debugging
aids, you should have been able to obtain a lot more information about
what was happening and probably would have been able to fix it yourself.

Phil Sherman

scoonie999 wrote:
I was able to get this working. Not sure why this worked, but adding a
check that a field is not null (this particular field never should have
nulls in it) to the where clasue did the trick. I now get the +100
return code when I expect to.

where clause now looks like this

WHERE A.INDVD_NAME = 'ROSEL C GOMEZ '
AND A.INDVD_NAME IS NOT NULL

Now I need to do some real work to this program.

Thanks for the replies.
Oct 13 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
7252
by: Twan Kennis | last post by:
Hi, I have a DB2 database on the IBM iSeries platform, on which I created several Stored Procedures with the SQLCODE as a return-parameter. These Stored Procedures are called from a Windows application (build in Visual Basic) using an ADO/OLE DB Provider on a IBM Client Access ODBC driver. On the Internet I found a whitepaper "SQL messages and codes" provided by IBM which describes a complete list of all SQLSTATEs, SQLCODEs and
2
3706
by: scotdb | last post by:
I'm trying to get the SQLERRMC info from the SQLCA into my SP so that I can use the information it provides. I'm successfully getting the SQLCODE and SQLSTATE and so added the SQLERRMC to the code which obtains these. It doesn't seem to work however - create procedure dbair001.sp001testerr ( ,OUT p_sqlstate CHAR(5) ,OUT p_sqlcode INTEGER ,OUT p_sqlerrmc VARCHAR(70)
0
2160
by: rpisaneschi | last post by:
Can anyone figure out why I am getting the SQL 203 below ? SELECT DISTINCT SP.SPCLT_CD, CASE CI.CORP_ENT_CD WHEN 'IL1' THEN ' ' ELSE SP.PROV_TYP_CD END AS XPROV_TYP_CD, ST.PWN_STA_CD FROM
2
46804
by: Richard | last post by:
Our web programmer was looking in his application log an found the following error: 2006-08-31 16:33:35,129 ERROR org.hibernate.util.JDBCExceptionReporter - < SQL0723N An error occurred in a triggered SQL statement in trigger "OLGCWEB.TBLPROPS_INS_TRG". Information returned for the error includes SQLCODE "-811", SQLSTATE "21000" and message tokens "". SQLSTATE=09000 2006-08-31 16:33:35,139 ERROR...
1
11240
by: jyoti202 | last post by:
Hi, Need help for this as i have been looking for it but could not get any results. We are using java as front end and DB2 as backend, i m getting the exception while executing a particular query with following error description: DB2 SQL error: SQLCODE: -901, SQLSTATE: 58004, SQLERRMC: sqlno_itr_plan::next :rc( 0) SQLCODE: -901 this error code says "Non severe System error" This query was working fine till...
2
11289
by: monika thotha | last post by:
i m working on mainframes, coding in cobol and db2 EXEC SQL UPDATE BOOKS_STAT17 SET STATUS1 = 'O' , EMP_NUMBER=NULL WHERE COPY_NUMBER = WS-COPY-NUM AND ISBN_NUMBER = WS-ISBN-NUM END-EXEC. error i m getting: DBH3 BIND SQL ERROR USING TRG4SUSR AUTHORITY
22
6692
by: Sri | last post by:
All Recenetly our shop migrated to DB2 V8 from V7. We are in IBM System Level: z/OS 1.6.1 @ RSU 0702. Processor : IBM 2064-1C7 (z/900) # 1B89 Mode: 64-bit One of my application is facing problem while testing their code/Jobs in DB2 V8 environments. The Details are: Job is abending with SQLCODE -302 SQL error on the prepare staement. There is no code modification made for many years. It is working fine in db2 V7 enviornments. The...
3
8793
by: jominp | last post by:
When i am trying to execute,the following query using hibernate select * from from user where (date(MONTH || '-' || '01'|| '-' || YEAR) between '2005-01-01' and '2009-01-01') I am getting the error No authorized routine named "DATE" of type "FUNCTION" having compatible arguments was found. 28dd20a3 JDBCException W org.hibernate.util.JDBCExceptionReporter SQL Error: -727, SQLState: 56098 28dd20a3 JDBCException E...
3
7358
by: lenygold via DBMonster.com | last post by:
Thank you very much SERGE for your help. I found example in Graeme Birchall COOKBOOK wich i think exactly what i need for SQL check in triggers: • User query joins to table function - sends DML or DDL statement to be executed. • Table function calls stored procedure - sends statement to be executed. • Stored procedure executes statement. • Stored procedure returns SQLCODE of statement to the table function.
0
9980
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10830
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9641
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7172
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5855
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4682
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3283
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.