This program feeds files to/from a Sparc and a PCI on an Atex J11 system using
SENDSEND protocol and HDLC via the serial port of the Sparc.

It is available ONLY for Solaris 2 machines.

Incoming files are not translated and are passed on to IPXBIN for processing
from Atex 16 bit to Ascii.

Outgoing files are translated on the fly.

When first started it goes and gets files :
    - The default parameter FORMAT file : tables/sndsnd/FORMAT      
    - The default J11 header        : tables/sndsnd/header/J11HDR
These defaults can be overridden using inputs switches defined below. 

-----For files FROM the remote J11----

The complete file, unchanged, is left in queue spool/xsndsnd for IPXBIN or
whatever to pull apart.

Routing, character translation etc are all handled by IPXBIN and not IPSNDSND.

-----For files TO the remote J11-----

The program scans a queue in spool - usually spool/2sndsnd.

Files are checked for FIP header fields :
    DH: J11 Header file to use if not default
    DF: Format or Translation table file if not the default.
        In particular, wire files brought in by the WIRE program generally use the
WIRE format, Mailbox uses BOX, Data formats uses FORM etc.

If a FIP hdr field FNOHDR is present No J11 header will be added. The text will
be scanned/processed in the normal way.

If a FIP hdr field FBIN is present, the file is considered a complete file and
NO alterations will be made at all to the trailer. Normally a header will be
added unless FNOHDR: is flagged too.

The FORMAT parameter file is then used to determine how to process the text and
how to fill in which J11 header fields with FIP header fields and/or standing
text and/or system variables.

