(Appendix) Misceraneous Utility Program

Japanese
cats jis/jisx cview igrfcal cxiken
cat4 rmcr cviewe utmcal cxenik
cat8 addcr uncview xycal job/job1
euc crlf hdumpe cxtw84   Job Control
sj onlycr prtps cxw84t   Use with opnpin()
                                                                       
ProgramFunction
cats Read specified file (or STDIN file if omitted), and write it to STDERR output without any conversion.
cat4 Read specified file (or STDIN file if omitted), and write it to STDOUT output with the conversion of TAB (HT) code into 1-4 space(s) to match 4-cols TAB stop.
cat8 Read specified file (or STDIN file if omitted), and write it to STDOUT output with the conversion of TAB (HT) code into 1-8 space(s) to match 8-cols TAB stop.
euc Read specified file (or STDIN file if omitted), and write it to STDOUT output with the code conversion into EUC. Input file must be in Shift-JIS or JIS7 code. Also CR (0x0d) is removed if followed by LF (0x0a).
sj Read specified file (or STDIN file if omitted), and write it to STDOUT output with the code conversion into Shift-JIS. Input file must be in EUC or JIS7 code. Before LF (0x0a) not preceded by CR, CR (0x0d) is inserted.
jis Read specified file (or STDIN file if omitted), and write it to STDOUT output with the code conversion into JIS7. Input file must be in Shift-JIS code.
jisx Read specified file (or STDIN file if omitted), and write it to STDOUT output with the code conversion into JIS7. Input file must be in EUC code.
rmcr Read specified file (or STDIN file if omitted), and write it to STDOUT output, with removing CR (0x0d) followed by LF (0x0a).
addcr Read specified file (or STDIN file if omitted), and write it to STDOUT output, with inserting CR (0x0d) before LF (0x0a) not preceded by CR (0x0d).
crlf Read specified file (or STDIN file if omitted), and write it to STDOUT output, with inserting CR (0x0d) before LF (0x0a) not preceded by CR (0x0d), and inserting LF (0x0a) after CR (0x0d) not followed by LF (0x0a). ( [LF CR] will be converted into [CR LF CR LF].)
onlycr Read specified file (or STDIN file if omitted), and write it to STDOUT output, with removing LF (0x0a) preceded by CR (0x0d), and converting other LF (0x0a) into CR (0x0d). (Both [LF CR] and [LF LF] will be converted into [CR CR].)
cview
cviewe
Read specified file (or STDIN file if omitted), and write it to STDOUT output with the 'visualize' conversion of control codes, as follows:
    0x00-0x1f ==> 0x40-0x5f preceded by ^ ,
    0x80-0x9e ==> 0x60-0x7e preceded by ^ ,
    0xa1-0xfe ==> 0x21-0x7e preceded by ! ,
    0x7f ==> ^? , 0x9f ==> ^# , 0xa0 ==> ^$ , 0xff ==> ^/ ,
    ^ (0x5e) ==> \^ , ! (0x21) ==> \! , \ (0x5c) ==> \\
uncview Read specified file (or STDIN file if omitted), and write it to STDOUT output with the inverse conversion of 'cview'.
hdumpe Read specified file (or STDIN file if omitted), and write it to STDOUT output with the hexadecimal dump.
prtps Read specified file, and generate PostScript print file.
    prtps [-options] [infile [outfile]]
If outfile is omitted, output to STDOUT, and if infile is also omitted, read from STDIN. As options, line spacing, page-numbering, TAB spacing, bold face, etc. can be specified.
igrfcal Calculate IGRF model components.
First select IGRF model and time epoch, then 5 components (F, H, Z, I, D) are calculated each time Latitude, Longitude and Altitude are given.
utmcal Calculate UTM coordinates.
First select ellipsoid and central meridian, then Universal Transverse Mercator X and Y coordinates are calculated each time Latitude and Longitude are given.
xycal Calculate JTM coordinates.
First select ellipsoid and coordinate number, then Japanese Transverse Mercator X and Y coordinates are calculated each time Latitude and Longitude are given.
cxtw84 Calculate WGS-84 coordinates.
WGS-84 Latitude/Longitude/Altitude are calculated each time Latitude, Longitude and Altitude on Old-TOKYO coordinates are given.
cxw84t Calculate Old-TOKYO coordinates.
Latitude, Longitude and Altitude on Old-TOKYO coordinates are calculated each time WGS-84 Latitude/Longitude/Altitude are given.
cxiken Calculate Map Projection coordinates.
First select ellipsoid and coordinate number, then Map Projection (X, Y) coordinates are calculated each time Latitude and Longitude are given.
cxenik Calculate Lat. and Long. by inverse Map Projection
First select ellipsoid and coordinate number, then Latitude and Longitude are calculated each time plane rectangular coordinates are given.
job A series of Job steps are executed according to the Control file.
    [Usage]:  job (Control-filename):(Tag-name)
