ipgtwy

ipgtwy

This program feeds files to an Atex J11 system via NFS Gateway.

When started first goes and gets files :
    - The default parameter FORMAT file : tables/gateway/FORMAT     
    - The default J11 header        : tables/gateway/header/WIRE
                            or WIRE.HED-HEADER-SYS
    - The standard qdata parameter file : tables/gateway/QDATA
These defaults can be overridden using inputs switches defined below. 

The program scans a queue in spool - usually spool/2atex - and sends any files
to the J11 network. 

A maximum file size can be specified using the -B input switch. If a file that
is bigger arrives, it is logged and sent to the woops queue for a System
Manager to decide what to do. This is to stop people sending inappropiate files
over - like JPEG mailfiles or complete Quark Pages.

Incoming 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.
    DS: Supercede this file if it already exists. default: duplicate

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 either header or trailer.

If a FIP hdr field FBIN and FADDHDR are present, the data of the file is
considered complete but we need to add a Header.

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 J11 filename       default: \SN
    pchr:   (mode precedent chr)    (eoln)
        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 text on the J11    default: none.
    after:  (fipseq)        (eoln)
        String to add after the text on the J11     default: none.
    dup:    ($ or inc or zeros)     (eoln)
        CCM like duplicates or incrementing names (see below) def:inc
    usa-date-format:    Date format should be MM/DD  (default is DD/MM)
        usa-data-format:no will also force it DD/MM
        See also the environment variable FIP_USA_DATE
    qdata:  (qdata param filename)  (eoln)
        Use this to specify either NO qdata - using a blank parameter
        or a different Qdata file in tables/gateway. See below.

  For each header field that needs filling in :
    hdr: (2 letter j11 header field) (space/tab) (fipseq for that hdr field)
