FipSeq - header manipulation and system variables.

Also see basic fip header description:



Introduction to FipSeq

Quite often the information in FipHdr fields needs to be presented, formatted or styled differently on output.

Sometimes you need to find out times and dates when the files were processed.

Maybe you need to embeded non-printable characters at the begining or end of a file to start so anterior process.

FipSeq is the notation used to select and format these types of actions.

If you are testing difficult bits of FipSeq, we recommend you use the program 'sffparse' which reads a parameter file of FipSeq, an data file with a FipHdr or a FipHdr string plus an output expression. All you would ever want in the world of FipSeq !


Six Types of FipSeq

There are six basic types of FipSeq which can all be mixed and matched where necessary :

1 Ordinary visible data

: The sort of stuff you can type and see !

The Slow-challenged coloured cunning-quadruped jumped over ... etc etc etc

2 Control or unprintable characters

are preceded by backslash and are 3 numbers such as \040 \333 representing their octal values.

Note that Hex numbers can also be specified as \xA9 at any time - (that is little %u2018x%u2019 after the %u2018\%u2019 and two hex digits)

The number system used can be octal (default), decimal or hex depending on the 'number%u2019 keyword specified in your parameter file.

eg a space is \040 (octal), \032 (decimal) and \020 (hex)

Or Jimmy Olson could be represented as .... Jimmy \321lsen

3 Unicode Characters

(UTF-8) - backslash and 4 hex numbers : \uXXXX eg \u12BC

4 Common Escaped control characters

- single letter following a backslash:

Valid ones are :

\r CarriageReturn Octal 015
\n NewLine Octal 012
\l CR NL Octal 015 012
\s Space Octal 040
\f FormFeed Octal 013
\t Tab Octal 011
\b Backspace Octal 010
\\ Backslash Octal 134

5 Contents of FIP header fields

using a \ with two UPPERCASE letters (the second may be a number)

eg:

\SN - output the filename 
\SU - output the Wire Agency name 

Remember that the Source Header field (SH) is a special case and to get the data specify \Xn where n is the single SH field (note that actual FipHdr fields starting 'X' like XS are NOT accessible).

For example:

SH::Sreu:N1234:P3:CSSS:KSports Roundup 

In this case \XK gives 'Sports Roundup' and \XP gives '3'


6 System Variables

These can be used liberally throughout any of the output programs

Field Remarks Example
\$A J11 style NAME;dd/mm JAMES;03/12
\$S 3 figure sequence number This is normally incremented for each file 123
\$Z 4 figure sequence number This is normally increments on each file 0037
\$V 4 figure sequence number incrementing on each call 9397
\$Y year (99) 97
\$E century (19 or 20) 19
\$I month (mm) 11
\$M month (Mmm) Mar
\$D day (99) 23
\$H hour (99) 10
\$N min (99) 54
\$G offset from GMT +2
\$F GMT date and time in CCYYMMDDHHMMSS format  
\$B sec (99) 45
\$J julian day of the year 111
\$K Day of the week (abbreviated to 3 letters) 111
\$U No Of seconds since 1st Jan 1970 - UnixTime? or C Time  
\$R random alpha numeric character between a-z, 0-9  
\$X strip trailing spaces from this point to the last non-space  
\$O if Optional field failed, strip to this point (see below)  
\$L no of lines for file (only in some programs)
\$W no of words for file (only in some programs)
\$C no of chrs for file (only in some programs)

Plus for certain programs :

\$T first 80 chrs of text ipedsys, ipsgml
\$1 first line of text ipedsys, ipsgml
\$9 ninth line of text ipedsys, ipsgml
\$Q time taken vwire

Note: in the old versions, if you use a sequence number several times for the same file, (\$Z or \$S) then the seqno was incremented EACH time you call it. This is no longer true. %u2013 use \$z or \$s for incrementing on each file and \$v for incrementing on each time it is used within a file.

Reformatting FIP header field data

( Using and abusing FipSeq)

Note that all the different types of FipSeq can be mixed in whatever you are outputting

For example, IPPRINT page heading might look like :

   header:File:\SN\tFrom:\SU\r\nPrinted at:\t\$h:\$n \$d-\$m-\$c\$y\r\n\r\n

