SELECT DIGITS(DBNA_LOC_NO)
,DBNA_CTRY_CD
,DBNA_AIG_CTRY_CD
,DBNA_STATE_ABBR
,DBNA_NATID
,DBNA_NATID_TYPE
FROM CACRADB.TDNB_NAT_ID
FETCH FIRST 10 ROWS ONLY
WITH UR;
data:
Code:
0370036178429429 B151069 0010
why is it puttting a 0 in front of my row
also the syspunch says 10 instead of 9.
when i tried 'char' in front of the integer field,
it wrote out this
370036178 429429 B151069 0010
it put 2 spaces after the first field, and syspunch says 11 instead of 9.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Aug 04, 2014 3:59 pm Post subject: Re: unloading table columns properly
newcobol wrote:
why is it puttting a 0 in front of my row
also the syspunch says 10 instead of 9.
newcobol,
You have been on these helpboards for quite some time. By now you should be able to debug the errors looking up the manuals. Please spend some time looking into the manuals. If you looked at the DIGITS function in the SQL Reference manual you would have found this
DB2 SQL Reference wrote:
The result of the function is a fixed-length character string representing the absolute value of the argument without regard to its scale. The result does not include a sign or a decimal point. Instead, it consists exclusively of digits, including, if necessary, leading zeros to fill out the string. The length of the string is:
5 if the argument is a small integer
10 if the argument is a large integer
p if the argument is a decimal number with a precision of p
newcobol wrote:
when i tried 'char' in front of the integer field,
it wrote out this
370036178 429429 B151069 0010
it put 2 spaces after the first field, and syspunch says 11 instead of 9.
does anyone know why?
1. Click on the "Quick Manuals" link at the top of this page
2. Scroll down to DB2 section
3. Click on "DB2 V8 SQL Reference" manual
4. Click on the and type in CHAR and click Search
5. Read upon the first entry and see where it discuss about the length of the OUTPUT field.
After you are done reading upon the CHAR function, then insert a Negative value into DBNA_LOC_NO and then use the CHAR function and see what you find in the first byte. That will answer your question as to why you have a space in the first byte for positive numbers.
Please spend time analyzing your problem and refer the manual and if you are stuck, then post the question. You can't expect others to do your work all the time. _________________ Kolusu
www.linkedin.com/in/kolusu
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum