|
Hello: This was provided several years ago... I haven't tested it. Use at your "own risk". Steve Glanstein mic@aloha.com TITLE 'Compress Data'; /*-------------------------------------------------------------*/ /* QPACK: program to compress (pack) string data with MI */ /* assembler functions on an AS/400. */ /* */ /* INPUT: string, string length, result string size */ /* OUTPUT: result string, result string size set to real size */ /* */ /*-------------------------------------------------------------*/ /*-------------------------------------------------------------*/ /* parms are source string, length, result area, length. */ /*-------------------------------------------------------------*/ /* NOTE: parms passed as pointers to parameters, not values. */ /*-------------------------------------------------------------*/ ENTRY * (PLIST) EXT; DCL SPCPTR SRC_PTR PARM; /* parm 1 = source to pack */ DCL SPCPTR SRC_SIZE PARM; /* parm 2 = size of source */ DCL SPCPTR RST_PTR PARM; /* parm 3 = result location*/ DCL SPCPTR RST_SIZE PARM; /* parm 4 = result size */ DCL OL PLIST (SRC_PTR, SRC_SIZE, RST_PTR, RST_SIZE) PARM EXT MIN(4); /*-------------------------------------------------------------*/ /* (here are the value variables pointed to by parameters) */ /*-------------------------------------------------------------*/ DCL DD SRC CHAR(16776191) BAS(SRC_PTR); /* max string size */ DCL DD SRCSIZE BIN(4) BAS(SRC_SIZE); /* size of source str */ DCL DD RST CHAR(16776191) BAS(RST_PTR); /* max string size */ DCL DD RSTSIZE BIN(4) BAS(RST_SIZE); /* size of result str */ /*-------------------------------------------------------------*/ /* template for CPRDATA command */ /*-------------------------------------------------------------*/ DCL SPCPTR TEMPLATE_@; /* pointer to template */ DCL DD TEMPLATE CHAR(64) BDRY(16); /* CPRDATA TEMPLATE */ DCL DD TSRCSIZE BIN(4) DEF(TEMPLATE) POS(1); /* source size */ DCL DD TRSTSIZE BIN(4) DEF(TEMPLATE) POS(5); /* result area size */ DCL DD TRSTREAL BIN(4) DEF(TEMPLATE) POS(9); /* real result size */ DCL DD TCMPPARM BIN(2) DEF(TEMPLATE) POS(13); /* compression=terse */ DCL DD TRESERVE CHAR(18) DEF(TEMPLATE) POS(15); /* reserved area */ DCL SPCPTR TSRC_PTR DEF(TEMPLATE) POS(33); /* source string PTR */ DCL SPCPTR TRST_PTR DEF(TEMPLATE) POS(49); /* result string PTR */ /*-------------------------------------------------------------*/ /* if result area size is not > 0, OR... */ /* if source size is not > 0, return now. */ /*-------------------------------------------------------------*/ CMPNV(B) SRCSIZE, 0 /EQ(EXIT); /* size > 0 or EXIT now */ CMPNV(B) RSTSIZE, 0 /EQ(EXIT); /* size > 0 or EXIT now */ /*-------------------------------------------------------------*/ /* set passed parameters into template */ /*-------------------------------------------------------------*/ SETSPP TEMPLATE_@, TEMPLATE; /* set template pointer */ CPYNV TSRCSIZE, SRCSIZE; /* source size to template*/ CPYNV TRSTSIZE, RSTSIZE; /* result size to template*/ CPYNV TCMPPARM, 1; /* 1=terse */ SETSPPFP TSRC_PTR, SRC_PTR; /* source ptr to template */ SETSPPFP TRST_PTR, RST_PTR; /* result ptr to template */ /*-------------------------------------------------------------*/ /* Now issue the CPRDATA command. */ /* NOTE: any pointers compressed will be lost if/when */ /* resulting string is decompressed. */ /*-------------------------------------------------------------*/ CPRDATA TEMPLATE_@; /* compress the data */ /*-------------------------------------------------------------*/ /* Now set the return parameter for result string length. */ /*-------------------------------------------------------------*/ CPYNV RSTSIZE, TRSTREAL; /* return real result size*/ /*-------------------------------------------------------------*/ /* DONE. Get the heck outa here.... */ /*-------------------------------------------------------------*/ EXIT: RTX *; /* return to caller */ /*'/*'/*"/*"*/; PEND; /* done w/ program */ > -----Original Message----- > From: owner-mi400@midrange.com [mailto:owner-mi400@midrange.com]On > Behalf Of András Cser > Sent: Saturday, July 08, 2000 7:15 PM > To: MI400@midrange.com > Subject: Compression > > > Hi! > > Do you have any experiences using the MI compression? > > I need to store files with a huge number of records in as compact way as > possible. > > Thanks, > Andras +--- | This is the MI Programmers Mailing List! | To submit a new message, send your mail to MI400@midrange.com. | To subscribe to this list send email to MI400-SUB@midrange.com. | To unsubscribe from this list send email to MI400-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: dr2@cssas400.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.