Syntax :
    ; comment
    name:   (fipseq for filename)   (end of line)
        This will be the filename on the remote J11 default: \SN
    pchr:   (mode precedent chr)    (eoln)
        This is inserted in the text to change modes on the remote
        This allows {M0 to be roman on the J11, {M1 bold. default: '{'
    number: (dec, oct or hex)   (eoln)
        This allows escaped numbers specified in \000 type strings to 
        be decimal, octal or hex            default: octal.
    before: (fipseq)        (eoln)
        String to add before the ordinary text      default: none.
        on the remote j11.
    after:  (fipseq)        (eoln)
        For files being sent to the remote :
        String to add after the ordinary text       default: none.
        on the remote j11.

  For each header field that needs filling in :
    hdr: (2 letter remote j11 header field) (space/tab) (fipseq for that hdr
field)  (eoln)
  or for right justified fields :
    rhdr: (2 letter remote j11 header field) (space/tab) (fipseq for that hdr
field)  (eoln)

Where fipseq is a sequence of fixed text, unix escape chrs, FIP header fields
and Octal chrs).

Note that values above octal 200 are invalid in the header and are replaced by
a '.'.

There a several Optional parameters, please see below :
    atex012: (char for j11 012 chr) (eoln)
    softquad: (char for a j11 soft end of line) (eoln)
    forceque: (force all files to this remote j11 queue)    (eoln)
    forcegrp: (force all files to this remote j11 group)    (eoln)
    defremque: (default queue for files on remote j11)  (eoln)
        Normally this is picked from the Fip Hdr field AQ.
        This defaults to SPIKE
    defremgrp: (default group for files on remote j11)  (eoln)
        Normally this is picked from the Fip Hdr field AG.
        This defaults to WIR

ATEX012 is the 1st non-space character of the parameter is that used for any
Octal 12 atex chrs. The octal 12 chr is a NL which is what we normally use for
any Quad. This defaults to octal 220. The parameter can be a chr, unix escape
or octal number. The value is changed in the header and text.

SOFTQUAD is a character which will put the end-of-line mode on the next valid
character. The character can be a chr, unix escape chr or octal number. Take
case not to assign a value that you need ! The value is valid ONLY for text and
must not be 0/NUL.
    ie If an EndOfLine mode is required on a character that does not normally have
such a mode set, the 'softquad' chr will stick it on - ie if softquad is a
tilde :
    'rubb~ish' in the text will force an end of line on the 'i'.

The FORCE options will ignore the contents of the FIP header fields AQ and AG
and will force the file to this queue and group.

----- General parameters -----

Optional (but significant) Parameters in our file :
    syncinit: (device setup string for syncinint) (eoln)
        See below in the notes section for more info on syncinit.

    address: (local address number) (eoln)      default: 5
        Note that address at each end of a link
        MUST be different. The range is 1-7;

Use if you need on occasion - especially Setup :

    trace:  This creates a log file         default: no
        This is called HDLC.(address).date.time and is in
        fip/log. It is used to watch the actual packets coming thru.

These rarely need to be changed :
    hdlctim: (hdlc timeout in secs - T1)    default: 5 secs
        push up for slow remote j11s
        range is 1-10 secs
    hdlcrty: (hdlc - no of retries - N2)    default: 20
        range is 10-30
    hdlcwin: (hdlc - window size)       default: 3
        range is 2-7
        bring down for slower speeds

Note these are only read on start up, so they MUST be in the default FORMAT.

---- Environment variables and FipSeq ----

IPSNDSND uses environment variables and input switches on starteup to override
its defaults :
and if necessary, the characters which are considered End-of-Line and End of
    FIP_SNDSND_EOLN     End of Line chrs    default: \002\003\004\005
    FIP_SNDSND_EOWD     End of Word chrs    default: \040\034\035\055
If the '-z' input flag for force is ON, the env variable used is :
    FIP_SNDSND_EOLNNL    End of Line chrs   default: \002\003\004\005\012
    note that all EOL env variables should be between double quotes.
    FIP_SNDSND_LINE     No of chrs per line default: 80
                for the \$L system variable.

Where sections of FipHdr fields are required or changes to the output style,
use keywords : fixed, partial, combie, optional, repeat, newdate and/or style.
(see The SysAdmin manual for more information).

    They are normally specified :
        fixed:QZ    1234543
        partial:QT  ST,3,2,U,<,>
        combie:QY   ep|na,(0000000)a 
        option:QE   ep,11,7,s
        repeat:QK   XK,-,3  
    or  repeat:QP   PK,,4,#X
        style:QS    XN,%.03d 

There are also three extra system variables for FipSeq  for files being sent to
the remote :
    \$T - First line of text
    \$C - Character count
    \$L - Line count

---- Input Switches ----

Input switches (all optional) :
    -p : zsh port number        default: 0
        0 is the equivalent of ttya, 1 is ttyb etc
    -d : device         default: zsh
        example     -d se_hdlc
    -i : queue to scan      default: spool/2sndsnd
    -o : output queue       default: spool/xsndsnd
    -h : default header file    default: tables/sndsnd/header/J11HDR
    -z : default trans table file   default: tables/sndsnd/FORMAT
    -x : force NO NL->QL translation default: NL->QL and atex012 -> 1/3
    -t : sleep time betwix scans    default: 1 sec
    -l : do NOT incoming and outgoings files    default: log
    -v : print version number and exit

--------- Notes -----------
--------- Notes -----------
--------- Notes -----------

--------- Setup -----------

-- Device setup - speed, clocking etc using SYNCINIT

Syncinit is used to setup the ZSH device (ie port a).
    Default setting is the equivalent of :

    syncinit:9600 loopback=no txd=-txd rxd=-rxd txc=txc rxc=rxc crc=16 nrzi=no

    syncinit:9600 loop=no txc=txc rxc=rxc crc=16 nrzi=no break=on echo=no

    This is correct (normally) when running through 2 modems.

When the Sparc and the J11 are plugged directly with no comms device between,
you will need a SYNC crossover cable.

The cable should crossover for timing (pins 15, 17 and 24) as well as the
normal ones :
    Sparc   J11

In this case the J11 is providing the clock and the Sparc 'syncinit' parameters
stay the same.

If the Sparc is to generate the clock, the cable changes to that 24 is NOT
connected on the J11 side but IS on the Sparc side and the 'syncinit' command
(theoretircally as it has not been tested) : txc=baud

Read Unix Man pages for 'syncinit' for more info.

Remember that if you run the program under a non-privileged logon (ie NOT root)
then you should chown xxx /dev/zsh, or whatever the device is, to set the
correct permissions

You can check if there is no logons/gettys running against the port by using
    pmadm -l
zsmon     ttymon     ttya      u    root    /dev/term/a I - /usr/bin/login - 9600
ldterm,ttcompat ttya login:  - tvi925 y  # 
zsmon     ttymon     ttyb      u    root    /dev/term/b I - /usr/bin/login - 9600
ldterm,ttcompat ttyb login:  - tvi925 y  # 
If there are - like in the above example, you need to disable (and possibly
remove ??- check after reboot) using
    pmadm -d -p zsmon -s ttya (or b)
    pmadm -r -p zsmon -s ttya (or b)
Do a 'man' for more information.

-- Setup the J11

MoniniX should contain the line such as :
Note that the station address 2 for port a and 1 for port b in this example :
/st:0201 MUST be different to the 'address' parameter in the our FORMAT
parameter file. (the default address for IPSNDSND is 5)

    1. wrklst FILXMT on the queue(s) you need
        wrklst tosun-pol,filxmt,/d,tosun-pol,,poa:<$f-$q-$g
        spool  tosun-pol

    2. add a single FILRCV for traffic FROM the Sparc :
        filrcv  -marco-pol<pia:/lg

-- Setup on Sparc

Before starting you need to check that the relevant spool queues exist - and
make them if not.

Check the default FORMAT file in tables/sndsnd. This needs to exist even if you
are using the default settings - just put a single comment in file
tables/sndsnd/FORMAT. If you know that certain types of traffic which are
slightly different, such as WIRE, PWIRE, BOX, FORM then also create parameter
files for these. Again they can start off as copies of the default and tuned
later on.

At least one header file MUST exist in tables/sndsnd/header. The default is
called J11HDR. To create, use the program 'ipj11hdr' (see that for more doc)
which will take an ascii, editable file and create a J11 header. There should
be a template edit file in tables/sndsnd that can be copied and changed :
    cd /fip/tables/sndsnd
    vi J11HDR.edit
    ipj11hdr -h header/J11HDR -s J11HDR.edit

Traffic from the Remote will need to be mangled by IPXBIN or your own program.
This normally takes a parameter file in tables/setup - example SNDSND :
    ;   XBIN parameter file
    ; type of file - ignored, use default for ordinary text

    ; mode presy chr

    ; modes to strip - ignored, use default

    ; use the incoming filename as a Fip filename

    ; create the following FIP hdr fields from J11 hdr fields
    ; remember we already have AQ and AG for queue and group
    ; j11 NO -> FIP AN hdr field
    hdr:NO  AN

If you are unsure of which J11 fields to translate in IPXBIN, stop IPXBIN
spooling, capture a couple of incoming files and run IPXBIN manually using the
-1 (single shot) switch with a -x (no delete) and -o (new queue) plus stick an
'allj11hdr' in the parameter file.

Lastly add this, and IPXBIN, to the SYSTEM file. Example :
    snd1    local   ipsndsnd
    snd2    local   ipxbin -i xsndsnd -R -l -z SNDSND

(copyright) 2017 and previous years FingerPost Ltd.