For a file AFP0223 from Source AFP would give 3 lines at the top of the page :

   File:AFP0223   From:AFP
   Printed at:   12:20 23-Mar-1996

Part X But what happens when :

  • you only want PART of a header field?
  • you have a field that contains several sub-fields?
  • you want to test if a field exists or not?
  • you need to make sure the data is an exact number of bytes, possibly padding left or right?

So now we have to start playing with the FipHdr data to create new FipHdr fields for internal use only.

There are thirteen functions for reformatting the data:

The syntax used is :

  (keyword:) (New FipHdr field) (tabs/spaces) (parameters)   (eoln)


FIXED - create a new FipHdr field from existing data or a fixed string, or a combination of the two.

  fixed:QT   1234543
ie If \QT is specified, replace with 1234543

or ..

fixed:QZ   1234543\$j..\SN

if QZ is specified, output 1234543JulianDate..Contents_of_SN_hdr_Field

fixed in more detail

  Syntax  fixed: [newfield]   [tab/space]   [fixed text]

use escape chrs like \s to embed spaces, tabs, newlines etc

If you use a sequence number several times for the same file, (\$Z or \$S) then normally the seqno is incremented EACH time you call it.

However if you specify it once in a fixed field, this new FipHdr field can then be used as many times as you wish !

Example :

    before:\$Z : is the seqno
    after:\$Z : is now the next seqno

if the seqno is 24, this will stuff :

"24 : is the seqno" at the top of the file and ": is now the next seqno" at the bottom

Probably NOT what you wanted!

Using fixed we get the same result for this file, next seqno for the next etc.:

    fixed:QZ   \$Z
    before:\QZ : is the seqno
    after:\QZ : is still the seqno

if the seqno is 24, this will stuff :

    "24 : is the seqno"      at the top of the file
  and   "24 : is still the seqno"   at the bottom


PARTIAL - Create a new FipHdr field from a subset of an existing FipHdr field

   partial:QT   ST,3,2,U,<,>

partial in more detail

An example:

   partial:QT   ST,3,2,U
Create QT using the contents of the ST header field, starting at position 3 for 2 characters and, if alphabetic, force UPPERCASE.

Syntax

partial: [new field] [tab/space]
   [existing field] [comma] [start position]
   [opt comma] [opt length]
   [opt comma] [opt processing]
   [opt comma] [opt start character]
   [opt comma] [opt end character]

where

  • Start position and length are counters from 1, not 0
  • Length can be zero or not defined, meaning all characters in the field
  • Processing can be one or two characters (or none for no change) :

If you want to filter a TYPE of character :

