ipxrns (Sat Oct 25 2014 01:31:01)

ipxrns - new version

IPXRNS is to handle the new RNS (Sequence 5plus) service. It sits waiting for
incoming data, parses it, reformats it and sends it on.

eg	ipxrns -s(stratus) -p(theirPort) -n RNS.SEP95
or	ipxrns -s(stratus) -p(theirPort) -n RNS.SEP95 -M
		pram file rns.sep95 is in tables/setup
		all files go to wfs5 spool/newrns (destination newrns)
		-M for this one does the manual resends
or	ipxrns	-P(localPort) -n (param file)
or	ipxrns	-P(localPort) -n (param file) -I	for interactive from iprnsd

Record types and associated formatting and destinations are held in the
parameter file in tables/setup. This is normally the ServiceName (-n input
switch) in UpperCase but can be overridden by the '-z' flag.

One and Only one IPXRNS should have the -M for 'look for Manual resends' flag.
These use files in fix to track what has been asked for.

For Manual resends, use iprnsr to send. This leaves a note ipxrns which scans
the file when the second (third, etc) time check/idle poll arrives with no
intervening traffic. This is to make sure the line is quiet before asking for
repeats.

Crontab every NIGHT should erase all files starting '/fip/fix/rns*' but in any
case the program should zap the 'rns' files at midnight.

Auto resends MAY not come clean if there is heavy traffic as there MAY be 2 or
more files interleaved.

The Syntax of the parameter file is :
	; comment
	msgtyp:(Type) version:(Version) process:(Process) usekey:(Key)
	where	msgtyp  is the LMIL Message Type as in Ref SEQ504
			such as '5NC' for RNS News Control
			Case is ignored.
		version is Message Version Identifier in SEQ504
			normally this will be 'AA'
			(006t may also be 'AB')
			Case is ignored.
		process is the internal IPXR process and can be :
			Case is ignored.
			rnsC	for RNS news control, version aa
			rnsT	for RNS news text, version aa and ab
			rnsF	for RNS news flash, version aa
			rnsH	for RNS header or trailer, ver aa
			rnsX	for RNS missing data, version aa
			rnsR	for RNS resend, first block, version aa
			idle	for Idle Polls
			yuk	for Disaster Recovery
			If no process is specified the 'msgtyp'
			is ignored.
		usekey	is the Key for routing using 'key' below
			Case is ignored.

	key:(Key)  dest:(Valid destinations)
or	key:(Key)  group:(Group)	dest:(Valid destinations)
	where	key	is a key described above. Note that the
			key for RNS news Control is ignored as the
			News Text is used.
		dest	is one or more valid destinations that
			must be in the tables/sys/USERS file.
			Two or more are separated by '+' NOT spcs
		group	is the (Optional) Announcement Group Code
	before:		Fixed text to add at the start of any Rns file
	after:		Fixed text to add at the end of any Rns file
	fixhdr:		additional Fip Hdr info you may want to add
	chrset:		defaults to 'ascii' - FipHdr field SC
	defdest:	defaults to 'rns'  FipHdr field DU
	idlemsg:	message otput if an Idle Poll is found
			default is "Time Check"
	stripeol:	Strip multiple End of lines
			default - dont
	dest-Amarker: (Valid destinations)
			This sends a quick FipHdr-only file of an incoming
			RNS story made from the news control information.
			The FipHdr field specified is used to flag it is
			one of these rushes. The whole text file is sent
			only when all the data is available.
			default: do not send.
	amarker-folder: (Folder for Amarkers)
			default is the main output folder
	dest-abstract (Valid destinations)
			This sends a quick FipHdr and first chunk of an
			incoming RNS story made from the news control
			information and first bit of data.
			The FipHdr field specified is used to flag it is
			one of these rushes. The whole text file is sent
			only when all the data is available.
			default: do not send.
	abstract-size: (size in bytes)	default: 10000 bytes
	abstract-small-files:yes/no
			default: no
	dest-chunk (Valid destinations)
			This sends a new file containing the FipHdr and data
			in chunks up to factors of 'chunk-size'.
			ie the incoming RNS story made from the news control
			information and first bit of data.
			The FipHdr field specified is used to flag it is
			one of these rushes. The whole text file is sent
			only when all the data is available.
			default: do not send.
	chunk-size: (size in bytes)	default: 10000 bytes
	max-chunk-size: (size in bytes)
			Do NOT chunk after this filesize; put all the remaining data into a single,
