|
John, The problem is your variable Compressed is too small. Not sure how you arrived at 44 bytes as the size, but in this example, cprdata actually needs a larger field (62 bytes). Part of the reason for the larger size is that the compressed data has a header structure (first 12 bytes). The other is relatively small amount of data being compressed (compression routine overhead). To see any effective compression results you need to use cprdata on a larger chunk of data. Your example is closer to a worst case example. Assuming you use a large enough compression buffer, you can get the actual size of the compressed data from the header. Bytes 5-8 is the compressed len (10u 0) Bytes 9-12 is the uncompressed len (10u 0) Keith ----- Original Message ----- From: "Jon Paris" <Jon.Paris@xxxxxxxxxxxxxx> To: "Rpg400" <rpg400-l@xxxxxxxxxxxx> Sent: Thursday, July 01, 2004 3:15 PM Subject: Help with cprdata > I'm having a senior citizen moment I think. I just can't see why this puppy > is blowing up on me with a nasty template error. > > What am I missing? The C manual defines it like so: > int cprdata (_SPCPTR result, > int result_length, > _SPCPTRCN source, > int src_length); > > And my RPG code is: > > d Compress pr 10i 0 Extproc('cprdata') > d Output 32000a Options(*Varsize) > d OutputLen 10i 0 Value > d Source 32000a Options(*Varsize) > d SourceLen 10i 0 Value > > D Compressed S 44a > D CompressedLen S 2s 0 > D Source S 52a > > /Free > Source = *All'Jon and Susan - '; > Dsply Source; > CompressedLen = Compress(Compressed: %Size(Compressed): > Source: %Size(Source)); > > Jon Paris > Partner400 > www.Partner400.com > > -- > 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 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.