a Alphabetic letters
x Alphanumeric - letters and numbers
e Alphanumeric plus dot
z ANPA type - alphanumeric plus dash
d Decimal numbers plus optional dot, commas
m Money plus optional dot, commas, plus, minus and dollar
n Numeric 0,1,2,3,4,5,6,7,8,9
t Punctuation (!"\043$%^&*()_+=-:;@'~#<>,. &124; \)
s Space (space, tab, ff, cr, nl but NOT backspace)
p Printable (including space)
c Control

Filters on negatives are also valid using a '#' before the type eg.

   partial:ZE   SN,,,#c
Will give all the characters which are NOT control characters. This will ONLY allow characters matching this type.

For alphabetic characters, you may also force the case :

u uppercase
l lowercase

   partial:QE   SN,1,6,#sL 
Will give the first 6 non-space chraracters forced lower case

Start character is a start of valid data character

End character is an end of string when this character is encounted


REPEAT - create a new FipHdr field from a subset of an existing FipHdr field:

  • based on a field delimiter like a dash :

repeat:QR   XK,-,3

or

  • based on a type like NOT a number or a SPACE

repeat:QR   XK,,3,U,N

repeat in more detail different types of syntax :

  • 1. with a particular chr as separator :

    repeat:QR   XK,-,3

find FipHdr field XK, using '-' as sep, find the 3rd sub-field

Use this for FipHdr fields like :

    RR:engine-train-coach-seat-trolley

  • 2. using a type of chr (or NOT a type of chr)

in this case the sep is left blank, and valid types are

u - uppercase
l - lowercase
x - alphanumeric
e - alphanumeric plus dot
t - punctuation
s - space (space, tab, ff etc)
n - number
p - printable
c - control

    repeat:QR   XK,,3,U

To negate, use the '#' before the type

    repeat:QR   XK,,3,#X

Ie QR is the 3rd field in the K field of SH separated by a non-alphanumeric chr

Use this for FipHdr fields like :

    repeat:QR   RR,,5,S
    RR:a319 Boeing-747 TigerMoth MothsBros *&amp;^%$ BingBang

  • 3. There is actually a third type of REPEAT code for use with OPTION where it is possible to output all codes :

In IPEDSYS, the keyword 'before' adds a String at the top of the data file :

   before:<MODVER ID="1:00" VER="03">\n\ZU<DEST ID="1:05">\QU</DEST>\n\$O<FIFO ID="1:20"FFNO="25">\n

; add our option/repeat with a star ..
; if Fip Hdr field \ZU is specified,
; ..look for field \QU has a least 1 chr in it
; .. if there is, output to the \$O flag and then start again with a test for the next field
; .. if there is nothing, strip until the \$O.
option:ZU QU,1
; Hdr Field QU is really EACH sub-field of \NU separated by a comma.
repeat:QU NU+,+*

So if Fip Hdr field NU is :

NU:HOK,DDD,NNR,MSV,SMF,XXX

The top of the file will have :

<MODVER ID="1:00" VER="03"><BR>
<DEST ID="1:05">HOK</DEST><BR>
<DEST ID="1:05">DDD</DEST><BR>
<DEST ID="1:05">NNR</DEST><BR>
<DEST ID="1:05">MSV</DEST><BR>
<DEST ID="1:05">SMF</DEST><BR>
<DEST ID="1:05">XXX</DEST><BR>
<FIFO ID="1:20" FFNO="25"><BR>

... and the rest of the data


COMBINATIONS - combie - create a FipHdr field which is either the contents of another FipHdr field, or if that does not exist, the contents of a second, or if not there a default string :

combie:QZ   ep|na,(0000000)a

ie

  • Stuff QZ with the contents of the EP header field
  • if EP does not exist or has no data then there use the NA field
  • if NA does not exist or has no data then there use the fixed text '(0000000)a'.

combie in more detail

  Syntax  combie: [newfield]   [tab/space]
    [existing field1] [|] [existing field2]
    [opt comma] [opt default fixed text]

PIPE '|' is used for separating HdrFlds? while the first comma means that the rest of the data is fixed text to use as a default.

Note that if a FipHdr field is present BUT has no data, it is considered NOT present. eg

Hdr field BB 'BB:' will fail 'BB:1' will pass

OPTION - test for an existing FipHdr field in order to output some relevant FipSeq IF the condition is TRUE.

option:QT   ep,11,7,s

option in more detail (used in conjuction with the \$O flag):

ie If EP header field exists and has a space in the 7th position, send this text else strip text until the \$O flag.

  Syntax  option: [newfield]   [tab/space]
    [newfield] [?] [existing field] [comma] [size]
    [opt comma] [opt posn of test chr]
    [opt comma] [opt 'S' to output data otherwise nothing is output]
    [opt comma] [opt String to test for]

where size is minimum size of field.

Normally this is just a TEST - ie nothing is output - but the 'send' parameter can be used to output the contents from the position specified IF THERE.

Note that both size and test are counters from 1 not 0.

A single chr can be tested to be non-space as in the example above.

If either the size or the test is FALSE, all text and subsequent data whether fixed or variable (including more Optionals) is ignored until the EndOpt? flag is met - '\$O' (oh, not zero).

How is this used ?

    option:JN   SN,10


    before:StoryName is \SN \JN..and it is 10 or more chrs long at \$h:\$n \$Owhile the ..

If the SN field is less than 10 chrs in length - say SN:lily - the 'before' string will output :

StoryName is lily while the ..

ie JN fails so all (text, FipHdr, Sys Variables etc) is stripped to the \$O

However an

SN:bigbigbigbig
§ gives a 'before' string of :

Story Name is bigbigbigbig ..and it is 10 or more chrs long at 12:22 while the ..

Also see a more involved example at the end of the REPEAT section.

Taking four cases where an example field XB is :

  • 1. NOT present
  • 2. present with no data
  • 3. present with data
  • 4. present with data including a space at position 3

Specify

         (no XB) XB:   XB:111  XB:11 11
    option:QH XB      fail   fail   pass   pass 
    option:QH XB,1    fail   fail   pass   pass 
    option:QH XB,4    fail   fail   fail   pass 
    option:QH XB,1,1   fail   fail   pass   pass 
    option:QH XB,,1   fail   fail   pass   pass 
    option:QH XB,,3   fail   fail   fail   fail 
    option:QH XB,,4   fail   fail   fail   pass

In a further example we can test the content of a field

eg

option:QP   PR,,,,21

Here we do not care about size, position and output; only whether the field starts with the value '21'.

Case (lower or upper) is always ignored. To test fields with spaces, special chrs etc, put double quotes around.

eg

option:PF   XF,,,,\023\021
       option:PZ   XR,,,,"PASNAP \$d"

Note that the data is compared ONLY for the length of the string specifi ed in the 'option'. So if the FipHdr 'SS' contains "12345678"

    option:PS   SS,,,,1    - will be TRUE
    option:PS   SS,,,,12345678   - will be TRUE
    option:PS   SS,,,,123456789  - will be FALSE

So to test for an EXACT string, add a comma at the end of the field. (if you want a comma as part of the string, use FipSeq to encode it - \054 (octal)) If the string to test is NOT the first chr of the FipHdr field, put the stat posn in the 'test' field.

option:PS SS,,3,,34567

Test a string is NOT equal using the following syntax:

option:PS #SS,,,,12345

ie if SS is NOT 12345, PS will be valid


STYLE - create a new FipHdr field from an existing field and either truncate or pad left or right.

style:QH   XM,%.02s

style in more detail

- This uses the C 'printf' which is nasty but a standard (of sorts).

- On a Unix machine Do a "man printf" for fuller information if you need.

Note it ALWAYS starts with a '%'

If the expression does not end with an 's' ('d' for integer for example), then the string in the header field is first converted to that type.

Specify One and ONLY one expression (can not have %s%d%f) - as is takes the first only

Do NOT use for fixed data - use keyword 'fixed:' (as explained above)

Types are :

string s
char c
long d,i,o,p,u,x,X
float f,e,E,g,G
% print a % !
type n is ignored ??

Examples

to trim a string, use a dot %.5s
to pad a string with spaces %5s
to pad a string with spaces (left justified) : %-5s
to pad a number with leading zeros %.06d

REPLACE - copy an existing FipHdr fields and replace some of the strings.

replace:LC  XC   SPO=s INL=i UDL=u ECO=f

replace in more detail

Copy the contents of one FipHdr field into another and then search and

replace characters or strings.

Syntax

    replace:(New !FipHdr) (spc/tab) (Existing !FipHdr)
       [optional ,(ForceCase/IgnoreCase)]
       (spc/tab)   (Search String) (punctuation) (Replace)

eg

replace:LC   XC   SPO=s INL=i UDL=u ECO=f 

There can be up to 50 searches.

If the 'C' flag is NOT specified (to Ignorecase), the Search String MUST always be in the right case. So always

specify all combinations :

    SPO=s spo=s

The output can be forced upper or lowercase by specifying 'U' or 'L'

after the existing FipHdr field.

eg

replace:LC  XC,u  SPO=s INL=i UDL=u ECO=f

Strings with spaces and punctuation MUST be enclosed by double quotes.

eg

replace:K2  YR,u  ".Y"=yellow ".C"=cyan ".M"=magenta ".K"=black 

The replacement string may be in FipSeq - but NOT the search.

You must take care to only use small amounts of data - 1000 chrs max

plus Never call a FipHdr field from itself.


NEWDATE - create a new, temporary FipHdr field containing date and time fields

   newdate:JS   min-38 hour+8 day+\MD   "\ZD-\ZI-\ZZ"

newdate in more detail

Create a new internal FipHdr field with a date relative to when the program runs

Syntax :

newdate: (new !FipHdr field)   (differences) (style) 

where differences is a series of keywords and the varying amount the syntax for differences is

  • years + or - a number
  • months
  • days
  • hours
  • mins
  • secs

ie

hours+3
for plus 3 hours
days-7
for the same day a week ago

If you need to use a date which is relative to a date/time which is NOT the current date, put

'basedate=YYYYMMDDHHNNBB'

There are no spaces between the number and the hours etc.

Several differences can be specified, each spearated by a SPC or TAB.

The contents of ANOTHER fiphdr field may be used for the number :

hours+\JR

Only the first (or for 'm' first two) letters are considered.

The default is a PLUS sign meaning in the future.

ie

'h3'
is the same as
'hours+3'

The Style MUST be in double quotes and contain any FipSeq. Relevant header fields are

ZD 2 digit day of month (leading space)
ZG 2 digit day of month (leading zero)
ZM 2 digit month
ZY 2 digit Year 92
ZZ 4 digit Year 1992
ZW Day of week as in Monday, Tuesday etc
ZS 3 chr Day of week as in Mon, Tue etc
ZN Month as in January, February
ZT 3 chr Month as in Jan, Feb, Mar etc
ZJ Julian day of year
ZH Hour 00-23
ZI Hour 00-12
ZF Minute 00-59
ZE Second 00-59
ZU 1st, 2nd, 3rd, 24th for the day of the month
plus ZA, ZB, ZC for Week of year x2 and d.o.w. and ZP for AM/PM

Note that actual Day and Month names depend on your LOCALE

Default is

"\ZW, \ZD \ZN \ZZ"

Example

newdate:JS      min-38 hour+8 day+\MD
"xx\ZD-\ZS-\ZZ or \ZY \ZH:\ZTxx" 

Where MD is a FipHdr field in the incoming file.

Gives a result like

xx01-Sat-2000 or 00 00:17xx


UNIQUE - create a new FipHdr with the contents of another where the words are unique

and separated by a single space or other character. - Use this for controlling Metadata, routing codes and Stox tickers.

unique in more detail

Control the contents of a single FipHdr field so that :

  • each element is unique
  • each element is separated by one and only one separator chr
      unique:ZZ   F1,|
    
      unique:(new !FipHdr Fld) (space) (old !FipHdr Field)
        [(opt) (comma) (separator) ]
        [(opt) (comma) (force Upper or Lower case) ]
    
    The Separator defaults to a plus sign '+'. eg
    unique:Q1   XC,=
    So if XC (ie the C field of SH) was :
    SH:N1234:Sabc:Ccat1 cat1 cat3 cat2 cat3   cat4:P3
    Q1 now becomes
    Q1:cat1=cat2=cat3=cat4
  • The individual elements of are considered different if a space, plus '+' or comma ',' is found.
  • Multiple spaces etc are ignored. * If you want the Sep to be a comma, use another punctuation chr eg unique:Q1 XC+,


VALID - create a new FipHdr by checking the contents of another against a standing list of valid entries.

If there is no match, the first entry is used as the default.

valid in more detail - create a new FipHdr by checking the contents of another against a standing list of valid entries. If there is no match, the first entry is used as the default.

  valid:(new !FipHdr Fld) (space) (old !FipHdr Field)
    [(opt) (comma) (force Upper or Lower case) ]
    (list of values using one or more spaces or tabs as separator)
If any of the values contain a space or comma, it must be inside double quotes eg
valid:Q1   XP   4 1 2 3 5 

Create Q1 from XP which must be a value of 1 to 5 and defaults to 4

LOOKUP - create a new FipHdr by matching the contents of another against a standing lookup file.

lookup in more detail

Note this is for simple, small lookup files NOT massive tables of thousands of entries.

  • Use fipseq REPLACE for a small number of fixed entries - say up to 30.
  • Use fipSeq LOOKUP for between 30 and 100 entries (or if the file needs to be maintained externally). Use program IPLOOKUP for anything else.

lookup:(new !FipHdr Fld) (space) (old !FipHdr Field) file:(filename) [(opt) sep:(field separator in FipSeq) ]
???ult 1 for 1st)

