pdl checksum

  • Creator
    Topic
  • #52002
    Thomas Rea
    Participant

    We have an astm pdl with the follwing phrase definition:

        define phrase basic-msg;

          ;

          phrase-check { store-in: chk1,

            method: add,

            modulo: 256,

            encoding: ascii( radix: 16, width: 2, pad: ‘0’, case: allupper)} =

          begin

            field data = variable-array( not( ) );

            ;

            field term = fixed-array(1,or(,));

          end;

          field chk1 = fixed-array(2,any);

          ;

          ;

        end phrase;

    It works great until the message has a checksum of ’00’.   The pdl then errs with “decode(ascii) of `00′ failed: Encoding contained no data”.

    The message looks like this:

    [pdl :PDL :DBUG/0:il_im_cpr_astm:09/21/2010 12:51:23] read 49 bytes

    [pdl :PDL :DBUG/0:il_im_cpr_astm:09/21/2010 12:51:23] input buffer accepted 49 bytes, now 49

    [pdl :PDL :DBUG/0:il_im_cpr_astm:09/21/2010 12:51:23]  02 33 4f 7c  31 7c 31 35  |.3O|1|67|

    [pdl :PDL :DBUG/0:il_im_cpr_astm:09/21/2010 12:51:23]  35 31 36 33  37 31 31 7c  |3163522||

    [pdl :PDL :DBUG/0:il_im_cpr_astm:09/21/2010 12:51:23]  5e 5e 7c 5e  5e 5e 50 54  |^^|^^^PT|

    [pdl :PDL :DBUG/0:il_im_cpr_astm:09/21/2010 12:51:23]  5c 5e 5e 5e  49 4e 52 7c  |^^^INR||

    [pdl :PDL :DBUG/0:il_im_cpr_astm:09/21/2010 12:51:23]  52 7c 7c 7c  7c 7c 7c 7c  |R||||||||

    [pdl :PDL :DBUG/0:il_im_cpr_astm:09/21/2010 12:51:23]  7c 7c 7c 0d  03 30 30 0d  ||||..00.|

    [pdl :PDL :DBUG/0:il_im_cpr_astm:09/21/2010 12:51:23]  0a                                  |.|

    The vendor claims they are using Modulo 256 and that ’00’ is a valid checksum.  I have no experience with checksums, so I am totally in the dark.

    Does anyone know why this works fine util the checksum is ’00”?

    Thomas Rea

    Saint Francis Health System

  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,293
Replies
34,435
Topic Tags
286
Empty Topic Tags
10