|
This is what the field looks like in the RPG cross reference: File and Record References: File Device References (D=Defined) Record No references in the source. Global Field References: Field Attributes References (D=Defined M=Modified) MYVAR I(10,0) 1D 44M 45 46M 47 56M 58 1 D MyVar s 10i 0 43 D SQL_00005 65 68B 0 MYVAR 44 C eval MyVar=999999999 46 C eval MyVar=1000000000 56 C EVAL MYVAR = SQL_00005 Where did the precompiler get off by defining SQL_00005 as binary instead of integer? Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin "R. Bruce Hoffman, Jr." To: <rpg400-l@midrange.com> <rbruceh@attgloba cc: l.net> Fax to: Sent by: Subject: Re: Integers with embedded SQL problem rpg400-l-admin@mi drange.com 03/12/2002 09:18 AM Please respond to rpg400-l ----- Original Message ----- From: <rob@dekko.com> To: <rpg400-l@midrange.com> Sent: Tuesday, March 12, 2002 8:26 AM Subject: RE: Integers with embedded SQL problem > 2) If it did, then why did the UPDDTA or INSERT allow me to put > 1,000,000,000 in the record? This is not a valid binary value. It let you do it because the DEC type is packed decimal. Then in the program, you asked for 10 digits, integer or binary, you got them. In the RPG program you declared 10i. But take a look at the cross reference. This is what I ranted about not too long ago. It will probably show up in the RPG cross reference as packed decimal. RPG does this to you. Declaring the file in SQL as INT will present a binary 9 digit field. Declaring SMALLINT will present a 4 digit field. These are not pre-compiler issues, they are DDL issues. (Data Definition Language, part of SQL.) The result is as you did, if you really need 10 digits, the NUMERIC for zoned, DEC for packed or live with 9 on INT. For the case of the 5 digits, then you need INT for 9, NUMERIC for zoned, DEC for packed, but SMALLINT won't hold it after the DDL materializes in the physical file. =========================================================== R. Bruce Hoffman, Jr. -- IBM Certified Specialist - iSeries Administrator -- IBM Certified Specialist - RPG IV Developer "Suppose you were an idiot... And suppose you were a member of Congress... But I repeat myself." - Mark Twain _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.