value-field
(field number of the data or value field - starting at 1 - default 2 for 2nd)
default-value
(FipSeq - default - none)
separator
(Fipseq chr - default is '|')
type-format
(filetype - CSV, TAB-sep, Fixed width - default is blank for TEXT)
comment-line
(character which signifies a comment line - default is ';')
numeric-key
signifies the key is numeric.
sorted
yes/no is the file sorted ?
case-sensitive-key
yes/no ie Cardiff or cardiff allow-spaces: normally leading and trailing spaces in both the key and searched-for zone are removed before testing.

The old FipHdr field will have the key to search for.

eg

lookup:Y1 YP !file:Categories sep:| comment:# key:3 value:5

Create Y1 from the entry in file /fip/tables/setup/Categories which matches the contents of XP where the key is in field 3 and the value to use is in field 5.

If using Fixed width fields, the width of each field follows the 'F' in type-format. eg

lookup:Y2 SU !file:services key:1 value:4 type-format:F,6,6,2,2,3

Create Y2 from the entry in file /fip/tables/setup/services which matches the contents of SU where the key is in field 1 (which are characters 1 to 6) and the value to use is in field 4 (characters 15 and 16) .


PERL - create a new FipHdr from running a Perl Regular expression

  • Take care that the syntax is correct and does not have an infinite loop!

  • Take care to respect Perl quotes - especially for Winnt where for some bizarre reason we need two double quotes around it !

