Program for broadcast of data in ANPA-IPTC IIM model.

IPBDIIM is used to send data down a leased linein IIM format. It uses a
parameter table in tables/bdcast to define which fields get filled in with what
for that file.

In order to present a standard feed to clients, different types of messages
from different sources use different format files which reflect the different
information held in the header fields. 

Features include :
    - Check message generation or suppression.
    - Conversion to non-ascii character sets on the fly.
    - Creation of log copies of transmitted files
    - Exact dumps of transmitted data.
    - Ignore messages which are older than a 'sell-by' date/time.
    - Send messages either in Unix queue order or priority/time.
    - Data can be sent out with no modifications or, if text, wordwrapped.

IPBDIIM reads the file to send, searches for the DB FIP header field which says
what format file to use (if no DB, the default file is used). It then checks 
whether the format file is already in core - normally 10 tables are held. If no
chk_msg, queue, format and archive are specified then they are set to the same
as 'name'.

IIM Records and tags (datasets) are sent out in sequencial order.
Where a tag is mandatory but nothing has been specified, defaults are sent (see
later for actual defaults).

The syntax of the Format file is :
    ; comment line

    ; for the individual tags ..
    tag:(record,tag)    value:(FipSeq)
    tag:(record,tag)    value:(FipSeq)  (optional keywords)
        optional keywords include :
            unique:     (only one occurance allowed)
            many:       (fields may be repeated)
            size: (len) (fixed size of field in bytes/octets)
            maxsize: (len)  (maximum size of field in bytes/octets)
            ascii: (ulxptn) (visual ascii chrs : type for conversion - u-upper, l-lower
            binary:     (data is a binary number)
            bits:       (data is a bits field)
            date:       (data is a datefield)
            time:       (data is a timefield)
            lpad:(chr)  (pad ascii field left with this chr)
            rpad:(chr)  (pad ascii field right with this chr)

Other keywords/parameters :
    ; send the (optional) preheader if a selector box is on the receiver
    ; send an (optional) post trailer if required

    These 4 keywords are used to automatically wordwrap text so it does not need
    to be hnj-ed by the editorial system. Do NOT specify for binary data.
    eol:    string for end of line      default: none
    ww: max line length or 0 if none    default: 0
    stopww: A single chr used to flag that the following text should NOT be
        word wrapped. For example a table embedded in text.
    startww: A single chr used to flag that the following text should be
        word wrapped.
    ; for text files requiring wordwrap ..
    ; .. max 80 columns and insert CR NL no matter what is in the text
    ; if these are NOT specified, the data is sent with no modifications

    log:    destination of a log copy of file as it was sent. default: none
            ie log:sgwcpy
        sgwcpy is a valid destination (DU) in tables sys/USERS.
    delay:  The delay-for-one-second character      default: none
        If specified, when the chr is encountered in the pre:, hdr:,
        or tlr: the program waits a second before continuing
        This an be a printable character (like punctuation), Unix escape
        or an octal number AS LONG AS it is not needed for any field.
    balance-seqno:  Send the Sequence number to this Balance Group (see
            Use this to make sure the sequence number is always updated on 
            any companion systems.

Input Parameters are :

    Mandatory :
    -s : Terminal server (spider name) or TTY device name   default: none
Either  -p : port number if spider              default: none
Or  -P : Passive port number                default: none
    -n : name of service                    default: none

    Optional :
    -f : default format file                default: name
    -q : queue to scan in /fip/spool            default: name
    -l : do NOT log items                   default: log
    -t : scan interval of the queue             default: 1 sec
    -a : archive file                   default: name
    -c : Time check message file in tables/bdcast
    -o : send files in priority/time order  default: send in unix order
        files are normally sent in the order they are in the 
        unix queue. This switch is for low speed lines where
        we want to send in priority/time order.
    -m : no chk_msgs pls                default: chk msgs pls
    -i : interval in secs between chk_msgs      default: 300 secs/5 min
    -I : force chk_msgs out              default: no
        Use this to always transmit chk msgs every 10 mins or so.
        This will automatically adjust to though it is starting on the hour
        ie '-I -i 600' for 10 mins, chk msgs will be sent at
            0, 10, 20, 30, 40, 50 mins past the hour.
    -d : take exact copy of outgoing text in ~/dump/SERDES  default: no
        used for debugging and testing.
    -r : set Lowest priority.               default: 9
        If under this, the default is used.
    -R : set the default priority for files with no     default: 3
        priority or priority out of range.
    -h : set High priority                  default: 1
    -H : Fip Hdr field for Priority             default: PR
    -v : print version no and exit

This program uses 2 environment variables :
    FIP_USA_DATE y/n for dates

Version Control
;001e   29mar99 LINUX   ;b 20sep99 parse buffer mod and balance-seqno
        ;c cleanup
        ;d 01jan03 MACOSX
        ;e note_balance_action

(copyright) 2017 and previous years FingerPost Ltd.