home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / TEXT / UTILITY / CTRANS15.ZIP / C-TRANS.DOC < prev    next >
Encoding:
Text File  |  1992-04-11  |  14.4 KB  |  415 lines

  1.  
  2.  
  3.                               C-TRANS
  4.                               ═══════
  5.  
  6.  
  7.                Fast, flexible Character Set Translator
  8.  
  9.        (c) Copyright 1990,91 by Klaus Hartnegg, D-7835 Teningen
  10.  
  11.  
  12.  
  13.  
  14. Description
  15. ───────────
  16. C-Trans is a fast, flexible translator between any two character sets.
  17. It can act either on disk files or as filter for pipes.
  18.  
  19. Translation tables for Ascii <--> Ebcdic translation are built in.
  20. You can easily create your own translation tables or modify existing
  21. ones.
  22.  
  23.  
  24.  
  25. Usage
  26. ─────
  27. Syntax :  C-TRANS /options [infile [outfile]]
  28.  
  29. Options: You can place options on the command line wherever you want.
  30.  
  31.    E2A          convert from EBCDIC to ASCII
  32.  
  33.    A2E          convert from ASCII to EBCDIC
  34.  
  35.    F <filename> read conversion table from file. For a description
  36.                 of the syntax for this file read the section
  37.                 "Translation Tables" below.
  38.  
  39.    I            invert translation table, i.e. do the reverse
  40.                 translation.
  41.  
  42.  
  43. Infile and outfile are the names of an input and output-file. When
  44. outfile is omitted, a temporary file will be used and be moved over
  45. infile after the conversion has ended successfully.
  46.  
  47. Infile and outfile may contain wildcard characters "?" and "*".
  48.  
  49. Infile may be a directory instead a file. In this case all files
  50. within this directory will be converted.
  51.  
  52. Outfile may be a directory too. In this case the name for the output
  53. file(s) will be derived from the input file(s).
  54.  
  55. When both infile and outfile are directories all files from
  56. the input directory will be converted and the results be written
  57. to the output directory.
  58.  
  59.  
  60. You can also use C-TRANS as a unix-like filter i.e. it can read data 
  61. from the standard input and write the translated data to standard 
  62. output. C-TRANS will assume being used as filter whenever the standard 
  63. input is being redirected. Please read your DOS manual to learn more 
  64. about pipes and how redirecting standard input and output.
  65.  
  66.  
  67.  
  68. Examples:
  69.  
  70. - convert the file "ANY.TXT" from EBCDIC to ASCII
  71.   C-TRANS /e2a ANY.TXT
  72.  
  73. - convert "EBCDIC.TXT" to "ASCII.TXT"
  74.   C-TRANS /e2a EBCDIC.TXT ASCII.TXT
  75.  
  76. - convert all files in the directory "D:\TEXTS\EBCDIC" from EBCDIC to ASCII
  77.   C-TRANS /e2a D:\TEXTS\EBCDIC
  78.  
  79. - the same again but leave files in D:\TEXTS\EBCDIC alone and
  80.   write output to D:\TEXTS\ASCII
  81.   C-TRANS /e2a D:\TEXTS\EBCDIC D:\TEXTS\ASCII
  82.  
  83.  
  84. use C-TRANS as unix-like filter:
  85.  
  86. - show EBCDIC.TXT on screen using MORE:
  87.   TYPE EBCDIC.TXT | C-TRANS /e2a | MORE
  88.  
  89. - as above but add missing line feeds (will need separate program CrLf!)
  90.   TYPE EBCDIC.TXT | C-TRANS /e2a | CRLF | MORE
  91.  
  92.  
  93.  
  94. Batch files
  95. ───────────
  96. To create batch files E2A and A2E for conversion from ebcdic to
  97. ascii and vice versa, just issue these two DOS commands:
  98.     echo c-trans %1 %2 /e2a >e2a.bat
  99.     echo c-trans %1 %2 /a2e >a2e.bat
  100.  
  101. Note however that DOS does not allow to use batch files as filters.
  102. If you want to pipe a file through such a batch file, you have
  103. to use this construction:  type test.txt | command /c e2a
  104. instead of                 type test.txt | e2a
  105. of course you can also use type test.txt | c-trans /e2a
  106.  
  107. This is a restriction of DOS, not one of c-trans.
  108.  
  109.  
  110. Default Options
  111. ───────────────
  112. If C-TRANS finds a file "C-TRANS.OPT" it will accept the content of it's
  113. first line as default options. Options that you include on the command 
  114. line will be appended to these default options. The options A, E, and I 
  115. work as toggle-switches, i.e. you can include an option already present 
  116. as default option on the command line again to reset it.
  117.  
  118. C-TRANS.OPT will first be searched in the current directory and then in
  119. the same directory where C-TRANS.EXE resides in.
  120.  
  121.  
  122.  
  123. A note for Unix users
  124. ─────────────────────
  125. This program will usually accept both
  126. a) '/' and '-' as switch character (to start an option)
  127. b) '\' and '/' as path separator
  128. But: you can not start a filename with '/'.
  129.  
  130. However if you have your switch character variable set to a different 
  131. value than the default (the default is '/', changing it is not possible
  132. any more with Dos 5) then
  133. a) your value OR '-' can be used as switch character
  134.    (or only '-' if this is your value)
  135. b) filenames are allowed to start with '/'
  136.  
  137.  
  138.  
  139. Technical notes:
  140. ────────────────
  141. When codes are encountered that C-TRANS can not translate, their position
  142. and the unknown code will be shown. When there are more than 10 errors 
  143. in a file C-TRANS will switch to batch-mode and show no more errors. In
  144. this case the total number of errors will be displayed at the end of the 
  145. conversion.
  146.  
  147. C-TRANS will conserve the file date when it is not used as filter.
  148.  
  149. Execution speed is about 6 kByte per second on a 12 MHz AT but will 
  150. decrease dramatically if there are less than 100 kByte RAM available.
  151.  
  152. Please note that in many EBCDIC-coded texts, lines are terminated with
  153. carriage return only but no line feed or vice versa. You can use my
  154. program CRLF after converting to ASCII to correct this. For the same
  155. reason you may want to use STRIPCrLf to remove all carriage returns
  156. or line feeds before converting to EBCDIC. Both programs are included
  157. in my software package CRLF. If you need them try looking at the same
  158. source from where you got C-TRANS.
  159.  
  160. If you can't find CRLF there look in SIMTEL or just register C-TRANS,
  161. you will automatically get unregistered versions of other programs,
  162. that I am distributing as shareware, including (of course c-trans).
  163. See the file HARTNEGG.LST for a list of all programs.
  164.  
  165.  
  166. Using your own Translation Tables
  167. ─────────────────────────────────
  168. You can use C-TRANS to do any translation that you want by supplying your
  169. own translation table. You only have to do two things:
  170. 1. Use a text editor to create a text file that contains 256 numbers in
  171.    the range -1..255 separated by blanks and/or line breaks.
  172. 2. then tell E2A to use this file as translation table with the /F-option
  173.    described above by supplying the name of this file
  174.  
  175. C-TRANS interprets the numbers in this file in the following way:
  176. the numbers themselves are the codes that shall be generated and their
  177. position in the file determine which characters will be translated to this
  178. code. Example: the very first number in that file is the code to that all
  179. input characters with code 0 will be translated. The second number is the
  180. code to that all input characters with code 1 will be translated and so on.
  181.  
  182. When C-TRANS finds a -1 in this file, it reports to have found a character
  183. that it can't translate whenever the corresponding code is encountered
  184. in the input.
  185.  
  186. I have included six examples that you may simply use as your translation
  187. tables or you may use one of them to start with when building your own table:
  188.  
  189. ASCII.DAT   This file contains IBM's official translation table (*) from
  190.             EBCDIC to ANSI X3.4-1977 ( = 7 bit ASCII). I found it in
  191.             the appendix of a fortran reference book describing IBM'S
  192.             Fortran for VM/CMS operating system.
  193.  
  194. ISO.DAT     contains IBM's official translation table (**) from EBCDIC
  195.             to ISO 2022, found in the same book.
  196.  
  197. 3090.DAT    This one contains the EBCDIC to ASCII translation table of an
  198.             IBM 3090 running VM/CMS that I am working on at the university.
  199.             Sorry, I have no idea why IBM's computers use a different
  200.             translation than listed in their own tables.
  201.  
  202. 3270.DAT    This is even one more EBCDIC to ASCII translation table. It is
  203.             taken from a 3270-Terminal description; also directly from IBM.
  204.  
  205. E2A.DAT     This is a mixture of 3090.DAT and 3270.DAT which is
  206.             possibly the best choice for an EBCDIC to ASCII translation
  207.             but not very useful when reverted.
  208.  
  209. DEFAULT.DAT this contains the default translation table of E2A. It
  210.             differs from ASCII.DAT for 7 characters taken from 3090.DAT,
  211.             see below (***). I didn't use E2A.DAT as default because that
  212.             seems to be not so good for ASCII to EBCDIC translation.
  213.  
  214.  
  215. (*) well, not exactly. I have corrected some obvious errors:
  216.  
  217.        ┌─────────────────────────────────── EBCDIC-code
  218.        │        ┌────────────────────────── IBM's official description
  219.        │        │               ┌────────── IBM's official table
  220.        │        │               │      ┌─── my change
  221.        │        │               │      │
  222.  
  223.        77  left parenthesis    43 +  ┐ 40 (
  224.        78  plus sign           33 ! ┐└ 43 +
  225.        79  logical or          -    └  33 !
  226.        90  Exclamation point   93 ]    33 !
  227.  
  228.  
  229. (**) I have again corrected an obvious error:
  230.  
  231.        90  Exclamation point   93 ]    33 !
  232.  
  233.  
  234. (***) the differences between ASCII.DAT and DEFAULT.DAT are:
  235.  
  236.        13  Carriage return     13 CR   -1     ─┐ I have no idea why the 3090
  237.        21  new line ack.       -1      13 CR  ─┘ uses these two reversed
  238.        74  Cent sign           91 [   155 ¢
  239.        79  logical OR          33 !   124 |
  240.       106  vertical line      124 |   179 │
  241.       173                      -1      91 [
  242.       189                      -1      93 ]
  243.  
  244.  
  245.  
  246. In spite I had some official documents directly from IBM I was not
  247. able to find the ultimate translation tables. I guess such a thing
  248. does not exist since every Ebcdic implementation seems to be a bit
  249. different. Finally I found the table now included in DEFAULT.DAT, that
  250. seems to be the best compromise. It allows to convert in both
  251. directions when working with the IBM 3090 running VM/CMS that we have
  252. at the university. I'm not sure whether that table will work fine on
  253. all IBM's.
  254.  
  255. When someone can find better translation tables - please tell me!
  256.  
  257.  
  258.  
  259. Known Bugs:
  260. ───────────
  261. Please avoid translating a file to itself. The contents of that
  262. file can get lost.
  263.  
  264.  
  265. Revision history
  266. ────────────────
  267. 1.0,  July 1990
  268. program started as a slow, unflexible Ebcdic to Ascii convertor
  269.  
  270. 1.1,  August 1990
  271. - command line options
  272. - reverse translation
  273. - user definable translation table
  274. - default options in disk file
  275.  
  276. 1.2, September 1990
  277. - error messages were written to the output file rather than to the
  278.   screen when output was redirected
  279. - included 3270.DAT
  280. - included E2A.DAT
  281. - key-file support for easier registration
  282.  
  283. 1.3, October 1990
  284. - changed translation table DEFAULT.DAT. Now ASCII to EBCDIC works better
  285. - added - and / support for unix users
  286.  
  287. 1.4, November 1990
  288. - some more errors in the file search routine
  289. - wildcards now allowed on unregistered copies too
  290. - 5 second registration reminder
  291. - visual byte counter during the translation
  292.  
  293. 1.41, 10-Feb-1991
  294. - circumventing error of DR-DOS with directory detection
  295.  
  296. 1.42, 16-Feb-1991
  297. - the previous version didn't work on XT's
  298.  
  299. 1.5, 01-Aug-1991
  300. - some minor error corrections
  301. - speed increased by 15%
  302. - uses unique filename now for temporary file
  303. - renamed from E2A to C-TRANS
  304.   (registered users of E2A can request new key-files for free)
  305.  
  306. 1.5a, 10-Apr-1992
  307. minor changes only, cleaned up a little bit
  308.  
  309.  
  310. future plans:
  311. ─────────────
  312. - enhanced error detection
  313. - enhanced wildcard-handling
  314.   (allow things like "*DAT.TXT" and "F*1.DAT")
  315. - option to exclude some files from the conversion process
  316.  
  317. You can encourage me to spend much more time into the further
  318. development of this program by paying the registration fee!
  319.  
  320.  
  321.  
  322. Included files
  323. ──────────────
  324. C-TRANS .EXE  the executable
  325. C-TRANS .DOC  this documentation
  326.  
  327. ASCII   .DAT ┐
  328. ISO     .DAT │
  329. DEFAULT .DAT │ sample translation tables
  330. 3090    .DAT │
  331. 3270    .DAT │
  332. E2A     .DAT ┘
  333.  
  334. ORDER   .FRM   order form
  335. HARTNEGG.LST   list of all my shareware programs
  336.  
  337.  
  338.  
  339. Disclaimer
  340. ──────────
  341. It is a well known fact that it is impossible to proof that any given 
  342. (non trivial) program is error free. Of course this software has been 
  343. tested extensively but is is nevertheless not possible to guarantee that 
  344. it will work correctly in all possible situations.
  345.  
  346. This software is provided as-is, without warranty of any kind. The 
  347. author shall not be liable to the user for any direct, indirect or 
  348. consequential loss arising from the use of or inability to use this 
  349. software.
  350.  
  351.  
  352.  
  353. License
  354. ───────
  355. This is a shareware product and thus not free. It is fully protected by 
  356. international copyright laws.
  357.  
  358. Shareware is distributed through public access channels so that you can 
  359. evaluate it before deciding wether or not to buy it. If you decide to 
  360. use this software then you are both under legal and moral obligations to 
  361. register it (see separate file ORDER.FRM for a registration form; Visa
  362. and Master Card accepted!). If you decide not to use it you are under no 
  363. obligation, just don't use it any more.
  364.  
  365. All corporate, business, government or other entities have to register
  366. BEFORE using this software.
  367.  
  368. You are free to copy and distribute this software as long as all files
  369. belonging to it are distributed together and are not modified in any 
  370. way. If possible please distribute the original ZIP archive.
  371.  
  372. You must NOT give the key-file away (see below). This file is proof of 
  373. your registration and contains your name and serial number.
  374.  
  375.  
  376.  
  377. Registering
  378. ───────────
  379. Upon payment of the registration fee you will receive a diskette with 
  380. - the current versions of ALL programs that I distribute as shareware
  381. - the key-file(s) for the program(s) that you registered
  382.   (if any of my programs finds its corresponding key-file it will not 
  383.   display the annoying shareware reminder any more)
  384.  
  385. FREE UPDATE to ALL future versions: the key-files will not only work for
  386. the present, but also for all future versions of the same program, i.e. 
  387. you have to register only once!
  388.  
  389.  
  390. The shareware system and the continued availability of quality shareware
  391. products depend on YOUR willingness to register and pay for the software
  392. that you use. It's the registration fees YOU pay which allows to support
  393. and continue to develop such products! Without this support I can not 
  394. continue spending so much time in improving this program.
  395.  
  396. Show your support for shareware by registering those programs you 
  397. actually use. Shareware is kept alive by YOUR support!
  398.  
  399.  
  400. ────────────────────────────
  401.  
  402.    Klaus Hartnegg
  403.    Kleist-str. 7
  404.    D-7835 Teningen
  405.    Germany
  406.  
  407.  
  408. This software is under development. Error reports and other comments are
  409. welcome. Please do not hesitate to use electronic mail for communication.
  410. (these addresses may be valid only until end of 1992)
  411.  
  412. Bitnet   : hartnegg@dfrruf1
  413. Internet : hartnegg@ibm.ruf.uni-freiburg.de
  414.  
  415.