eg for Winnt

   perl:Z4 ""@hoho = 29 * \F4;""

Note that all '\' should be doubled as the RegExp? string is considered to be FipSeq, so other FipHdr fields may be included.

The RegExp? MUST be on a single line and you are advised to use a 'print' to display the result you want.

Any NewLines and/or Carriage Returns are mapped to Spaces.

  perl:(new !FipHdr Fld) (space) (Perl RegExp)
eg
perl:E1 $seqno = "\VD"; $bigSeq = 24*$seqno; print "Seqno is $bigSeq";
Create E1 with (if FipHdr VD:3) "Seqno is 72".


MERGE - create a new FipHdr by merging all the occurances of another FipHdr field

merge in more detail

- Create a new FipHdr from one or more occurances of another FipHdr field. Normally, if a FipHdr field is repeated, only the last FipHdr field is accessible, which allows you to overwrite entries quite happily.

But there are a few occasions where in fact you want the first, or second, or maybe all of them concatenated together, in one long string. This could be when you run 'ipxchg' against another formatted file which has duplicated entries for some fields.

  merge:(new FipHdr Fld) (space) (old FipHdr Fld)
   [(optional) , Separator]
   [(optional) , First-occurance]
   [(optional) , NumberOfTimes]

In the above syntax the comma may be replaced by any other punctuation except '$'. The Separator is to divide two or more fields and can be in FipSeq and can be a TAB (\t), SPC (\s) or any printable character. The First occurance is counted from the begining or top of the FipHdr. The NumberOfTimes? is the number of fields to take into account. eg if the FipHdr had :

   AB:blue
   AB:green
   AB:red


   merge:BC   AB,+