Job starts from the step with the tag ":(Tag-name)" in the Control file (See bellow). If ":(Tag-name)" is omitted, Job starts from the beginning. But if only "(Tag-name)" is omitted, the tag ":" is assumed.
job1 One Job step is executed according to the Control file.
    [Usage]:  job1 (Control-filename):(Tag-name)
Executes only one Job step with the tag ":(Tag-name)" in the Control file (See bellow). The omission rule of Tag-name is same as for 'job'.

Job Control File Format (Example)   ("job.cntl")

    .                   ;# ":(Tag-name)" line specifies the command, and the
    .                   ;# following lines with no ":" on the 1st column are
    .                   ;# piped to STDIN as an input data.
    .                   ;# ";#" and rearward is neglected as a comment.
    .                   ;# Data lines before the 1st command have no effect.
:st1 cat - > temp.data  ;# Job step. Following 3 lines are input data.
  Here is data lines.
  2nd line data
  Last data
:step2                  ;# If no command, no operation is caused.
  abc 123               ;# Data for No operation step have no effect.
:job3   prog            ;# Job step executing 'prog' with no data.
:   calc                ;# Job step executing 'calc' with 4 line data.
     1
    22
   333
  4444
:end                    ;# (explicit expression of data end, may be omitted.)

          The command string is in the form of "(prog) [parm]" (redirection
        may be specified).  If the mechanism of 'opnpin()' is utilized, 'parm'
        indicates the Input-filename[:Tag-name] to read parameters.  Then, if
        single minus sign "-" is given as parm, parameters are read from STDIN,
        which is equivalent to omitting 'parm'.  (However, if "-" is used as
        1st argument, further argument(s) may be used.  'opnpin()' always
        interprets the 1st argument specifies the parameter Input-file.)

Example of using 'opnpin()' mechanism   ("sample.cntl")

:start                  ;# If no command, no operation is caused.
  data 123              ;# Data for No operation step have no effect.
##############################
:step1  despike         ;# Job step. Following lines are input data.
 /home/nktk/data/shitara            ;#  ";#" and rearward is neglected during
#                                        parameter input.  Lines starting with
#                                        "#" are also neglected as comments.
 shitara.log                        ;# If opnpin() input and standard input are
 shitara.amp                        ;#  mixed, both data should be mixed up and
 shitara.ampd                       ;#  arranged in the actual order to be
#                                       read-in by the program.
##############################
:surv     xldpn   parm.data:xldn1   ;# Job step.
#               Parameter data is read-in from another file 'parm.data'.
#               As the standard input STDIN does not care of "#" heading,
#               here is 4 data lines if the program 'xldpn' read STDIN data.
##############################
:chkmag1   pchkmag  -               ;# Job step.
#               "-" indicates that the parameters for 'opnpin()' mechanism is
#               read from the following data lines.  During its parameter
#               input, ";#" and rearward in each line and lines starting with
#               "#" are neglected as comments.
 /home/nktk/data/shitara            ;# working dir.
 shitara.log                        ;# log file (blank for NoLogging)
 shitara.ampd                       ;# input filename
 pchkmagd.ps                        ;# output PS filename
##############################
:data4                  ;# No operation step. (Defines data for "chkmag2" step)
 /home/nktk/data/shitara      ;# Data for No operation step have no effect.
 shitara.log                  ;#  Taking advantage of it, parameter data (file
 shitara.ampd                 ;#  input) for another step can be described in
 pchkmagd.ps                  ;#  the same file.
##############################
:chkmag2   pchkmag  sample.cntl:data4     ;# Job step.
#                 Standard input STDIN data can be described here.
#                 'opnpin()' parameter input filename "sample.cntl" is this
#                 file itself, and the data lines following the ":data4" tag
#                 are read for parameter input.
##############################
:end                    ;# (explicit expression of data end, may be omitted.)

Example of parameter data file   ("parm.data")

:chkmag1                      ;# ineffective for "parm.data:xldn1" parameter
#                                 ";#" and rearward in each line is neglected
#                                 during parameter input.  Lines starting with
#                                 "#" are also neglected as comments.
#                                 Any command string may exist on the Tag line,
#                                 with no effect.
 /home/nktk/data/shitara            ;# working dir.
 shitara.log                        ;# log file (blank for NoLogging)
 shitara.ampd                       ;# input filename
 pchkmagd.ps                        ;# output PS filename
##############################
:xldn1              ;# parameter data for the "surv" step above ("sample.cntl")
 /home/nktk/data/shitara            ;# working dir.
 shitara.log                        ;# log file
 lines.inf                          ;# lines.inf filename
 shitara.amp                        ;# output filename
 2003.1                             ;# Year of survey
 9                                  ;# IGRF generation
##############################
:end

How to execute as a BATCH JOB

After making Job Control File "job.cntl" (and parameter files
if necessary) as above, the command
     % job job.cntl
causes the execution on the foreground.
If background execution is desired, use 'at' command.
     % echo job job.cntl | at now
The completion of the background Job will be notified by E-mail.