Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Getting -303 sqlcode in MAX FUNIC

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests
View previous topic :: :: View next topic  
Author Message
vijayalakshmidv

New User


Joined: 19 Jul 2007
Posts: 2
Location: bangalore

PostPosted: Mon Sep 10, 2007 2:46 pm    Post subject: Getting -303 sqlcode in MAX FUNIC
Reply with quote

Hi,
I am having a x(5) field in db2 table but that field(empno) contains numeric data.
I would like to find the maximum employee number in that field and during new employee insert I need to add 1 to maximum available empno.Please suggest me how to do.I am getting -303 sqlcode if I move use MAX FUNIC and later move to comp variable
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Sep 10, 2007 2:53 pm    Post subject:
Reply with quote

the explanation of the -303, if you bothered to look it up, would have suggested that your host variable is not the correct type.

why are you using a comp host variable for an x-type field? is that COMP-3 or what. Binary or PACK-DECIMAL.

use an x-type host variable, which is redefined as numeric if you just have to move it to a comp field. sorta silly since you are only saving two bytes by not using the x-type definition and are incurring more processing costs by either converting the numeric to binary or doing a PACK.
Back to top
View user's profile Send private message
vijayalakshmidv

New User


Joined: 19 Jul 2007
Posts: 2
Location: bangalore

PostPosted: Mon Sep 10, 2007 7:28 pm    Post subject: Reply to: REgarding db2
Reply with quote

Ya but my question is if i want to retrieve a maximum empno from table
and the empno field is x(5).Is it possible to retrieve maximum empno number
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Sep 10, 2007 7:39 pm    Post subject:
Reply with quote

have you looked at the explanation of the max column function?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Sep 10, 2007 7:40 pm    Post subject:
Reply with quote

Hello,

Well, yes. . . It is possible.

However, if you retrieve the "max" in one transaction and some other process also retrieves the max before it is updated and they both "add 1", you will have problems. . .
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 SQL Error: SQLCODE=-440, SQLSTATE... kishpra DB2 1 Sat Feb 18, 2017 2:31 am
No new posts SQLCODE-000000080N priya91 DB2 1 Mon Feb 01, 2016 4:35 pm
No new posts Need to understand SQLCODE = 12 rohanthengal DB2 3 Thu Nov 05, 2015 11:22 am
No new posts SQLCODE -922 in Batch-Cics program tr... kishpra CICS 2 Thu Sep 10, 2015 12:36 pm
No new posts SQLCODE -450 for stored procedure spoorni DB2 3 Fri Jan 16, 2015 2:45 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us