gives a new Fiphdr field of BC:blue+green+red



Notes on FipSeq generated header fields

  • Note these FipHdr fields are ONLY for use internally to that one program and are NOT added to the existing FipHdr.
  • They can be used in exactly the same way as any other FipHdr field.
  • If an existing FipHdr field has the same name as a newly created fixed/partial/repeat/option/style, the OLD is ignored and the NEWLY created one used.
  • So please make sure you do NOT use existing FipHdr field names with valid data in them as they will NOT be accessible. To be sure, use fields starting Qx, Nx, Jx where x is A-Z, 0-9


The new fields can be linked together up to 20 times or levels. Example of a snippet of parameter file for IPEDSYS to generate a consistent filename which can be sorted easily on the day of the year :

Lets have a FipHdr containing 3 normal FipHdr fields : SN for storyname, HS for History and SH for the Source Header

   SN:dpa6722
   HS:wire_9090_99-6-20_13:15:33_5_070
   SH::Sdpa:N6722:P1:CPIG:KPigs-In-Space

..and the relevant part of the IPEDSYS parameter file ..

   ; Create a new field called QJ using REPEAT
   ;   Get the Day of the year from the HS field (which is the 6th field)
   ; Create a new field called QR using COMBIE
   ;   this will be the same as QJ or 0 if either HS did not exist or there was no 6th field
   ; Create a new field called QE using STYLE
   ;   which will force it to 3 digits padded zero.
   ;
   ; Use QE to create a new filename for the output file which will be :
   ;   3 digit Julian data, Storyname, Category code (C field in SH) and Keyword (K in SH)
   repeat:QJ   HS,_,6
   combie:QR   QJ,0
   style:QE   QR,%.03d

   ; Filename
   name:\QE.\SN.\XC.\XK

