Length encoded PDL

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Length encoded PDL

  • Creator
    Topic
  • #50317
    Todd Lundstedt
    Participant

      Is there an existing PDL, or has anyone already invented this wheel?

      We are connecting to a vendor that requires a header instead of MLLP for record identification.  The header is:

      Code:

      byte 1: Message Type: D = Data, A = Ack, N = Nak, P = Poll (Polls are keep alive msgs)
      bytes 2-6: Message Length: Length does not include header length
      bytes 7-11: Message Transaction ID: Used to correlate Ack/Nak with original Data message

      I am a PDL newbie, so if there is a PDL that exists that will accomplish this, delivered or custom coded, I would sure appreciate getting a hold of that.

      Otherwise, it’s off to reading the PDL for Dummies manuals.

      Thanks in advance.

    Viewing 4 reply threads
    • Author
      Replies
      • #65606
        Jim Kosloskey
        Participant

          Todd,

          Ask the venodr if he can do length encoded TCP/IP. If so there is no PDL required.

          But I am guessing you will want some Tcl to manage the header anyway.

          Sounds like a vendor that has yet to leave the Bi-Synch communication days behind.

          What your vendor describes is not an encapsulation technique but rather simply a message header.

          If he cannot do length encoded, then I don’t think PDL will work for you without an end of message encapsulation. So I think you and the vendor will need to agree on what exactly will delineate the message – and if the vendor does not have an end of message delineator then he might need to add one – so why not just do length encoded?

          AND A text based encapsulation is risky because the text pattern could be imbedded in the message itself causing misinterpretation of the message – the dreaded ‘no more phrases’ log entry.

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #65607
          Todd Lundstedt
          Participant

            Jim,

            Am I understanding your post… PDL doesn’t work without a closing character for encapsulation?

            The tcp_acknak pdl phrase doesn’t appear to have an end of message encapsulation, if I am reading it correctly:

            Code:

            define phrase basic-msg;
               field msglen = fixed-array( 4, any );
               length-encoded { encoding:network(bytes:4), store-in: msglen } =
                   begin
                       field data = variable-array( any );
                   end;
            end phrase;

          • #65608
            Jim Kosloskey
            Participant

              Todd,

              I believe that pdl is for handling a length encoded message.

              The inbound message still needs to have the length encoding attached.

              I see no reason to use a pdl when the tcp/ip protocol in the NetConfig will recognize and handle the length encoding if it is there.

              Your vendor will still need to provide length encoding or true encapsulation I think.

              email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

            • #65609
              Michael Hertel
              Participant

                Todd,

                Here’s a pdl that we use on our rad flat results interface:

                /* $Id: idxrad.pdl,v 1.3 1998/02/21 00:05:27 neuts Exp $ */
                /*
                * idxrad.pdl – Flat record protocol for results
                */

                define driver idxrad;
                [code]/* $Id: idxrad.pdl,v 1.3 1998/02/21 00:05:27 neuts Exp $ */
                /*
                * idxrad.pdl – Flat record protocol for results
                */

                define driver idxrad;

              • #65610
                Michael Hertel
                Participant

                  Here is a copy of the tclproc we use for an example for you.

                  There is startup/shutdown stuff that may be helpful.

                  Code:

                  ######################################################################
                  # Name: rad_shake
                  # Purpose:
                  # UPoC type: tps
                  # Args: tps keyedlist containing the following keys:
                  #       MODE    run mode (”start”, “run” or “time”)
                  #       MSGID   message handle
                  #       ARGS    user-supplied arguments:
                  #              
                  #
                  # Returns: tps disposition list:
                  #          

                  #

                  proc rad_shake {args} {
                     keylget args MODE mode
                     global HciSite HciConnName HciProcessesDir
                     set module “$HciSite/$HciConnName/rad_shake: ”
                     set ctrfile radidxctr
                     
                     if {[file exists $ctrfile.ctr] == 1} {
                  #echo “$module Using counterfile $ctrfile…”
                  #echo [pwd]
                  #echo $HciProcessesDir
                     } else {
                  echo “$module Initializing counterfile ‘$ctrfile’…”
                  CtrInitCounter $ctrfile file 1 99999 1
                     }

                     set dispList {}

                     switch -exact — $mode {
                         start {
                  # Perform special init functions
                  # N.B.: there may or may not be a MSGID key in args
                         }

                         run {

                  keylget args MSGID mh
                  set msg [msgget -cvtnull _ $mh]

                  switch -exact — $msg {
                  “START-UP XXXX” {
                  append msg “V0000     ”
                  set response [msgcreate Y$msg]
                  lappend dispList “KILL $mh” “OVER $response”
                  }

                  “SHUTDOWN XXXX” {
                  append msg ”          ”
                  set response [msgcreate Y$msg]
                  lappend dispList “KILL $mh” “OVER $response”
                  }

                  default {
                  set dstring [clock format [clock seconds] -format %y%m%d%H%M%S]00
                  set response [msgcreate “Y[string range $msg 0 12]          “]
                  if {[crange $msg 13 13] == “R” && [msglength $mh] == 166} {
                  msgset $mh [strsub $msg 56 73 [rad_dr_n2a [crange $msg 56 61]][rad_dr_n2a [crange $msg 62 67]][rad_dr_n2a [crange $msg 68 73]]]
                  }
                  msginsert $mh “[crange [expr 100000 + [CtrNextValue $ctrfile]] 1 end] [crange $dstring 0 5] [crange $dstring 6 13]”

                  #kill test patients with MRN beginning with 8-88-8 per WR 61688
                  if {[crange $msg 14 14] == “D” || [crange $msg 14 19] == “8-88-8″} {
                  lappend dispList “KILL $mh” “OVER $response”
                  } else {
                  lappend dispList “CONTINUE $mh” “OVER $response”
                  }
                  }
                  }
                         }

                         time {
                  # Timer-based processing
                  # N.B.: there may or may not be a MSGID key in args
                         }

                         shutdown {
                  # Doing some clean-up work
                         }

                         default {
                     error “$module Unknown mode ‘$mode'”
                         }
                     }

                     return $dispList
                  }

              Viewing 4 reply threads
              • The forum ‘Cloverleaf’ is closed to new topics and replies.