Keep Leading Zeroes in Character Field
joann.l.olsen@us.abb.com
joann.l.olsen@us.abb.com
Thu, 5 Apr 2001 14:56:27 -0500
I've got it! Thanks to Conrad Whitall and you're right. I didn't mention in my
original message that it was being used to link to a file. I needed the field
defined with the trailing sign and realized that after doing the QSHOW as
suggested. Thanks to all.
Ahh, I don't think that you originally mentioned that you were doing this in
order to eventually link to a numeric item in another file.
With a numeric item the leading zeros are probably irrelevant, as they are
simply how the number is displayed...not how it is physically stored. Your
problem is probably because the physical data type of the defined expression
you are setting up does not exactly correspond to the physical data type of
the numeric item you are trying to link to.
Use QSHOW to report on the record layout of the file you are trying to link
to, and identify what the physical storage type of the item you are trying
to link to really is. Then go back to your QUIZ report and set up your
DEFINE to use that exact same physical datatype. For example, if QSHOW
reports the item to be of type PACKED and size 4, try DEFINE d-num PACKED
SIZE 4 = nconvert(gbsbl).
Best regards,
Conrad
Conrad Whittall
Marketing Manager, Application Development Tools, Cognos Incorporated
Developer productivity never goes out of style!
For details of the Cognos PowerHouse family of high-productivity
development tools for Web, Windows and terminal-based business
applications, and to request your own free copy of our new product
demo CD, simply click here http://www.cognos.com/powerhouse.
-----Original Message-----
From: joann.l.olsen@us.abb.com [mailto:joann.l.olsen@us.abb.com]
Sent: Thursday 5 April 2001 15:26
To: powerh-l@lists.swau.edu
Subject: Keep Leading Zeroes in Character Field
Thanks to everyone for the help. I needed the leading zeroes for linking to
another file where the key in that file is numeric and contains the leading
zeroes. I tend to agree with Bob Edis. It can't be done. Back to the
drawing
board!
This did not produce an error, but did not give me leading zeroes:
def d-num num*8 significance 8 pic "^^^^^^^^" = nconvert(gbsbl)
On the following define, I got an error pointing to the comma. def
d-num
num*8 = nconvert(gbsbl,8)
Original message:
I need to convert a character field to a numeric field, but keep the leading
zeroes. If the nconvert is used, it drops the leading zeroes. How can that
be
accomplished? We are on an AS/400.
Example: subledger char*8 = 00100241
def D-NUM num*8 = nconvert(subledger)
The results in D-NUM is 100241
Thanks