Thanks everyone for the help. I put it in debug and got everything worked out.
Have a great holiday!
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, December 12, 2012 10:54 PM
To: RPG programming on the IBM i / System i
Subject: Re: sql database in RPGLE program with lots of columns
Hi Kim,
jdbc_getCol() will return an alphanumeric string to your RPG program.
Passing this string as input to %char() doesn't make any sense, as it's already a character field! The JDBC environment is converting ti to character for you, already.
I would start by looking at the format it's returning (stick some code in there for now that puts it into a character string, so you can display the data in debug.)
Once you know what the format looks like, it should be a simple matter of substrining it and passing it into the %date() and/or %dec() BIFs to convert it to the numeric format you want.
I see Alan posted a routine -- I don't know if the format you're receiving matches what his routine is expecting, but if it is, then perhaps his routine will save you some effort.
-SK
On 12/12/2012 2:22 PM, Kim Massar wrote:
Now I have a new problem, there are fields defined in the sql table as dates ([Original_File_Date] [date] NULL) in MMDDCCYY. In our iSeries file they are defined as numeric, in CCYYMMDD order.
1. Is this something I should not try, or will not be able to, convert when I get the columns? (removing the slashes and reordering fields).
2. I have tried this syntax, but does not work: CRTDT = %dec(%Char((jdbc_getCol(rs:12)):*iso-):8:0) . I get the first and second parameter are not allowed for *Char, so I am guessing I can't define the column number here? My reason for question #1!!
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
Email Confidentiality Notice: The information contained in this transmission is confidential, proprietary or privileged and may be subject to protection under the law, including the Health Insurance Portability and Accountability Act (HIPAA). The message is intended for the sole use of the individual or entity to whom it is addressed. If you are not the intended recipient, you are hereby notified that any use, distribution, copying or printing of this message is strictly prohibited and may subject you to criminal or civil penalties. If you received this transmission in error, please contact the sender immediately by replying to this email and then delete the material from any computer.
As an Amazon Associate we earn from qualifying purchases.