|
data structures my dear fellow... assuming that this IS RPG.... data structures define a two byte binary field, overlay it with two one character fields, move the hex or define another data structure, put in the binary value and copy the one byte value to the output data structure. when ready, move the binary field to the target SQLLEN. or zero the field, add the decimal value, then add the length value times 256. or.... =========================================================== R. Bruce Hoffman, Jr. -- IBM Certified Specialist - AS/400 Administrator -- IBM Certified Specialist - RPG IV Developer "America is the land that fought for freedom and then began passing laws to get rid of it." - Alfred E. Neuman -----Original Message----- From: Mackie, Roger L. (Precision Press) <RLMackie@ppress-tc.com> To: 'RPG400-L@midrange.com' <RPG400-L@midrange.com> Date: Wednesday, August 22, 2001 11:16 AM Subject: SQLLEN of packed field in SQLDA >Hi everyone, > >I'm creating a subfile selection screen that uses dynamic SQL to fill the >subfile. The users will be able search by six different fields. Since the >WHERE clause in a SQL string that will be the host variable of a PREPARE >statement cannot contain a host variable, the program specifies an SQLDA on >the USING DESCRIPTOR clause of the cursor OPEN statement to describe a >parameter marker in the prepared statement. Most of it is working but one >problem remains. > >Two of the search fields look in file fields that are packed decimal(SQLTYPE >= 484). Chapter 14.8 of the DB2 for AS/400 SQL Programming manual tells me >the first byte of the SQLLEN 2-byte binary field describing the length of a >packed field needs to be (%LEN(srchfld) + 1)/2 and the second byte needs to >be the field's number of decimal positions. But how do I put those values in >specific bytes of a binary field? I've tried to MOVE hex values and to >substring SQLVAR, but I can't get the right values where they need to be. >Have I missed something in the manuals? What's the best technique for doing >this? > >Thanks in advance for your help. > >Roger Mackie > > >_______________________________________________ >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 >
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.