Charles,

hereby a piece of code I used (c++).

input char_compressed, output char_decompressed, input
max_ll_char_decompressed

Hope this helps and sorry for comments in italian language.

Best regards.
Massimo Biancucci

/* ------------------------------------------------------------------ */
/* Esegue decompressione RLE come da macro CSRCESRV                   */
/* ci si aspetta di avere una stringa compressa in tal maniera        */
/* in output la stringa su output e la lunghezza del buffer di uscita */
/* se < 0 abbiamo incontrato un errore                                */
/* ------------------------------------------------------------------ */
short rle_decode(char *input, char *output, unsigned short ll_i )
 {
 unsigned short i, j, i_i, i_o, i_copy;
 char car;
 if (input[0] ^= 0x80)
  {
  printf("Errore in rle_decode - Il buffer non e' compresso con rle");
  return -1;
  }
 i_i = 1;
 i_o = 0;
 while (i_i < ll_i)
  {
  i_copy = input[i_i] & 0x7F;
  if ((input[i_i] & 0x80) == 0x80) /* si tratta di una ripetizione */
   {
   car = input[i_i + 1];
   for (i = 0; i < i_copy; i++)
    {
    output[i_o + i] = car;
    }
   i_o = i_o + i_copy;
   i_i = i_i + 2;
   }
  else /* si tratta di fare una copia dei prossimi bytes */
   {
   for (i = 0; i < i_copy; i++)
    {
    i_i++;
    output[i_o + i] = input[i_i];
    }
   i_i++;
   i_o = i_o + i_copy;
   }
  }
 return i_o;
 }



2013/6/11 Charles Mills <[email protected]>

> Thanks. Yes, the compressed data clearly starts out with 80 followed (in my
> case) by a run count 7f of uncompressed characters. After that, I can kind
> of see some pattern but I am a long way from totally figuring it out. It
> would take some real experiments to do so (as opposed to my just looking at
> my existing data) -- or a post here or a private note from someone who has
> already done those experiments.
>
> Charles
>
> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:[email protected]] On
> Behalf Of Massimo Biancucci
> Sent: Tuesday, June 11, 2013 9:12 AM
> To: [email protected]
> Subject: Re: Anyone familiar with how z/OS CSRCESRV works?
>
> Hi,
>
> in the past I had to look at such a tricky because CICS write SMF with RLE
> if requested and I had to uncompress data on a PC.
>
> The compressed buffer must start with x'80' else it's not compressed with
> RLE (so the first character must be x'80' and you have to analyze from the
> second one for the real string).
>
> The escape character should be (once again) x'80' and the maximum length
> for
> the repeat-count  is one byte (max=255) .
>
> I'm not sure at 100%, it was a long ago.
>
> Hope this helps.
>
> Best regards.
>
> Massimo
>
>
> 2013/6/11 Charles Mills <[email protected]>
>
> > Is anyone familiar with the "internals" of CSRCESRV run-length
> compression?
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to