|
TITLE 'Decompress Data';
/*-------------------------------------------------------------*/
/* QUNPACK: program to decompress (unpack) string data with */
/* MI assembler functions on an AS/400. */
/* */
/* INPUT: string to decompress */
/* */
/* OUTPUT: result string, result string size */
/* */
/*-------------------------------------------------------------*/
ENTRY * (PLIST) EXT;
/*-------------------------------------------------------------*/
/* parms are source string, length, result area, length. */
/*-------------------------------------------------------------*/
/* NOTE: parms passed as pointers to parameters, not values. */
/*-------------------------------------------------------------*/
DCL SPCPTR SRC_PTR PARM; /* parm 1 = source to pack */
DCL SPCPTR RST_PTR PARM; /* parm 2 = result location*/
DCL SPCPTR RST_SIZE PARM; /* parm 3 = result size */
DCL OL PLIST (SRC_PTR, RST_PTR, RST_SIZE) PARM EXT MIN(3); /* */
/*-------------------------------------------------------------*/
/* (here are the value variables pointed to by parameters) */
/*-------------------------------------------------------------*/
DCL DD SRC CHAR(16766191) BAS(SRC_PTR); /* source string */
DCL DD RST CHAR(16766191) BAS(RST_PTR); /* result string */
DCL DD RSTSIZE BIN(4) BAS(RST_SIZE); /* size of result string */
/*-------------------------------------------------------------*/
/* template for DCPDATA command */
/*-------------------------------------------------------------*/
DCL SPCPTR TEMPLATE_@; /* pointer to template */
DCL DD TEMPLATE CHAR(64) BDRY(16); /* DCPDATA TEMPLATE */
DCL DD TRESERV1 CHAR(4) DEF(TEMPLATE) POS(1); /* reserved */
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 TRESERV2 CHAR(20) DEF(TEMPLATE) POS(13); /* 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, return now... */
/*-------------------------------------------------------------*/
CMPNV(B) RSTSIZE, 0 /EQ(EXIT); /* size > 0 or EXIT now */
/*-------------------------------------------------------------*/
/* set passed parameters into template */
/*-------------------------------------------------------------*/
SETSPP TEMPLATE_@, TEMPLATE; /* set template pointer */
CPYNV TRSTSIZE, RSTSIZE; /* result size to template*/
SETSPPFP TSRC_PTR, SRC_PTR; /* source ptr to template */
SETSPPFP TRST_PTR, RST_PTR; /* result ptr to template */
/*-------------------------------------------------------------*/
/* Now issue the DCPDATA command. */
/*-------------------------------------------------------------*/
DCPDATA TEMPLATE_@; /* compress the data */
/*-------------------------------------------------------------*/
/* Now set the return parameter for result string length. */
/*-------------------------------------------------------------*/
CPYNV RSTSIZE, TRSTREAL; /* return real result size*/
/*-------------------------------------------------------------*/
/* DONE. Now's the time to say good bye... */
/*-------------------------------------------------------------*/
EXIT: RTX *; /* return to caller */
PEND; /* done w/ program */
+---
| 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-2025 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.