(eoln)
  or for right justified fields :
    rhdr: (2 letter 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 qdata and are
replaced by a '.'.

Files of the same name in a different queue are normally NOT overwritten - the
filename is altered depending on the 'dup:' keyword. 

If 'dup:inc' then the filename is incremented : if the name is 9 chrs long, the
last chr is incremented; if less than 9 chrs, an 'a' is suffixed to the name.
This is the default.

If 'dup:$' then the filename is changed to a CCM-like extention of $01 etc.

If 'dup:zeros' then the extension is forced to .000 up to .999

If a 'qdata' parameter file is specified then this is used to define QDATA on
the J11. If 'qdata' is specified WITHOUT a parameter (ie 'qdata: (eoln)), NO
qdata will be created. However if the parameter s NOT specified, the default
QDATA file is used.

The syntax of the QDATA file is :
    ; comment lines (eoln)
    (j11 hdr field) (colon) (size) (colon) (optional FIP hdr sequence) (eoln)

    where j11 hdr fields and FIP hdr sequences are as described above.
    where Size is the length of the field
    Fields are padded to the correct length with spaces
eg:
    ; comment
    AF:22:\$A
    ; no data needed for PA - leave as SPACES
    PA:3
    ED:4
    ; Priority
    PR:2:\XP

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)
    newdq:  (replacement Fip Hdr field for DQ containing the j11 q-g) (eoln)
    defaultquegrp:  (default j11 q-g if none specified or found in the DQ FipHdr
field ) (eoln)
    update: (j11 name-queue-group)  (eoln)
    updtop: (Text and/or FipSeq)    (eoln)
    updappend: (top / bottom)   (eoln)
    force:  (j11 queue-group)   (eoln)
    bcmsg:  (msg text)      (eoln)
    bclogon: (logon or logons)  (eoln)
    bcsys:  (j11 system)        (eoln)
    dir:    (directory name and parameters) (eoln)

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, text and qdata.

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 option will ignore the contents of the DQ: FIP header queue and will
attempt to place the file in this queue-group.

NEWDQ allows you to specify an alternative Fip Hdr field to 'DQ' which will
contain the J11 queue and group. This can also be a combination field with a
default :
    combie:AQ   EQ|QQ,junk-wir
    newdq:AQ
This will look in EQ first; if there is no EQ, QQ is used; if there is no QQ,
the default is 'junk-wir'. Note if you have FORCE option, this is ignored
anyway!

DEFAULTQUEGRP specifies a default j11 queue and group if the DQ FipHdr field
does not exists (or its replacement with 'newdq:' see above) or there is
nothing in the field.

There is also an option to UPDATE an existing J11 file. This uses the 'update'
parameter. In this case any existing file on the J11 is updated but not
replaced.
    update:     (j11 name-queue-group)      default: none
The parameter to 'update' is the actual name-q-g to update. This can be a
FIPSEQ eg:
    update: \VN
    where FIP hdr field VN will contain the full atex f-q-g.
If the j11 file is not found, in-use or is being created, a message is logged
and the file IGNORED. Any text in the rs6000 file is ignored. Any text in the
J11 file is preserved. Parameters 'name', 'after' and 'dup' are ignored.
UPDATE is normally used to change j11 header fields - file status for example.
UPDTOP allow you to add text at the TOP of the file (only where 'update' has
been specified).
    updtop:{M2 File modified on \$d-\$m-\$y \$h:\$n\002{M0
    To add the first lines of data in the rs6000 file to the j11 file :
    updtop:\$t\002
UPDAPPEND will append the data from the rs6000 file either on TOP or on the
BOTTOM of the j11 file. The default is on Top. Again only where 'update' has
been specified.
    updappend:top
or  updappend:bottom

Messages (as per Broadcast message) can be sent by specifying 3 parameters:
    bcmsg:      Msg text in FIP sequence    default: nothing
    bclogon:    J11 logon(s)            default: all logons
    bcsys:      J11 sys number          default: all systems

Directory(ies) can be created in queue spool/gdirs with a specific number of
lines of text. These can be called across from the J11 using IPGCALL. The
syntax for the directory is :
dir:(filename) items:(no of items) lines:(no of lines) top:(header line) fifo:
    where :
        The filename is the name of the directory in spool/gdirs
        items: number of files or items to keep in the directory if lifo
            The default is 100.
        lines: number of text lines (maximum) per item. The default is 3
        fifo:  make the directory first-in-first-out and ignore the
            items keyword.      default: lifo
        top:    FipSeq for the first or header line for each file. The
            Name, queue and group are always added as the first
            section of text. This parameter MUST be within double 
            quotes where spaces are embedded. eg :
            top:"\XP   \XC   \XK           \$h:\$n\"
        qmode:  Mode the queue-group is in. Normally this is hidden
            but may be revealed by qmode:0      default: mode 9

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 

IPGTWY uses environment variables and input switches on starteup to override
its defaults :
    FIP_GTWY_defDQ      default queue-group default: spike-wir
    FIP_GTWY_defSN      default atexfilename    default: gtwy.000
and if necessary, the characters which are considered End-of-Line and End of
Words:
    FIP_GTWY_EOLN       End of Line chrs    default: \002\003\004\005
    FIP_GTWY_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_GTWY_EOLNNL  End of Line chrs   default: \002\003\004\005\012
    note that all EOL env variables should be between double quotes.
    FIP_GTWY_LINE       No of chrs per line default: 80
                for the \$L parameter.

Input switches (All optional) :
    -o : Atex nfs path name     default: /Atex/commgr/wires
    -n : Atex nfs path name for headerless files. default: /Atex/commgr/noh
    -t : sleep time betwix scans    default: 1 sec
    -q : queue to scan      default: 2atex
    -d : default qdata file     default: tables/gateway/QDATA
    -h : default header file    default: tables/gateway/header/WIRE
    -H : path to header-sys on J11  default: /Atex/commgr/wires/sys/header
    -B : do NOT copy files bigger than this size (specified in kilobytes).
                    default: allow ALL files
        eg: send all files greater than 1mb to woops    -B 1000
        Note that the j11 does NOT really like big files !!
    -x : default trans table file   default: tables/gateway/FORMAT
    -z : force NO NL->QL translation default: NL->QL and 0220-> 1/3
    -v : print version number and exit

Version Control
;018j   26aug97 added dup:zeros, allowed upto 99 dups and added defaultquegrp
        ;a 4nov97 ucase names pls
        ;b 29mar99 LINUX
        ;c 23may02 cleanup - small issue with j11 headers
        ;d 06jun02 added script
        ;e-h 05feb03 added modes MA->ME and bigger Before/Afters
        ;i 27mar03 added usa-date-format:

(copyright) 2024 and previous years FingerPost Ltd.