× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Provided that you have set the address of the variable into SQLDATA
corresponding element of SQLDA, when fetching records you can directly move
the packed data into a dummy field with a memory copy function (like
cpybla):

d* Column sizes
d cSQLLEN         s              5i 0
d pSQLLEN         ds                  inz
d  pPrecis                1      4b 0
d   aPrecis               4      4
d  pScale                 5      8b 0
d   aScale                8      8

d FldPack          s             30p 0

when SQLTYPE = 484 or SQLTYPE = 485;
  FldPack = 0;
  aPrecis = Precis;
  cSQLLEN = (pPrecis / 2) + 1;
  Cpybla(%addr(FldPack) + 16 - cSQLLEN: SQLDATA: cSQLLEN);

Then write MyFld with the right decimal position:
   MyFld = FldPack/10**pScale);

Same thing for signed, binary, integers, etc.
-----
Giuseppe


----- Original Message ----- 
From: "Buckridan, Stephanie" <Stephanie.Buckridan@xxxxxxxx>
To: "RPG Help (E-mail)" <rpg400-l@xxxxxxxxxxxx>
Sent: Thursday, July 31, 2003 12:14 PM
Subject: Unpacking data from SQLVAR


> I'm a bit new to SQL and have managed to create a dynamic variable column
> sql program.  I can retrieve the character fields with no problems, but am
> coming unstuck with the packed/zoned data.
>
> I have retrieved the data into a long data structure in order to parse it
> out and have managed to get the precision and scale of the numeric field
> into a usable version.  I need to know how to parse the packed/zoned data
> out of the data structure and then move to the next column's data.
>
> Any help/examples would be greatly appreciated.
>
> Thanks
> Steph
>
>
> ----------------------------------------------------------------------
> If you have received this e-mail in error or wish to read our e-mail
> disclaimer statement and monitoring policy, please refer to
> http://www.drkw.com/disc/email/ or contact the sender.
> ----------------------------------------------------------------------
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (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.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.