For our example FipHdr, this would generate a filename of :

   070.dpa6722.PIG.Pigs-In-Space



Version Control
;034n   28feb03 buggette in Repeats - fipseq for sep not working ..
      as in repeat:QP   SP,\054,2
   ;a 04mar03 added ZD and ZG in newdate (leading spc/leading zero day-of-month)
   ;b 13mar03 buggette no2 in Repeats
   ;c 10apr03 buggette in newdate with 0 mins and secs
   ;d 23apr03 added fixed field lookup tables -plus bug in lookup
   ;e-f 17jun03 changed option - to make the test exact, use a trailing comma
   ;g 18sep03 bugette in WINNT perl bit
   ;h-i 05dec03 option now takes ANY chr not just > SPC and PARSE_FipHdrSize 1k->4k
   ;j-n 12mar04 more on check for max fiphdr size
;033z   31aug01 started UNIQUE
   ;a \$J does NOT add 1 now
   ;b 27sep01 small changes to Option-Repeats
   ;c/d/e 22nov01 allow another date on 'newdate' and UTF8/unicode
   ;f bug when UNIQUE and OPTION used together
   ;g bugette when FIXED with no data
   ;h/i/j 31mar02 added valid ad reverse for option/partial/repeat
      and added \$K for day of the week
   ;k/l/m 13apr02 added UTC date/time to newdate
      as in newdate:AB base=20020304T123456+0500
      or as a !FipHdr field   base=\ID
   ;n/o/p/q/r/s 04sep02 added LOOKUP and PERL and added case to REPLACE
   ;t 30sep02 added \$* for the RptValue
   ;u 08oct02 added MERGE
   ;v 31dec02 added allow-spaces: for LOOKUP
   ;w 01jan03 MACOSX
   ;x 03jan03 better perl support
   ;y 23jan03 added min/maxSeqno plus upped maximum words for unique to 300
   ;z 20feb03 bugette in newdate - base ignored if first parameter.
;032a   20jul00 added \$V for localSeqno
   ;a UNICODE \uXXXX not 100% reliable

© FingerPost Ltd. 2004 and years before


N otes and Examples

A simple example using lookup.

Although lookup can be used to lookup data in complex multi-field tables, it is generally used to look things up in simple two column tables - perhaps a two column pipe delimited file that looks like this basic file mapping section names between a Sunday and a Daily publication:

/fip/tables/setup/SECTIONS:

txm|Sunday
tgm|Daily
tpp|Sunday
tgs|Daily

In this case all we want to do is lookup the first three characters of a given filename and generate a new header field containing the string "Daily" or "Sunday".

The syntax to do this in a program like ipedsys or ipftp would therefore be ...

; Now - split the first three characters off the front of the name, and
; use them to lookup whether the file is Daily or Sunday ...
; uses lookup file /fip/tables/setup/SECTIONS
             
; make QN the first two characters of the filename
partial:QN      SN,,3
             
; lookup in our lovely lookup file
lookup:QL       QN      file:/fip/tables/setup/SECTIONS default-value:Daily
; you can then use QL inyour output - say in ipftp to change directory before delivering the file
; change directory first
ftpbeffile:cwd /guardian/\QL
 
 
Topic revision: r2 - 21 Jul 2008 - 00:07:11 - TWikiAdminUser
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback