ipadorachk
This program is used to lookup data from a database as part of the Fip CopyFlow
including :
- extracting ad information from an Adora database.
- matching Company information against a Ticker database.
-Option 1 get the 'highref' for EPSF files from 'material/matver'.
If the EPSF has a LowRes call embedded,
- we extract the high-res material code from the data
- grab the corresponding high-res id from Adora 'materialhigh'
- replace the lowres with by the relevant high-res (actually a PCI/OPI cal)
- Option 1 is the default.
-Option 2 find the 'material/matver for each 'pictref' in materialpict for
MediaPlanner.
-Option 3 find the 'pictref' for a ClassFolio from uap_pv_folios
Uses ClassFolio PC and PageNumber PN inbound and QC + QP internally
QC is PC (or half of PC for split pages)
QP is left/right/full for split pages
-Option 4 AFX symbology lookup
-Option 5 Generic database lookup for finding metadata etc
use sql-line to specify the sp or sql to run
use -1 or -i or -h to input fiphdr info
use -D to just display the data or -O for an output file
-Option 6 and 7 resolve opi calls to Adora
use sql-line to specify the sp or sql to run
use -1 or -i to input EPS file
use parameters eps-start and eps-end for the template start and ends
plus 'convert' for any file conversions to EPS
The difference between 6 and 7 is :
option 6 - input -1 is full path/filename
option 7 - input -1 is an OPI call
A parameter file for Sybasy sort of things is held in tables/setup and defaults
to ADORACHK.
Keywords for ADORACHK parameter file are :
; comment line
user: sybase user name
user:sa
passwd: Sybase passwd
passwd:sports
server: Sybase server name
server:JERRYSYB
database: Database name (Sybase, MSsql server and MYsql only)
database:mlt2
newname: Name of the output file
The default is the same as the input.
sql-line: actual sql to run.
For version 1, default is :
select highref from materialhigh where material = PM and matver = PV
For version 2, default is :
select material, "-", matver from materialpict where pictref = "PR"
For version 3, default is :
exec uap_get_folio "QC", "QP"
For versions 5 and 6 there is no default and this MUST be specified.
For Version 4
sql-line-1: first select
sql-line-2: second select if the first does not work
(ie sql-line-1 returns no rows)
exch-fiphdr: 2 letter FipHdr field containing the exchange
ie in the input FipHdr - default is J4
sym-fiphdr: 2 letter FipHdr field containing the symbol
ie in the input FipHdr - default is J2
v4-fiphdr-subject:
v4-fiphdr-industry:
v4-fiphdr-country:
2 letter FipHdr field for the output file for these.
For Version 5
run-all-sql-lines:yes/no default:no
if yes - run all the sql-line* that are not empty
if no - stop after the first line that does not error
Use this for MYSQL stored procedures eg:
run-all-sql-lines:yes
sql-line-1:call fip_chk_pnac ('TN', 'T7', 'HR', 'TZ', '$c', @hr, @acto)
sql-line-2:select 'Z6:', @hr, '#Z7:', @acto;
For Version 6 and 7
eps-start: (Filename)
eps-end: (Filename)
Templates for the standing postscript to start and end an Eps include
convert:(name) magic:(magic) script:(script)
See Below
convert-8bit-tiff:(script)
special case for 8 bit grey tiffs which need to be coloured scripts
convert-1bit-tiff:(script)
special case for one bit scripts
force-1bit-colour:0 1 0 0
cmyk values for 1 bit tiff conversion that needs to be a single spot
mangle-bitmap:yes
force image to imagemask for 1 bit TIFF conversions
reuse-converted-images:
do not convert an image which has already been converted
by a previous ipadorachk run.
Other keywords -
sep:
field-sep:
no-sep:
no-field-sep:
template-file:
any new data is slotted in as FipHdr field QI
eg cp /fip/fix/NULL /fip/spool/2go/QI
extra-fiphdr: (FipSeq)
extra-fiphdr-after: (FipSeq)
Add more FipHdr information either before and/or after processing
log: (FipSeq)
V5 - replacement log line if the log input switch is ON '-L'
Note that FipHdr fields ER and EM hold the result and any message
<hr>
Input Parameters are :
Mandatory :
either
-1 : filename and path of a single file default: none
If this does NOT start with a '/', it is assumed under the current path.
or
-i : input queue to scroll default: none
If this does NOT start with a '/', it is assumed under spool.
or
-f : FipHdr fields default: none
eg -h"#J4:NYSE#J2:FIP"
or remembering to escape the Hashes in a perl script
-h"#J4:NYSE#J2:FIP"
Optional :
-V : version or option number default: 1
Can be 1 - 7
-d : done queue for a copy of the raw input default: file is deleted
If this does NOT start with a '/', it is assumed under spool.
-o : output or done queue default: file is deleted
If this does NOT start with a '/', it is assumed under spool.
-O : output filename default: same as input name if needed
this is the same as the 'newname' parameter
-z : parameter file in tables/setup default: tables/stats/ADORACHK
-X : always replace/supercede an existing file default: preserve
of the same output name.
-w : file wait for files arriving across a network. def: 0 secs
-l : do NOT log files in default: log
-L : detail log default: log
-h : extra FipHdr string to use default: none
this is the same as the 'fiphdr' parameter
-H : no FipHdr on the output pls default: copy FipHdr
-D : display data to stdout and do NOT add to a file default: only put in a
file
-v : print version number and exit
<hr>
Notes - Converting NON-eps files to PostScript (v6)
----------------------------------------------
The Magic number of each data file (the first 4 bytes) is checked. All
PostScript and PostScript with Binary Header files are left 'as is' and the
filename noted. All other types are compared against our table of images
defined with the 'convert' parameter.
If the image is on that list and there is a conversion script to convert it to
EPS then that is run and the EPS file dropped into the 'raw file path' -
usually spool/epsf.
The syntax of the 'convert' keyword is
convert: (name) magic:(1st 4 chrs of file) script: (script to run to
convert)
- Use double quotes to keep the spaces
- The script MUST generate a file in spool/epsf with the same filename as the
input with an Extra extension of '.eps'.
examples of using Image Alchemy to convert TIFF files :
convert:tiffII magic:"II*00" script:"/usr/forum/bin/alchemy QI/QF QO/QN
-Q -o -e 1400 --."
convert:tiffMM magic:"MM00*" script:"/usr/forum/bin/alchemy QI/QF QO/QN
-Q -o -e 1400 --."
There is also a special case for converting 1bit tiffs
convert-1bit-tiff:"/usr/forum/bin/alchemy QI/QF QO/QN -Q -o -e 2000 --."
;There is also a special case for converting 1bit tiffs using PP-Pub and
Colour..
convert-8bit-tiff:"/usr/bin/perl /fip/local/convert8bittiffs.pl pub=PP
colour='C0' tint=T0 in=QI/QF out=QO/QN"
- Note that even more FipHdr fields are available ONLY for the script :
QI - Path/queue/folder where the Input file resides
QF - name of the input file to be converted (no folder/path info)
QO - Path/queue/folder for the Output,converted files
this is /fip/spool/epsf unless overridden
QN - name of the output filename
this will be a made up TMP name ending with a '.eps' extension
Version 6 and 7 FipHdr fields
-----------------------------
% PDF-OPI-START version 2b 21feb2005
% Level FL
% Original FO
% Hires File FN
% Material FM
% Version FV
% BB B1 B2 B3 B4
% Size D1 D2 (D8 D9)
% Scale S1 S2
% Position P1 P2 | P3 P4 | P5 P6 | P7 P8
% Crop/Mask C1 C2 C3 C4
% Tiff Reso T1 T2
% Move M1 M2
% Rotate R1
% Colour C0
% Tint T0
Version Control
;003q4 09mar05 bugettes/tweaks for v6/7
added ALDImageColor/ALDImageType/ALDImageColorType
;c 29mar05 color zap for bitmaps only
;d 23apr05 bugette with 90% rotates
;e 14may05 bugettes in filesize when converted file is > 64k and orig < 64k
;f 17may05 added 'mangle-bitmap:yes' as option and turned OFF imagemask
conversion
fr use with CMYK rather than RGB
;g-h xxmay05 script for 1bittiff and tweak for yMove/Tiff for rounding errors
;i 09aug05 added force-1bit-colour:
;j 12oct05 added %ALDImageTint: .1 -> Tint T0 and affects Colour C0 too
;k 03nov05 added reuse-converted-images
;l 04dec05 added different processes for 8bit grey tiffs which need to be
coloured.
;m 09jan05 tiffs with tints generate another eps
;o 21sep06 odbc version
;p5 26oct07 tuned version 5 - generic (added other sql-lines) ;3 tuning ODBC
version
;q4 28aug08 added run-all-lines: ;2 error in V4 afxcodes ;3 added log: ;4
WINNTmysql
;002z 27may03 added mysql bits and version 4 ;b 2hits at db
;c 23jul03 added leftpage/rightpage to V3 for LH
;d-h 25jul03 better V4 for MLT
;i-j 24sep04 speedy
;k-o 19nov04 added -f, -D, -V 5 and -V 6
;p-y 14dec04 added -V 7 same as V6 but resolve the first
u-w 4decpts and better crop Dims)
;z 09feb05 redid scaling/moves for Tiffconversions != 72dpi
;001b 10aug00 added -V 2 - todo 'dcs' and flog ?
;a 14sep00 materialPICT not materialHIGH for V2
;b 10may01 added V3
(copyright) 2014 and previous years FingerPost Ltd.