last chunk
			default: no limit
	chunk-break-table: (yes/no)
			Do/Do NOT break chunks inside an HTML table	default: no
	chunk-folder: (Folder for Chunks)
			default is the main output folder
	add-uid: Add the ID in the HR FipHdr field
	duplicate-folder: (Folder for a duplicate of the file)
			Only complete files are duplicated, not chunks, Amarkers or Abstracts
			default: no duplicates
	duplicate-fiphdr: (extra FipHdr for a duplicate file)
			default: no duplicates

The program will send to the destination that first matches the key. So if
there are several 'if' lines, the first one is used. So any 'if/group' lines,
must be ABOVE the 'if' line for that key with NO 'group' keyword.

ONLY those 'msgtyp's that need to be processed need to be specified in the
parameter file. All others are stripped.

RNS file have a Fip Header of :
		SN - announcement number (with preceeding 'rns')
		SQ - msgseqno of this Control record.
		RA - ann Date and time
		RB - ann Date and time - in original format
		RC - 3 chrs : Y/Z (resend), Correction, Standby
		RY - Y/Z resend flag only or dot
		RR - previous Announcement Number
		RH - Headline
		RD - Company Description
		RI - ISIN : Tradable Instrument Code
		RJ - ISIN : Country Code
		RP - EPIC or Tradable Instrument Display Mnemonic
		RG - Announcement Group Code
		RT - Category - Security Classification (alpha, beta etc)
		RW - For Service Messages/Disaster Recovery/Time Checks - the actual one line
message
		RZ - For Service Messages/Disaster Recovery/Time Checks - the actual record
type
		SI - Seaq Intl indicator
		EA,EF,EK,EP	Related Headline	1-4
		EB,EG,EL,EQ	Related Company Desc 1-4
		EC,EH,EM,ER	Related ISIN Code	1-4
		ED,EI,EN,ES	Related ISIN Country 1-4
		EE,EJ,EO,ET	Related EPIC	 1-4

plus	RU - Service :AMR, Abtract or blank (for main files)
		RF - type of file	S-startheadline, H-chunk, R-replace all

Input Parameters :
	Mandatory :
	-n : name of this service			default: RNS
either  -s : Spider name or TTY device name		default: none
	-p : Spider port number			 default: none
or	-P : Port on UnixBox to use for outbound	default: none
		This is only used where Terminal Servers can
		NOT run reverse telnet correctly and need to set a Permanent
		Virtual Connection across the ethernet to a fixed port number
		on the UnixBox
	Optional :
	-I : use this for the receive from interactive	default: broadcast
		(ths switch is capital eye for 'i' not el for 'l')
	-M : This copy is used for any manual resends	default: no
	-a : Allow automatic resends			default: not allowed
	-A : Do NOT Allow automatic resends		default: not allowed
	-L : also display all incoming traffic.		default: no
	-o : output queue				default: 2go
	-d : dump the RAW feed into file in dump/SU	default: no
	-z : name of parameter file if not the ServiceName	def: no
	-X : incoming records are NOT prefixed with an STX	def: yestheyare
	-m : Using Multicast				default: no
	-v : Print the version number and exit


Version Control
;006y14	05jul99	added rnsR and rnsS
	;a 27jul99 woops bugettre - no seqno for resends SQ:1-3
	;b 26aug99 woops - put err msgs back in for -P
	;c 17aug01 LINUX version
	;d 26nov01 RNS Phase3 mods ...
	;e 19jan02 added Service messages in an RW FipHdr field
	;f-i 5jun02 WINNT
	;j 08jul02 added send-Amarker:
	;k-m 25jul02 added mbone -m
	;n-o 27nov03 added Abstract
	;p-q 04aug04 allow -s host for -P
	;r-s 16aug04 added abstract-small-files:yes/no
	;t 26sep05 added 5NC version AB
		msgtyp:5nc	version:ab	process:rnsC	usekey:rnscopy
	;u 02jun06 added speedy and -9
	;v-x 15feb07 added chunking (again)
	;y14 17sep07 added duplicates, chunk limit and break-tables
		and chunk folder and amarker-folder and abstract-folder
		(11 and 12a - better error handling for duff input data and bug in abstract)
		(14 mods to mcast lib - no xrns)

(copyright) 2014 and previous years FingerPost Ltd.