PageRenderTime 105ms CodeModel.GetById 6ms RepoModel.GetById 1ms app.codeStats 0ms

/ebcdic-t.txt

https://bitbucket.org/chriz/z_vedit
Plain Text | 1700 lines | 1278 code | 422 blank | 0 comment | 0 complexity | dca44a05cdc47e2f41e3e69e943ca024 MD5 | raw file
  1. Documentation for the EBCDIC Conversion Package (Trial Level 2)
  2. ---------------------------------------------------------------
  3. Written by: Ted Green and Thomas C. Burt
  4. Last change: 10/16/2003
  5. Introduction
  6. ------------
  7. The VEDIT Level-2 EBCDIC package converts EBCDIC files into ASCII with any
  8. number of packed-decimal, binary, zoned, text and "ignore" fields.
  9. The converted ASCII records can optionally have newline characters, e.g.
  10. Carriage-Return and Line-Feed, appended to the end of each converted record.
  11. They can also be output in DBASE format, with the DBASE header record being
  12. automatically generated.
  13. Other output options include quoting-and-comma delimiting each field or
  14. appending a user specified delimiter string after each field; converting an
  15. all-blank or null numeric field to zeros; and emitting an explicit decimal
  16. point.
  17. For EBCDIC to ASCII conversions, the converted file is normally saved as
  18. "filename.ASC"; for DBASE output, the default extension is ".DBF". Or, the
  19. user may explicitly give the output filename. In no case is the source data
  20. file altered.
  21. Any conversion errors can optionally be reported in the file "ebcdic.err".
  22. This file is initially deleted; therefore, a batch file can test for its
  23. existence to determine whether there were any errors.
  24. The conversion is completely controlled by a ".LAY" data layout file which
  25. the user must create once for each type of file to be converted. This layout
  26. file primarily lists the beginning and ending columns for each field and the
  27. data type of the field. It also specifies the record length and specifies
  28. whether newline characters are to be appended to the end of each converted
  29. record.
  30. As described below, a COBOL "copy-book" can often be automatically converted
  31. into a .LAY data layout file. Therefore, we highly recommend that you
  32. procure the "copy-book" for your data file(s).
  33. Once the .LAY data layout file has been created, the conversion macro can
  34. be manually run from within VEDIT, or automatically run from either a
  35. Window's icon or a DOS or NT command line. The macro runs without any user
  36. interaction and, when done, saves the converted file and displays it on the
  37. screen. Optionally, the macro can automatically exit, in which case the
  38. conversion requires no user interaction whatsoever.
  39. To convert many files, EBCDIC-T.VDM can be used with the menu function {MISC,
  40. WILDFILE macro} to automatically convert entire groups of files, e.g. all
  41. files in a directory.
  42. The speed of the conversion depends both on the size of the file and the
  43. number of packed fields per record. The conversion speed is typically 10
  44. megabytes per minute on a 1000mhz Pentium.
  45. NOTES: A custom conversion can also be performed on any desired fields using
  46. a custom written VEDIT macro. This is described in more detail later.
  47. The conversion supports additional technical options which are
  48. not described here. Please examine the description at the beginning
  49. of the EBCDIC-T.VDM file for additional details. The following
  50. capabilities of the Level-2 package are not described here:
  51. * Preprocessing and postprocessing.
  52. * Appending or prefixing padding characters to any specified field.
  53. Greenview Data is available on a contract basis to perform any part
  54. of the conversion for you, including creating the data layout file or
  55. even translating the EBCDIC file(s) that you supply. If you do not
  56. have the packed field locations for your file, we can often examine
  57. the file and determine them for you.
  58. EBCDIC Conversion Files
  59. -----------------------
  60. Assuming you chose to include the "EBCDIC conversion files" during
  61. installation, you will have the following files in the VEDIT Home Directory,
  62. e.g. in "c:\vedit" or "c:\program files\vedit":
  63. EBCDIC-T.VDM The trial version of the EBCDIC Level 2 conversion macro
  64. described here. (Do not modify this file).
  65. EBCDIC-2.VCM EBCDIC conversion submacros; used only by custom macros;
  66. loaded automatically during preprocessing if any custom
  67. field ("c") is encountered. (Do not modify this file).
  68. COBOL2V.VDM The COBOL copy-book preprocessor. This is used by
  69. EBCDIC-T.VDM. It may also be run independently. (Do not
  70. modify this file).
  71. RELAY.VDM Generate output column numbers from a data layout (.lay)
  72. file. Handles quoted-comma-delimited fields and user
  73. specified field separators. This is used by COBOL2V.VDM. It
  74. may also be run independently. (Do not modify this file).
  75. REGPREP.VDM Used by EBCDIC-T.VDM to streamline the macro code, making
  76. it run faster. (Do not modify this file).
  77. EBCDIC.LAY A simple prototype data layout file to help you get started.
  78. It supports EBCDIC files with uniform fixed-length records.
  79. NOTE: You must edit this file, as described below, before
  80. converting any files.
  81. COBOL.COP A sample COBOL "Copy-Book" corresponding to sample data file
  82. COBOL.EBC.
  83. COBMIX.LAY A prototype data layout file produced from COBOL.COP, above.
  84. Includes some initial .LAY specifications.
  85. COBOL.LAY A prototype data layout file produced from COBMIX.LAY,
  86. above. Converted by COBOL2V.VDM and RELAY.VDM into standard
  87. .LAY format.
  88. COBOLD.LAY A prototype layout file to produce DBASE output.
  89. Not supplied. Generated as stated in "Quick DBASE Test", q.v.
  90. COBOL.EBC A small example EBCDIC file with a layout corresponding to
  91. COBOL.COP.
  92. COBOL.ASC The converted ASCII file made from the example COBOL.EBC
  93. file.
  94. COBOL.DBF The converted ASCII file in DBASE format made from COBOL.EBC
  95. via COBOLD.LAY.
  96. EBCDIC-T.BAT A batch file for automating the conversion process.
  97. Win 95/98/NT/2000/XP users can create a shortcut icon to this
  98. batch file for "drag and drop" conversion.
  99. EBCDIC-T.TXT This documentation file.
  100. LEADZERO.CUS An example of a custom macro for processing custom fields.
  101. This macro converts unpacked EBCDIC numbers to ASCII and then
  102. strips any leading zeroes. It optionally inserts a period
  103. before the second-last or third-last digit.
  104. UNPAKDEC.VDM A high-speed EBCDIC conversion macro that supports up to 32
  105. packed-decimal fields.
  106. UNPAKDEC.TXT Documentation file for the UNPAKDEC.VDM macro.
  107. Quick Test
  108. ----------
  109. You can perform a quick test by converting the supplied COBOL.EBC file using
  110. the supplied COBOL.LAY data layout (COBOL copy-book) file. From a DOS/NT
  111. command box, change to the directory containing VEDIT and into which you
  112. placed the EBCDIC conversion file. This is typically "c:\vedit". Then, give
  113. the command:
  114. vpw -x ebcdic-t.vdm cobol.ebc cobol.lay
  115. This will leave you in the VEDIT editor with the converted file displayed.
  116. Alternatively, to automatically save the file and exit, give the command:
  117. vpw -y -x ebcdic-t.vdm cobol.ebc cobol.lay
  118. The following section "Performing the Conversion (Automatically)" describes
  119. this in more detail.
  120. NOTE: The easiest way to perform this quick test is to open a DOS box in
  121. Windows, change to the directory containing the VEDIT file, (e.g.
  122. with the DOS command "cd \vedit") and then enter the commands above.
  123. You could run the quick test by selecting "Run" from the "Start"
  124. button, but then you will have to enter the full pathname to each
  125. file in the command.
  126. Once you have everything set up, you can create an icon on the
  127. Windows Desktop to perform the conversion via drag-and-drop.
  128. 1. Right-click on the desktop and select New -> Shortcut.
  129. 2. For the "Command line" or "Location of item", enter:
  130. c:\vedit\ebcdic-t.bat "%1"
  131. (This assumes VEDIT was installed into "c:\vedit").
  132. 3. For the "Name of shortcut", enter any desired name, such as
  133. "EBCDIC conversion".
  134. 4. You will now have an icon on your desktop.
  135. Creating the .LAY Layout File
  136. -----------------------------
  137. The user must specify via a ".LAY" data layout file, typically EBCDIC.LAY,
  138. the location of the packed, zoned and other special fields. The file's record
  139. length and several options are also specified in the data layout file.
  140. The data layout file is best understood from a simple example. Assume an
  141. EBCDIC file with the following specs:
  142. Record length is 114
  143. Field between columns 10 and 14 is a packed-decimal number (unsigned)
  144. Field between columns 20 and 21 is a packed-decimal number (unsigned)
  145. Field between columns 22 and 23 is a packed-decimal number
  146. Field between columns 30 and 33 is a packed-binary number
  147. Field between columns 42 and 46 is a zoned number
  148. Field between columns 51 and 55 is an unsigned number
  149. Field between columns 56 and 59 is a short (single precision) floating point number
  150. Field between columns 60 and 67 is a long (double precision) floating point number
  151. All other fields are simple EBCDIC text
  152. To convert this file and create a Windows/DOS text file with a Carriage-
  153. Return and Line-Feed at the end of each record, the following layout file is
  154. used: (This is the supplied prototype EBCDIC.LAY file)
  155. r=114,0 //Record length is 114, convert to DOS newlines
  156. o=z,b2z //Output leading zeros (blank '+' sign; sign at end)
  157. //Convert all-blank/null numeric fields to zeros
  158. e=0,ebcdic.err //Only report serious errors in EBCDIC.ERR
  159. d 10-14 u v2 //Packed-decimal (no sign, explicit decimal point)
  160. d 20-21 u //Packed-decimal (no sign)
  161. d 22-23 //Packed-decimal
  162. b 30-33,=9; //Packed-binary (9 digits; default is 8)
  163. z 42-46 //Zoned number (5 digits plus sign)
  164. u 51-55 //Unsigned number; want leading blanks converted to zeros
  165. //(o=b2z); otherwise redundant
  166. l 56-59,=7; v2 //Short (single precision) floating point; upto 7 digits with two past a decimal point
  167. l 60-67,=12; v2 //Long (double precision) floating point; upto 12 digits, 2 fractional
  168. As shown above, comments can be added to the layout file by preceding them
  169. with "//".
  170. The "r=114,0" indicates that this file has fixed-length records of 114 bytes.
  171. Most EBCDIC files have fixed-length records. Note that unpacking fields will
  172. increase the record length. The ",0" indicates that a Carriage-Return and
  173. Line-Feed will be appended after each record in order to create a Windows/DOS
  174. text file. Use ",1" to append just a Line-Feed to create a UNIX text file.
  175. The "o=z,b2z" specifies that leading zeros are to be output, rather than
  176. spaces and that all-blank/null numeric fields are to be converted to text
  177. zeros. The conversion options are described below.
  178. The "d" specifies a packed-decimal field. It must be followed by the
  179. beginning and ending column numbers of the field. The "u" in the parameter
  180. field specifies that this value is unsigned, so no sign is output, not even
  181. a space. Note: a positive or negative sign in the input data will generate
  182. an error. The "v2" specifies that an explicit decimal point is to be
  183. output, followed by the last two digits of the packed decimal value.
  184. The "b" specifies a packed-binary field. The maximum size of a packed-
  185. binary field is eight bytes. Ordinarily, a 4-byte binary field is output in
  186. an eight digit field. This can be changed with the ",=ndigits;" parameter as
  187. described in the later topic "Formatting Numeric Data".
  188. The "z" specifies a zoned number field. In a zoned field, the sign is
  189. packed into the last digit; the other digits are not packed. The output
  190. field is one greater than the input field so that the sign can be
  191. expressed.
  192. The "u" specifies a simple unsigned (non-packed) number. Since this
  193. is no different from other EBCDIC text, it need not be included. Using it
  194. here ensures that any leading spaces will be converted to zeros and allows
  195. all-blank/null numeric fields to be converted to zeros with the "o=b2z"
  196. instruction.
  197. Finally, the "l" specifies a short (single precision) or long (double
  198. precision) floating point number. The short value is four bytes in length;
  199. the long is eight. In the above example, the short value is expressed in a
  200. seven digit field including the two fractional digits. The output field is
  201. 9 bytes long to account for the sign and the explicit decimal point.
  202. Similarly, the long floating point value is output in a twelve digit field.
  203. Any fractional digits contained in the actual data beyond the two that are
  204. expressed are truncated. If the first truncated digit is five or greater the
  205. final expressed digit is rounded up.
  206. The complete list of possible field types is:
  207. b Packed-binary field
  208. d Packed-decimal field
  209. n Packed-No-Zone (PNZ); no sign; additional digit can be packed.
  210. z Zoned number field
  211. s Signed ASCII decimal field; analogous to zoned decimal. '{', 'A'-'R'
  212. and '}' represent signed digits. Used when converting an ASCII file
  213. with compressed fields. Should be used with "u=ignore" to set
  214. the default conversion.
  215. u Unsigned numeric field. Simple EBCDIC. Using it allows explicit
  216. decimal points to be output or leading spaces converted to zeros or
  217. having an all blank/null field converted to zeros.
  218. e EBCDIC field. This is redundant and slows down conversion, but may
  219. help some users better visualize their file. Necessary when
  220. quoted-and-comma-delimited or user-specified delimiter or DBASE
  221. output is specified. Also required for the first or last item of
  222. an "out" bracketed section.
  223. h Hex field. Output each byte as 2 hexadecimal digits.
  224. i Ignore field. The bytes in this field will be passed on "as is".
  225. l Floating point number. See topic "Floating Point Numbers".
  226. f Fill field. The bytes in this field are replaced (filled) with ASCII
  227. spaces, or another specified padding character.
  228. x Delete the field.
  229. c Custom field. A custom macro is used to process this field.
  230. The "b", "d", "l", "u" and "z" specifications can also take several options
  231. which specify exactly how the number is converted. If no options are
  232. specified, numbers are converted as follows:
  233. * Output space instead of '+' for positive values
  234. * Place the sign at the end of the number
  235. * Output numbers as signed values
  236. * Output leading zeros instead of spaces (due to "o=z")
  237. The following options, which are specified after the column numbers, control
  238. the conversion: (These override any "o=..." command settings).
  239. + Use an explicit "+" sign for positive numbers, else a Space is
  240. used. Negative numbers are always converted with "-".
  241. b Place the sign at the beginning of the number, else the sign is at
  242. the end of the number.
  243. u The data is expressed as an unsigned number. This option overrides
  244. the "+" and "b" options.
  245. z Use leading "0" in numbers; else leading zeros are replaced with
  246. Spaces.
  247. b2z Convert all-blank/null numeric fields to zeros.
  248. See also the topics "Formatting Numeric Data" and "Floating Point Numbers".
  249. Since it would be tedious to specify the same conversion options for every
  250. field, you can specify the default options with the "o=..." command. For
  251. example, "o=z" specifies that the converted numbers should have leading "0"
  252. instead of spaces. The command "o=+bz" would place the sign, including '+',
  253. and any leading zeros ahead of all unpacked numeric values by default. A
  254. .LAY file should have at most one "o=..." command.
  255. For some fields, you may want to disable one or more of the default options
  256. set with the "o=..." command. This can be done with the following options:
  257. - To use Space instead of "+" for positive numbers.
  258. e To place the sign at the end of the number.
  259. s The data is expressed as a signed value.
  260. p To use blank padding instead of zeros to right justify small numbers.
  261. NOTE: These field options are only needed to override the default options
  262. set with the "o=..." command.
  263. The numeric field specifications "b", "d", "l", "n", "u" and "z" (binary,
  264. packed decimal, floating point, packed-no-zone, unsigned numeric and zoned
  265. decimal) can also take an optional explicit decimal point position.
  266. v1 Place the decimal point "." one digit from the right.
  267. v2 Place the decimal point "." two digits from the right.
  268. v3 Place the decimal point "." three digits from the right.
  269. For example, the layout file above could be modified with these options:
  270. r=114,0 //Record length is 114, convert to DOS newlines
  271. o=-ep,b2z //Standard output default options
  272. //Also, convert all-blank/null numeric fields to zeros
  273. e=0,ebcdic.err //Only report serious errors in EBCDIC.ERR
  274. d 10-14 b //Packed-decimal; place sign at beginning
  275. d 20-21 zv2 //Packed-decimal; include leading "0"
  276. // place decimal point two digits from right
  277. d 22-23 +b //Packed-decimal; include "+" at beginning
  278. b 30-33 z //Packed-binary; include leading "0"
  279. //Note: output in an eight-digit field
  280. z 42-46 b //Zoned number; place sign at beginning
  281. u 51-55 z //Unsigned number in columns 51 thru 55; want leading blanks
  282. //and all-blank/null fields converted to zeros; else redundant
  283. l 56-59 //Short (single precision) floating point integer; 7 digit
  284. // field with no decimal point
  285. l 60-67 v0 //Long (double precision) floating point integer; 16-digits;
  286. // decimal point but no fractional digits
  287. Sometimes it is more convenient to specify the type and size of each field
  288. instead of its beginning and ending columns. The following variation of the
  289. original example shows this. Note how the "+" is used:
  290. r=114,0 //Record length is 114, convert to DOS newlines
  291. o=z,b2z //Output leading zeros (blank '+' sign; sign at end)
  292. //Convert all-blank/null numeric fields to zeros
  293. e=0,ebcdic.err //Only report serious errors in EBCDIC.ERR
  294. e +9 // 9 columns of EBCDIC text (1 - 9)
  295. d +5 // 5 columns of Packed-decimal (10-14)
  296. e +5 // 5 columns of EBCDIC text (15-19)
  297. d +2 // 2 columns of Packed-decimal (20-21)
  298. d +2 // 2 columns of Packed-decimal (22-23)
  299. e +6 // 6 columns of EBCDIC text (24-29)
  300. b +4 // 4 columns of Packed-binary (30-33)
  301. e +8 // 8 columns of EBCDIC text (34-41)
  302. z +5 // 5 columns of Zoned number (42-46)
  303. e +4 // 4 columns of EBCDIC text (47-50)
  304. u +5 // 5 columns of EBCDIC digits (51-55)
  305. l +4 // 4 columns of short (single precision) floating point (56-59)
  306. l +8 // 8 columns of long (double precision) floating point (60-67)
  307. e +47 //47 columns of EBCDIC text (56-76)
  308. The name of the data layout file can be either EBCDIC.LAY or filename.LAY,
  309. where 'filename' is the name of the file being converted. The name of the
  310. layout file can also be explicitly specified. This is described below under
  311. "Conversion Options".
  312. Floating Point Numbers
  313. ----------------------
  314. The EBCDIC conversion packages support IBM 360-style floating point numbers
  315. in the range 10E-18 through 10E18. Output is fixed format, right justified.
  316. The field is specified like the other numeric fields; e.g.,
  317. l bc,ec[,=ndigits;] [sop] [v[n]] // comment
  318. where the beginning and ending columns must be four or eight bytes long;
  319. "sop" are the standard options "+buz-esp", 'v' specifies that an explicit
  320. decimal point is to be output and 'n' specifies the number of digits to
  321. output past the decimal point. The optional "ndigits" specifies the total
  322. number of digits output, both before and after the decimal point (See
  323. "Formatting Numeric Data"). It must be sufficiently large to express the
  324. whole-number digits as well as the fractional digits "vn". There will
  325. always be at least one digit before the decimal point, even if just zero.
  326. The default "ndigits" is 7 for short floats and 16 for long floats.
  327. Floating point numbers with magnitudes greater than 10E18 are treated as
  328. erroneous; their output fields are filled with BAD_CHARs and error messages
  329. are generated in EBCDIC.ERR. Numbers with magnitudes between zero and 10E-18
  330. are output as zeros.
  331. (Technical)
  332. Floating point numbers have an intrinsic truncation error associated with
  333. them. IBM's standard floating point number has 6 significant hexadecimal
  334. digits and a sign and exponent packed into 4 bytes, with a certain amount of
  335. truncation error associated with the 6th digit. This can be transformed into
  336. a decimal representation of about 7 digits with a significant amount of
  337. error in the eighth digit. Accordingly, the eighth digit is truncated and
  338. the preceding digit(s) is/are rounded up when the truncated digit was
  339. greater than or equal to five. For double precision (eight bytes), seven-
  340. teen significant decimal digits can be output.
  341. NOTE: The EBCDIC conversion packages correctly handle these truncation
  342. issues according to the IBM documentation.
  343. If the conversion instruction specifies fewer significant digits than can
  344. be validly expressed, the last digit output is rounded up when the non
  345. displayed subsequent digit is five or greater. Double rounding (from 4 to
  346. 5 during conversion and then from 5 to 6 for displaying) is prevented.
  347. If the conversion instruction specifies more digits than can be validly
  348. expressed, zeros are used for the excess positions.
  349. Using a COBOL Copy-Book for the .LAY Layout File
  350. ------------------------------------------------
  351. For simple data files containing neither REDEFINES nor OCCURS clauses, it
  352. is possible to "cut and paste" the COBOL copy-book into the .LAY layout
  353. file. The COBOL copy-book must be preceded by a "p=" line and followed by
  354. a "q=" line.
  355. The following example converts the same file in the same way as the
  356. original example (this is the supplied prototype COBMIX.LAY file):
  357. r=114,0 //Record length is 114, convert to DOS newlines
  358. o=z,b2z //Output leading zeros (blank '+' sign; sign at end)
  359. //Convert all-blank/null numeric fields to zeros
  360. e=0,ebcdic.err //Only report serious errors in EBCDIC.ERR
  361. //
  362. p= //Start of COBOL data specifications
  363. //Vedit comments and blank lines are OK after the "p=" line
  364. *************************************************************** 000100
  365. * * 000110
  366. * SAMPLE COPY-BOOK * 000120
  367. * * 000130
  368. * RECSIZE = 114 BYTES * 000140
  369. * * 000150
  370. *************************************************************** 000160
  371. 000170
  372. 01 SAMPLE-REC. 000180
  373. 03 SA-KEY. 000190
  374. 10 SA-KEY-ALPHA PIC X(7). 000200
  375. 10 SA-KEY-NUMERIC PIC 9(2). 000250
  376. 03 SA-PAC-DEC-1 PIC 9(7)V99 COMP-3. 000300
  377. 03 FILLER PIC X(5). 000350
  378. 03 SA-PAC-DEC-2 PIC 999 COMP-3. 000400
  379. 03 SA-PAC-DEC-3 PIC S9(3) COMP-3. 000450
  380. 03 FILLER PIC X(6). 000500
  381. 03 SA-SIGNED-BINARY PIC S9(9) COMP. 000550
  382. 03 FILLER PIC X(8). 000600
  383. 03 SA-ZONED-DECIMAL PIC S9(5). 000650
  384. 03 FILLER PIC X(4). 000700
  385. 03 SA-ANOTHER-NUMERIC PIC 9(5). 000750
  386. 03 SA-FLOAT PIC S9(5)V99 COMP-1. 000800
  387. 03 SA-DOUBLE PIC S9(10)V99 COMP-2. 000850
  388. 03 FILLER PIC X(47). 000900
  389. q= //End of COBOL data specifications
  390. Notes: The COBOL statement lines must be included verbatim, maintaining
  391. the 1-6,7,8-72,73-80 columnar format. For statements covering
  392. more than 1 line, the entire statement must be included, not just
  393. the picture format.
  394. Other than COBOL statement lines, only blank lines, Vedit comment
  395. lines and Column setting "c=col" lines (see below) may appear between
  396. the "p=" and "q=" lines.
  397. Alternatively, each individual packed field's COBOL statement can be cut and
  398. pasted into the layout file. It is necessary to indicate the beginning column
  399. number of each non-contiguous field, as in the following example:
  400. r=114,0 //Record length is 114, convert to DOS newlines
  401. o=z,b2z //Output leading zeros (blank '+' sign; sign at end)
  402. //Convert all-blank/null numeric fields to zeros
  403. e=0,ebcdic.err //Only report serious errors in EBCDIC.ERR
  404. //
  405. p= //Start COBOL section
  406. //Columns 1-9 are simple EBCDIC
  407. c=10 //Starting column # for upcoming packed-decimal field
  408. 03 SA-PAC-DEC-1 PIC 9(7)V99 COMP-3. 000300
  409. //Columns 15-19 are simple EBCDIC
  410. c=20 //Starting column # for upcoming packed-decimal fields
  411. 03 SA-PAC-DEC-2 PIC 999 COMP-3. 000400
  412. 03 SA-PAC-DEC-3 PIC S9(3) COMP-3. 000450
  413. //Columns 24-29 are simple EBCDIC
  414. c=30 //Starting column #
  415. 03 SA-SIGNED-BINARY PIC S9(9) COMP. 000550
  416. //Columns 34-41 are simple EBCDIC
  417. c=42 //Starting column #
  418. 03 SA-ZONED-DECIMAL PIC S9(5). 000650
  419. //Columns 47-50 are simple EBCDIC
  420. c=51 //Starting column #
  421. 03 SA-ANOTHER-NUMERIC PIC 9(5). 000750
  422. 03 SA-FLOAT PIC S9(5)V99 COMP-1. 000800
  423. 03 SA-DOUBLE PIC S9(10)V99 COMP-2. 000850
  424. //Columns 68-114 are simple EBCDIC
  425. q= //End COBOL section
  426. More complicated copy-books with "OCCURS" and "REDEFINES" clauses should
  427. first be converted to a normal .LAY file with the supplied COBOL2V.VDM macro
  428. as described below.
  429. Performing the Conversion (Manually)
  430. -------------------------
  431. NOTE: The conversion is normally performed automatically (see below),
  432. but you can also run it manually.
  433. To convert files manually, it is necessary to have the data layout file named
  434. EBCDIC.LAY in the current or VEDIT Home Directory.
  435. 1. Open the EBCDIC file to be converted.
  436. NOTE: Steps 2. thru 4. are optional; they just let you review the EBCDIC
  437. file before it is converted.
  438. 2. Assuming the file has fixed-length records, set the correct record
  439. length with {CONFIG, File handling, File type}.
  440. 3. Press <Alt-D> (the hot-key for {VIEW, Toggle display mode}) several times
  441. to switch to EBCDIC mode. The non-packed fields should now be readable.
  442. 4. Open the file EBCDIC.LAY and ensure that it is correct. In particular,
  443. the "r=" should be set to the same record length that you set above.
  444. Switch back to the data file's buffer.
  445. 5. Select {MISC, Load/Execute macro}.
  446. Enter the file name "ebcdic-t.vdm" or select this file in the dialog box.
  447. Use the default register number "100".
  448. 6. The macro will start, display its sign-on message and immediately begin
  449. performing the conversion. It displays a progress message of how many
  450. records have been converted.
  451. The conversion creates a new file with the same filename, but an ".ASC"
  452. extension.
  453. 7. When done, the beginning of the converted file will be displayed on the
  454. screen.
  455. 8. Select {FILE, Exit} to exit the editor.
  456. Performing the Conversion (Automatically)
  457. -------------------------
  458. The conversion can be performed automatically from a command line or with a
  459. DOS batch file. Win 95/98/NT/2000/XP users can create a shortcut icon to the
  460. batch file; you can then drag-and-drop the file to be converted onto the
  461. icon.
  462. 1a. From a DOS or NT command line, use the following command to run the
  463. 32-bit Windows VEDIT with the conversion macro:
  464. c:\vedit\vpw -x ebcdic-t.vdm filename
  465. where 'filename' is the name of the file to be converted.
  466. (This assumes VEDIT was installed in c:\vedit.)
  467. 2a. This will immediately start the conversion. When done, the converted file
  468. will be saved and shown on the screen. You must still exit the editor.
  469. To also automatically exit, use the command:
  470. c:\vedit\vpw -y -x ebcdic-t.vdm filename
  471. This will convert and save the file, and exit VEDIT without any user
  472. intervention whatsoever.
  473. -OR-
  474. 1b. Use the supplied EBCDIC-T.BAT batch file which contains the command to
  475. run the 32-bit Windows VEDIT and automatically convert the specified
  476. file:
  477. c:\vedit\vpw -x ebcdic-t.vdm %1 %2
  478. Therefore, to convert the file with name 'filename', give the command:
  479. ebcdic-t filename
  480. 2b. This will convert and save the file, and exit VEDIT without any user
  481. intervention whatsoever.
  482. If desired, you can have VEDIT display the converted file before saving
  483. and exiting. The comments in the EBCDIC-T.BAT file describe how to
  484. do this.
  485. NOTE: These commands assume that the EBCDIC data file, EBCDIC-T.BAT and
  486. EBCDIC.LAY are in the current directory. If not, you may need to
  487. specify the full pathname to the files.
  488. EBCDIC-T.BAT also assumes that VEDIT was installed into the
  489. "C:\VEDIT" directory. If you installed VEDIT into another directory,
  490. e.g. "C:\Program Files\VEDIT", you must edit the EBCDIC-T.BAT file
  491. to specify the correct directory.
  492. Conversion Options
  493. ------------------
  494. By default, the name of the data layout file is EBCDIC.LAY. Optionally, you
  495. can use "filename.LAY", where 'filename' is the name of the file being
  496. converted. You can also explicitly specify the name of the .LAY file.
  497. EBCDIC.LAY is convenient when you have many files of the same type;
  498. filename.LAY is better when each file is of a different format.
  499. The "-n" invocation switch causes filename.LAY to be used as the layout file.
  500. Therefore, use the following command to automatically run the conversion
  501. macro:
  502. c:\vedit\vpw -n -x ebcdic-t.vdm datafile.ebc
  503. where 'datafile.ebc' is the name of the file to be converted.
  504. datafile.lay will be used as the name of the layout file.
  505. Alternatively, you can explicitly specify the name of the layout file. This
  506. is necessary when the .LAY layout file is in a different directory. Use the
  507. command form:
  508. c:\vedit\vpw -x ebcdic-t.vdm datafile.ebc layout.lay
  509. where 'datafile.ebc' is the name of the file to be converted.
  510. 'layout.lay' is the name of the data layout file.
  511. Using Different Directories
  512. ---------------------------
  513. By default, the EBCDIC source file "datafile.ebc", the data layout file
  514. EBCDIC.LAY and the resulting ASCII file "datafile.asc" must all be in
  515. the same directory. However, you can specify separate directories with
  516. the command:
  517. vpw -x ebcdic-t.vdm \dir1\datafile.ebc -a \dir2\datafile.asc \dir3\layout.lay
  518. where '\dir1\datafile.ebc' is the pathname of the file to be converted.
  519. '\dir2\datafile.asc' is the pathname of the converted file.
  520. '\dir3\layout.lay' is the name of the data layout file.
  521. This format lets you specify the full pathname of the converted file and of
  522. the data layout file.
  523. ---------------
  524. ADVANCED TOPICS
  525. ---------------
  526. Quoted-Comma-Delimited ASCII File
  527. ---------------------------------
  528. Consider the following relatively simple .LAY file:
  529. r=76,0 //Record length is 76, convert to DOS newlines
  530. o=z,b2z //Output leading zeros (blank '+' sign; sign at end)
  531. //Convert all-blank/null numeric fields to zeros
  532. e=0,ebcdic.err //Only report serious errors in EBCDIC.ERR
  533. e +9 // 9 columns of EBCDIC text (1 - 9)
  534. d +5 // 5 columns of Packed-decimal (10-14)
  535. e +5 // 5 columns of EBCDIC text (15-19)
  536. d +2 // 2 columns of Packed-decimal (20-21)
  537. d +2 // 2 columns of Packed-decimal (22-23)
  538. e +6 // 6 columns of EBCDIC text (24-29)
  539. b +4 // 4 columns of Packed-binary (30-33)
  540. e +8 // 8 columns of EBCDIC text (34-41)
  541. z +5 // 5 columns of Zoned number (42-46)
  542. e +4 // 4 columns of EBCDIC text (47-50)
  543. u +5 // 5 columns of EBCDIC digits (51-55)
  544. e +21 //21 columns of EBCDIC text (56-76)
  545. One converted ASCII record might look like this:
  546. ABCDEFGHI123456789 ABCDE123 123 ABCDEF1234567890ABCDEFGH12345 ABCD12345ABCDE...
  547. It is difficult to tell where one field ends and the next begins. Therefore,
  548. the conversion can optionally quote each field and separate them with commas.
  549. Therefore, the converted ASCII record would look like this:
  550. "ABCDEFGHI","123456789 ","ABCDE","123 ","123 ","ABCDEF","123456789 ","ABCDEFGH","12345 ","ABCD","12345","ABCDE..."
  551. To select this option, add the "qcd" command to the .LAY file:
  552. r=76,0 //Record length is 76, convert to DOS newlines
  553. o=z,b2z //Output leading zeros (blank '+' sign; sign at end)
  554. //Convert all-blank/null numeric fields to zeros
  555. qcd //Create quoted-comma-delimited ASCII
  556. e +9 //9 columns of EBCDIC text (1 - 9)
  557. ...
  558. Please be aware of these notes when creating a quoted-comma-delimited file:
  559. * The "qcd" command must appear in the .LAY file before any field specs.
  560. * All fields, including simple EBCDIC text fields, must be specified.
  561. * Only use the "qcd" command when necessary - it slows down the conversion
  562. by about 20%. Although it makes the ASCII file more humanly readable,
  563. most database programs, such as Microsoft Access (tm), can import based
  564. on beginning and ending columns and don't need a quoted-comma-delimited
  565. file.
  566. * When quoting and comma delimiting output fields, any quotes that appear
  567. in text fields may confuse programs that later try to process the output.
  568. To automatically convert quotes to apostrophes, use the EBCDIQ.TBL
  569. conversion table as explained in the topic "Alternative EBCDIC to ASCII
  570. Translation Tables", below.
  571. User Specified Field Delimiter String
  572. -------------------------------------
  573. As an alternative to quoting and comma delimiting each field, a custom string
  574. can be used to separate fields. E.g., to separate the fields with " | "
  575. (space, pipe, space), place the following command at the beginning of the
  576. .LAY layout file:
  577. v=Reg_Set(XDREG,/ | /);
  578. This is an example of the "v=" specification which executes Vedit macro
  579. commands. The text register specified by internal value XDREG (currently 17,
  580. when not being run under WILDFILE.VDM) is set to the specified string.
  581. EBCDIC-2.VDM appends T-Reg(XDREG) to the end of each specified output field
  582. and to the end of each set of unspecified (default) fields.
  583. Note: To use the "/" character as part of the string, the string delimiting
  584. "/" may be replaced by any of '"`\.
  585. Alternative EBCDIC to ASCII Translation Tables
  586. ----------------------------------------------
  587. It is sometimes necessary or desirable to translate EBCDIC text characters
  588. to a different ASCII character than normal. Three alternative translation
  589. tables are supplied for this purpose: EBCDIQ.TBL which converts quotes to
  590. apostrophes; EBCDIL.TBL which converts "low values" (0x00 - 0x3f) into
  591. ASCII spaces; and EBCDILQ.TBL which does both. The "Q" table are provided
  592. for use when output is being quoted and comma delimited. The "L" tables
  593. are provided for cases when uninitialized text fields or, perhaps,
  594. undocumented packed fields are present in supposedly simple text fields.
  595. The result of treating them as text is gibberish in the ASCII output.
  596. To use one of these tables, include the following, appropriately edited,
  597. line near the beginning of your .lay file:
  598. v=Translate_Load("EBCDIQ.TBL") // Convert EBCDIC " to ASCII '
  599. This assumes that the table has been copied to your VEDIT home directory
  600. or is in the directory containing the data file being translated.
  601. Formatting Numeric Data
  602. -----------------------
  603. The numeric field specifiers "b", "d", "l", "n", "u" and "z" have an
  604. associated default output width dependent on the individual data type, the
  605. size of the input field, the presence and location of a sign and the
  606. presence of an explicit decimal point.
  607. The location of the sign (plus, minus or blank) has been well explained in
  608. the topic "Creating the .LAY Layout File". The sign may also be suppressed
  609. by the unsigned option 'u'. E.g., "b 1,4 u". The output for this binary
  610. field is eight columns - the standard number of digits stored in a 4-byte
  611. binary. There is no sign to be expressed for the unsigned numeric fields 'u'
  612. (simple numeric) and 'n' (packed, no zone).
  613. To output an explicit decimal point, use the "v[n]" option, where 'n' is
  614. the number of digits following the decimal point. E.g.,"d 1,4 v2". The
  615. output for this packed decimal field is nine columns in the format
  616. "ddddd.ffs" where 's' is the sign. If 'n' is omitted or 0, nothing
  617. is output past the decimal point.
  618. To control the actual number of digits output, use the ",=ndigits;" option,
  619. where "ndigits" is the total number of digits to be output both before and
  620. after any explicit decimal point. E.g., "l 1,4,=6; v2". The output of this
  621. floating point field is eight columns in the format "dddd.ffs". The default
  622. size is nine columns. I.e., "l 1,4 v2" generates "ddddd.ffs".
  623. The number of digits output can be greater or less than the default number
  624. of digits contained in a numeric field. If greater, leading zeros/blanks
  625. are normally output. For the case of floating point fields only, specifying
  626. more digits past the decimal point than are contained in the actual data
  627. results in trailing zeros being output.
  628. Specifying fewer digits than the default must be done with care. If fewer
  629. digits are specified than are actually contained in any field other than a
  630. floating point's fractional digits, a BAD_CHAR will be placed into the
  631. field's first output column and an error message will be output to
  632. EBCDIC.ERR.
  633. The defaults for binary numbers are two, four, eight and eighteen digits for
  634. one-, two-, four- and eight-byte binary numbers. (Note: IBM does not support
  635. one-byte binary numbers).
  636. The default for packed decimals is 2*(ending column - beginning column) + 1.
  637. The default for packed, no zone is 2*input size, where input size = (ending
  638. column - beginning column + 1).
  639. The default for short (single precision) floating point (input size = 4) is
  640. 7.
  641. The default for long (double precision) floating point (input size = 8) is
  642. 16.
  643. Following are examples of binary fields with the total output field size
  644. given in the comment field:
  645. o=+z //Output leading zeros and '+' for nonnegative values
  646. b 1,4,=9; //10 bytes (9 digits + sign) PIC S9(9) COMP.
  647. b 1,4 u // 8 bytes (8 digits, no sign) PIC 9(8) COMP.
  648. b 1,4,=10; //11 bytes (10 digits including any leading zeros + sign)
  649. b 1,1 u //1 byte (1 digit, no sign) PIC X.
  650. b 1,1,=2; u raw //2 byte2 (2 digits, no sign) PIC X.
  651. b 1,1,=2; raw //3 bytes (2 digits + sign)
  652. b 1,1 - //2 bytes (1 digit, trailing sign, space if positive)
  653. b 1,1 -b //2 bytes (1 digit, leading sign, space if positive)
  654. b 1,2 // 5 bytes (4 digits + sign) PIC S9(4) COMP.
  655. b 1,8 //19 bytes (18 digits + sign) PIC S9(18) COMP.
  656. b 1,8,=14; //15 bytes (14 digits + sign) PIC S9(14) COMP.
  657. Reporting Errors
  658. ----------------
  659. Any conversion errors can optionally be reported in a file; the default
  660. filename is "ebcdic.err" in the same directory as the converted output file.
  661. Alternatively, you can specify a different filename or a full pathname with
  662. the "e=" command (see below).
  663. Three kinds of errors can be reported:
  664. * Syntax errors in the ".LAY" file and other serious errors which prevent
  665. any data from being converted. The ebcdic.err file will contain a
  666. description of the error.
  667. * Errors in the data file. When bad data, e.g. an invalid packed-decimal
  668. number is encountered, it is converted to spaces and the conversion
  669. continues. Optionally, up to the first 'n' data errors can be reported.
  670. The ebcdic.err file will contain a description and the position in the
  671. data file of the error.
  672. * Any unexpected conditions which cause the conversion to stop. These are
  673. reported with "***** Unexpected breakout occurred." in the ebcdic.err
  674. file.
  675. Our experience is that many data files contain insignificant errors in some
  676. fields. In some cases the field is defined in the copy-book, but is never
  677. used and contains garbage. Therefore, we suggest ignoring errors in the data
  678. file unless the data is really critical and you are willing to take the time
  679. to track down the errors on the mainframe side. When data error reporting is
  680. enabled, only the first 'n' errors are reported to prevent creating huge
  681. error files.
  682. The "e=" command in the ".LAY" file controls which errors are reported in the
  683. error file and can override the name of the file. Some examples are:
  684. e=1000,ebc-data.err
  685. Up to the first 1000 errors in the data file will be reported.
  686. Specifies that the name of the error file is "ebc-data.err".
  687. This will be written to the main output directory which is the
  688. same as the source data file unless altered by the "-a outpathname"
  689. invocation option.
  690. e=200
  691. Up to the first 200 errors in the data file will be reported. The
  692. default error file "ebcdic.err" will be used.
  693. e=0
  694. Most errors in the data file will not be reported and will not
  695. cause an error file to be created. Severe errors will still be
  696. reported. These are mostly encountered by the preprocessor and
  697. will have been fixed before production runs are made.
  698. e=0,\errdir\ebcdic.err
  699. Exactly the same as "e=0". It explicitly gives the location and
  700. name of the error file.
  701. When the conversion starts, any existing "ebcdic.err" file is deleted. A
  702. batch file can therefore test for the existence of ebcdic.err to determine if
  703. the conversion was successful or not. The supplied EBCDIC-T.BAT file does
  704. this with the batch commands:
  705. IF NOT EXIST ebcdic.err GOTO DONE
  706. ECHO -
  707. ECHO Conversion had errors!
  708. ECHO See the file EBCDIC.ERR for details.
  709. ECHO -
  710. PAUSE
  711. :
  712. :DONE
  713. Advanced Commands
  714. -----------------
  715. The new "out" command allows diverting just part of a record to its own
  716. file. To link extracted data to its parent record, a unique ID # is
  717. automatically generated. Associated with this are 4 new commands, "b=",
  718. "d=", "a=" and "n=" (see below).
  719. Outputting a record section to its own file (out)
  720. -------------------------------------------------
  721. It is possible to output a section of a record to its own file by using the
  722. 'out "fname"' ... 'out' brackets. This can be done even when the parent
  723. record is being output to its own file. The unique ID #, discussed below, is
  724. appended to both the end of the section and the end of the parent record.
  725. out ["fname"] Use the "out" commands as brackets around a section to
  726. divert the output to the file "fname". The first "out"
  727. requires the filename. The first and last fields must
  728. be explicitly defined. For example,
  729. ...
  730. out "special.asc"
  731. e 510,579
  732. out
  733. ...
  734. converts columns 510 through 579 from simple EBCDIC to ASCII
  735. and outputs the results into file "special.asc". The unique
  736. ID will be appended to the end of the line in "special.asc"
  737. and to the end of the parent record's output line.
  738. The first and last fields (here, the same) have been
  739. explicitly specified, even though ordinarily they could have
  740. been omitted.
  741. Unique ID #'s for Extracted Fields
  742. ----------------------------------
  743. When data fields are being output to their own files, it is helpful and
  744. sometimes necessary to generate a unique ID # for associating the extracted
  745. portions of the data record with the main portion. The unique ID is output
  746. at the end of the extracted portion and at the end of the parent record.
  747. For Level-2 this occurs for 'out "fname"' ... 'out' bracketed sections
  748. (see above).
  749. The unique ID # consists of a 5-digit "# days elapsed since base date"
  750. followed by a 1-digit "daily run #" (default value is 0) followed by a
  751. 6-digit "record #". The five-digit elapsed days count allows for 270+
  752. unique years. The 6-digit record count allows for 999,999 records to be
  753. processed in a single day. The "daily_run_#" allows more than one such
  754. run per day. This value must be explicitly set (see below).
  755. The ID's are generated automatically, based on the day of the run and the
  756. input record #. To control the ID generation, 4 commands have been added:
  757. "b=base_date" (default = 1/1/2000); "d=run_date" (default = current date);
  758. "a=additional_offset" (default = 0) and "n=l,m[,n]" to control the number
  759. of digits in the unique ID (default = 5 digits for days elapsed, 6 digits
  760. for the record # and 1 digit for the run #).
  761. To change the run date, add the "d=run_date" command to the .LAY file. Dates
  762. are expressed in mm/dd/yyyy format. The year must be completely expressed.
  763. The separator may be any of "_./\:-".
  764. To change the base date from its default of 1/1/2000, add the "b=base_date"
  765. command; e.g.,
  766. b=1/1/1900 // Include dates from the previous century
  767. To change the number of digits in the unique ID to 4 digits for # days
  768. elapsed since base date and 5 digits for the record # use the "n=d,r"
  769. command; e.g.,
  770. n=4,5 // 4 digits for days elapsed since base date
  771. // 5 digits for record count
  772. // There is still 1 digit reserved for the
  773. // daily run #
  774. In case more than one data set is processed for a given base_date and
  775. run_date, one can include the "a=additional_offset" command in order
  776. to generate unique ID's in the 2nd and later runs. Set the offset greater
  777. than or equal to the last record # processed in the previous run(s); e.g.
  778. a=9999 // Previous run ended with record 9,999
  779. As an alternative, one can employ the digit reserved for the daily run #
  780. by adding the run # to the invocation command line after the "-u"
  781. parameter, which is placed after all specified filenames. For the second
  782. run of the day this might be:
  783. c:\vedit\vpw -x ebcdic-2.vdm datafile.ebc layout.lay -u 2
  784. DBASE output
  785. ------------
  786. To easily produce DBASE-style output, set the second parameter in the
  787. "r=reclen,parm2" specification in the .LAY file to "DBASE-III". During
  788. preprocessing, a DBASE header record - including automatically generated or
  789. explicitly entered field names - is generated for the output file.
  790. The automatically generated names are of the form "Fn", where 'n' is the
  791. field's index, counting from 1.
  792. A second letter 'A', 'B', ... is automatically generated between 'F' and 'n'
  793. for each section being output to its own file via an "out" command.
  794. Alternatively, specify the letter, e.g. 'N', on the "out" command:
  795. out "fname",FN
  796. See, also, "Defining Explicit Field Names for DBASE, below.
  797. Other details, such as the header terminating 0x0d, file terminating 0x1a
  798. and record leading space, are also automatically generated. Currently, all
  799. fields are specified as type 'C' (character).
  800. Each field in the record must be specified in the .LAY file, the same as for
  801. quoting and comma delimiting. However, the preprocessor will automatically
  802. strip the default field specifications after generating the header data for
  803. the field. This provides a dramatic increase in run-time performance for the
  804. normal case where there are only a few packed fields per record.
  805. See also COBOL2V.VDM and RELAY.VDM for DBASE options.
  806. Quick DBASE Test
  807. ----------------
  808. You can perform a quick test by converting the supplied COBOL.EBC file after
  809. generating COBOLD.LAY from COBOL.COP. From a DOS/NT command box, change to
  810. the directory containing VEDIT and into which you placed the EBCDIC
  811. conversion file. This is typically "c:\vedit". Then give the command:
  812. vpw -x cobol2v.vdm cobol.cop -a cobold.lay -u dbase
  813. This will leave you in the VEDIT editor with the converted layout file
  814. displayed. A preliminary .XRF file is also generated which is of no
  815. practical interest. Select {FILE, Exit} to exit the editor, saving the
  816. layout file and doing as you will with the .XRF file.
  817. Now, to convert the EBCDIC data, producing an ASCII file in DBASE format,
  818. give the command:
  819. vpw -x ebcdic-t.vdm cobol.ebc cobold.lay
  820. Since COBOLD.LAY does not specify otherwise, EBCDIC-T.VDM automatically
  821. generates names for each field, creates the DBASE header record, translates
  822. COBOL.EBC into ASCII and displays the results. To view the DBASE header
  823. record, select {MISC, More macros, DBASE}. This pops up a second edit window
  824. with the DBASE header information converted into meaningful text.
  825. Viewing DBASE Files
  826. -------------------
  827. Greenview Data, Inc. provides two macros to aid viewing DBASE files. For
  828. information, see the VEDIT "Help" topic "DBASEKEY.VDM Macro": from within
  829. VEDIT, select {Help, Search for help on...} and enter DBA into the "Index"
  830. input box; click [Display]; then select "DBASE.VDM Macro" and click [Display].
  831. The first topic gives a more complete discussion of DBASE.VDM. The immediately
  832. following topic discusses "DBASEKEY.VDM" which you may prefer for common use.
  833. Defining Explicit Field Names for DBASE
  834. ---------------------------------------
  835. To have explicit field names entered into the DBASE header record, enter them
  836. into the .LAY file comment section just past the ASCII-output-column numbers.
  837. Also, include the line "xrf=1" or "xrf=on" at the beginning of the .LAY file.
  838. Then, run RELAY.VDM to produce an .XRF file that contains the explicit names
  839. in the first column group, auto-generated names in the second column group,
  840. and COBOL copy-book names in the third column group.
  841. When EBCDIC-T.VDM is run, the "xrf=on" specification will cause the .XRF file
  842. to be loaded during preprocessing and the first short name encountered from
  843. each line to be placed into the DBASE header record. Thus, it is possible to
  844. give explicit names to just a few important fields, using auto-generated names
  845. for the remaining fields.
  846. DBASE names are limited to ten characters; they must begin with a letter and
  847. may contain only letters and digits. See "COBOL2V.VDM and DBASE Output",
  848. below, for an example.
  849. Using the COBOL2V.VDM Macro
  850. ---------------------------
  851. Although a COBOL copy-book can often be pasted directly into a .LAY file, it
  852. is usually better to first convert the copy-book into a normal .LAY file.
  853. There are several reasons for this:
  854. * A normal .LAY file allows more flexibility in how each field is converted.
  855. E.g., you can specify different "+bz" options for each packed field.
  856. * The "X" PIC specification frequently contains binary or custom coded data.
  857. It also is used for undefined data. Undefined data frequently translates
  858. not merely into strange looking text but also into unwanted control codes.
  859. These fields must be deleted or blank filled in the .LAY file.
  860. * Removing simple EBCDIC (non-numeric) field specifications speeds up the
  861. conversion.
  862. * More complicated copy-books with "OCCURS" and "OCCURS DEPENDING ON ..."
  863. clauses may require manual changes to the .LAY file. (The latter also
  864. requires the EBCDIC Level-4 package.)
  865. * "REDEFINES" in the copy-book are not automatically supported. Most can be
  866. ignored, but others require manually setting up a different record type.
  867. (The latter also requires the EBCDIC Level-3 package.)
  868. The supplied COBOL2V.VDM macro converts COBOL copy-book statements, e.g. "PIC
  869. X(7)", into normal ".LAY" specifications, e.g. "e 1 7". It also generates the
  870. "r=max_rec_size,0" specification. The original copy-book statements are
  871. maintained in commented form.
  872. When COBOL2V.VDM is being run by EBCDIC-T.VDM on copy-book statements that
  873. have been pasted into a .LAY file, the COBOL statements must be surrounded by
  874. "p=" and "q=" brackets. Greenview layout specifications must not occur within
  875. the bracketed copy-book sections.
  876. When COBOL2V.VDM is being run directly on a copy-book, these brackets are
  877. not required unless .LAY data layout specifications other than "c=0" are
  878. included; the "c=0" specifications themselves are required when multiple
  879. record types are present in order to reset the input column counter.
  880. Because some copy-book "X" pictures actually contain binary data, you may
  881. want to change them to "B" for binary or "H" for hex or "N" for
  882. Packed-No-Zone (PNZ) which are recognized by the COBOL2V.VDM macro.
  883. Otherwise, edit the .LAY file after conversion and change the 'e'
  884. specifications to 'b' for binary, 'h' for hex or 'n' for PNZ.
  885. NOTES: This macro comments out all "REDEFINES" clauses. If a redefinition
  886. contains packed/zoned/binary data that differs from the original
  887. definition, a separate record description must be compiled for each
  888. definition. This requires the EBCDIC Level-3 support package.
  889. The rare COMP-1 (FLOAT) and COMP-2 (DOUBLE) formats are supported only
  890. in the range 10E-18 thru 10E18, in fixed form only. Please contact us
  891. if you need larger powers of 10 or scientific notation.
  892. Unsigned numeric fields (PIC 9) are translated to a "u" specification.
  893. This allows specifying explicit output decimal points, leading zeros
  894. and converting all-blank/null fields to zeros.
  895. COBOL2V.VDM is internally used by the EBCDIC-T.VDM macro, but can also be run
  896. separately.
  897. >>> To convert a COBOL copy-book into a .LAY data layout file:
  898. 1. Save the copy-book as a .LAY file, e.g. "myfile.lay".
  899. 2. Edit the .LAY file as necessary.
  900. 3. Save the file.
  901. 4. Convert the .LAY file, e.g. "myfile.lay" with the command:
  902. vpw -x cobol2v.vdm myfile.lay
  903. The following is the result of running COBOL2V on the supplied COBOL.LAY file:
  904. //
  905. // COBOL.LAY - (Slightly) modified sample COBOL copy-book for converting
  906. // EBCDIC files with packed fields into ASCII.
  907. //
  908. // (If there are REDEFINES present, this will probably
  909. // be just the first of many passes).
  910. //
  911. r=114,0 //Record length is 114, convert to DOS newlines
  912. o=z,b2z //Output leading zeros (blank '+' sign; sign at end)
  913. //Convert all-blank/null numeric fields to zeros
  914. e=0,ebcdic.err //Only report serious errors in EBCDIC.ERR
  915. // *************************************************** 000100
  916. // * * 000110
  917. // * SAMPLE COPY-BOOK * 000120
  918. // * * 000130
  919. // * RECSIZE = 114 BYTES * 000140
  920. // * * 000150
  921. // *************************************************** 000160
  922. // 000170
  923. // 01 SAMPLE-REC. 000180
  924. // 03 SA-KEY. 000190
  925. e 1,7 // 1 10 SA-KEY-ALPHA PIC X(7). 000200
  926. u 8,9 // 8 10 SA-KEY-NUMERIC PIC 9(2). 000250
  927. d 10,14 u v2 // 10 03 SA-PAC-DEC-1 PIC 9(7)V99 COMP-3. 000300
  928. e 15,19 // 20 03 FILLER PIC X(5). 000350
  929. d 20,21 u // 25 03 SA-PAC-DEC-2 PIC 999 COMP-3. 000400
  930. d 22,23 // 28 03 SA-PAC-DEC-3 PIC S9(3) COMP-3. 000450
  931. e 24,29 // 32 03 FILLER PIC X(6). 000500
  932. b 30,33,=9; // 38 03 SA-SIGNED-BINARY PIC S9(9) COMP. 000550
  933. e 34,41 // 48 03 FILLER PIC X(8). 000600
  934. z 42,46 // 56 03 SA-ZONED-DECIMAL PIC S9(5). 000650
  935. e 47,50 // 62 03 FILLER PIC X(4). 000700
  936. u 51,55 // 66 03 SA-ANOTHER-NUMERIC PIC 9(5). 000750
  937. l 56,59,=7; v2 // 71 03 SA-FLOAT PIC S9(5)V99 COMP-1. 000800
  938. l 60,67,=12; v2 // 80 03 SA-DOUBLE PIC S9(10)V99 COMP-2. 000850
  939. e 68,114 // 94 03 FILLER PIC X(47). 000900
  940. // 140 (RecLen)
  941. Alternatively, for simple copy-books, run COBOL2V.VDM on the copy-book directly:
  942. vpw -x cobol2v.vdm cobol.cop -a myfile.lay
  943. Following is the result of the above process on the supplied file "COBOL.COP"
  944. which produced the file "MYFILE.LAY":
  945. r=114,0 // Input reclen, emit DOS newlines
  946. // * ************************************************************** 000100
  947. // * * 000110
  948. // * SAMPLE COPY-BOOK * 000120
  949. // * * 000130
  950. // * RECSIZE = 114 BYTES * 000140
  951. // * * 000150
  952. // * ************************************************************** 000160
  953. // 000170
  954. // 01 SAMPLE-REC. 000180
  955. // 03 SA-KEY. 000190
  956. e 1,7 // 1 10 SA-KEY-ALPHA PIC X(7). 000200
  957. u 8,9 // 8 10 SA-KEY-NUMERIC PIC 9(2). 000250
  958. d 10,14 u v2 // 10 03 SA-PAC-DEC-1 PIC 9(7)V99 COMP-3. 000300
  959. e 15,19 // 20 03 FILLER PIC X(5). 000350
  960. d 20,21 u // 25 03 SA-PAC-DEC-2 PIC 999 COMP-3. 000400
  961. d 22,23 // 28 03 SA-PAC-DEC-3 PIC S9(3) COMP-3. 000450
  962. e 24,29 // 32 03 FILLER PIC X(6). 000500
  963. b 30,33,=9; // 38 03 SA-SIGNED-BINARY PIC S9(9) COMP. 000550
  964. e 34,41 // 48 03 FILLER PIC X(8). 000600
  965. z 42,46 // 56 03 SA-ZONED-DECIMAL PIC S9(5). 000650
  966. e 47,50 // 62 03 FILLER PIC X(4). 000700
  967. u 51,55 // 66 03 SA-ANOTHER-NUMERIC PIC 9(5). 000750
  968. l 56,59,=7; v2 // 71 03 SA-FLOAT PIC S9(5)V99 COMP-1. 000800
  969. l 60,67,=12; v2 // 80 03 SA-DOUBLE PIC S9(10)V99 COMP-2. 000850
  970. e 68,114 // 94 03 FILLER PIC X(47). 000900
  971. // 140 (RecLen)
  972. Note that the "r=114,0" line was produced automatically. The first column
  973. of numbers past the comment lead-in characters gives the beginning column
  974. numbers for the translated fields. The final comment gives the length of
  975. the translated record, not counting the newline terminators.
  976. Options for COBOL2V.VDM
  977. -----------------------
  978. COBOL2V.VDM now supports command line options via the "-u option_list"
  979. parameter on its invocation line:
  980. vpw -x cobol2v.vdm myfile.cob -a myfile.lay -u option_list
  981. The option_list can be any of the following, separated by spaces:
  982. DOS UNIX MAC DBASE ISHORT NORELAY CC=column_number NAMES
  983. When "-u" is not specified, the defaults are DOS and CC=20.
  984. The "-a myfile.lay" parameter, above, renames the output file to "myfile.lay"
  985. while leaving the source file "myfile.cob" unaltered.
  986. COBOL2V.VDM now generates the "r=reclen" specification automatically.
  987. The default is to generate "r=reclen,0" for DOS-terminated output lines.
  988. Specify "-u UNIX" to generate "r=reclen,1" to append just a Line-Feed
  989. character to the translated output records.
  990. The default starting column for comments is currently 20. To change this
  991. to column 'n', specify "cc=n".
  992. Ordinarily, COBOL2V.VDM invokes RELAY.VDM, which converts "+size" to
  993. "begcol,endcol" format and places the output column numbers into the
  994. comment field. To keep the "+size" format use "-u NORELAY". To then
  995. generate output column numbers, run RELAY.VDM, perhaps with "-u INSERT".
  996. To later convert the "+size" format to "begcol,endcol", run RELAY.VDM
  997. with the "-u CONVERT" option.
  998. COBOL2V.VDM and DBASE Output
  999. ----------------------------
  1000. The Level-2 translation package can now output records in DBASE format.
  1001. Specifying the "-u DBASE" DOS command line invocation option will generate
  1002. the "r=reclen,DBASE-III" specification in the .LAY file. (It also generates
  1003. a .XRF file containing short field names alongside the COBOL long names).
  1004. The Level-2 package can automatically generate short field names to put into
  1005. the DBASE header record. Or, the user can create the short names within the
  1006. comment section of the .LAY file. If this is desired, the "-u DBASE ISHORT"
  1007. options should be included on the COBOL2V.VDM invocation line.
  1008. For example, the following output (compressed horizontally) was produced by:
  1009. vpw -x cobol2v.vdm cobol.cop -a myfile.lay -u dbase ishort cc=17
  1010. r=114,DBASE-III // Input reclen, emit DBASE-3 records
  1011. // * ************************************************* 000100
  1012. // * * 000110
  1013. // * SAMPLE COPY-BOOK * 000120
  1014. // * * 000130
  1015. // * RECSIZE = 114 BYTES * 000140
  1016. // * * 000150
  1017. // * ************************************************* 000160
  1018. // 000170
  1019. // 01 SAMPLE-REC. 000180
  1020. // 03 SA-KEY. 000190
  1021. e 1,7 // 2 F1 10 SA-KEY-ALPHA PIC X(7). 000200
  1022. u 8,9 // 9 F2 10 SA-KEY-NUMERIC PIC 9(2). 000250
  1023. d 10,14 u v2 // 11 F3 03 SA-PAC-DEC-1 PIC 9(7)V99 COMP-3. 000300
  1024. e 15,19 // 21 F4 03 FILLER PIC X(5). 000350
  1025. d 20,21 u // 26 F5 03 SA-PAC-DEC-2 PIC 999 COMP-3. 000400
  1026. d 22,23 // 29 F6 03 SA-PAC-DEC-3 PIC S9(3) COMP-3. 000450
  1027. e 24,29 // 33 F7 03 FILLER PIC X(6). 000500
  1028. b 30,33,=9; // 39 F8 03 SA-SIGNED-BINARY PIC S9(9) COMP. 000550
  1029. e 34,41 // 49 F9 03 FILLER PIC X(8). 000600
  1030. z 42,46 // 57 F10 03 SA-ZONED-DECIMAL PIC S9(5). 000650
  1031. e 47,50 // 63 F11 03 FILLER PIC X(4). 000700
  1032. u 51,55 // 67 F12 03 SA-ANOTHER-NUMERIC PIC 9(5). 000750
  1033. l 56,59,=7; v2 // 72 F13 03 SA-FLOAT PIC S9(5)V99 COMP-1. 000800
  1034. l 60,67,=12; v2 // 81 F14 03 SA-DOUBLE PIC S9(10)V99 COMP-2. 000850
  1035. e 68,114 // 95 F15 03 FILLER PIC X(47). 000900
  1036. // 141 (RecLen)
  1037. Notice the location of the DBASE names. Names are limited to 10 characters;
  1038. they must begin with a letter and consist only of letters and digits. The
  1039. letter 'F', above, stands for "field".
  1040. Also, notice that the first output field starts in column 2. This is due
  1041. to the initial DBASE "deleted-record" field which contains an asterisk to
  1042. denote a deleted record or is blank otherwise.
  1043. The purpose of the ISHORT parameter is to produce a uniform 11-character-
  1044. plus-one-space name field that the user can then easily overwrite with the
  1045. desired names. (This field was trimmed above for display purposes). If auto
  1046. generated names are acceptable, this name field is unnecessary. Further, the
  1047. field can be optionally produced later by RELAY.VDM; but, since inactive lines
  1048. are not adjusted, the commented-out copy-book becomes misaligned.
  1049. After editing the DBASE names, it is necessary to run RELAY.VDM to produce a
  1050. .XRF file containing the names. E.g., continuing the above example,
  1051. vpw -x relay.vdm myfile.lay
  1052. produces the file MYFILE.XRF as well as adjusting output column numbers for
  1053. any changes made to the .LAY file.
  1054. To instruct EBCDIC-T.VDM to use MYFILE.XRF, include "xrf=1" or "xrf=on"
  1055. in the .LAY file. Thus, a fully edited .LAY file might begin:
  1056. //
  1057. // MYFILE.LAY - Sample data layout file for converting EBCDIC files with
  1058. // packed fields into ASCII, output into DBASE style records.
  1059. // Produced from COBOL.COP.
  1060. //
  1061. r=114,DBASE-III // Input reclen, emit DBASE-3 records
  1062. e=0,ebcdic.err // Only report serious errors in EBCDIC.ERR
  1063. o=z,b2z // Output leading zeros (blank '+' sign; sign at end)
  1064. // Convert all-blank/null numeric fields to zeros
  1065. xrf=on // <----- Necessary to force use of .XRF file with explicit field names
  1066. // Otherwise, field names will be auto-generated.
  1067. //
  1068. // * ***************************************** 000100
  1069. // * * 000110
  1070. // * SAMPLE COPY-BOOK * 000120
  1071. // * * 000130
  1072. // * RECSIZE = 114 BYTES * 000140
  1073. // * * 000150
  1074. // * ***************************************** 000160
  1075. // 000170
  1076. // 01 SAMPLE-REC. 000180
  1077. // 03 SA-KEY. 000190
  1078. e 1,7 // 2 KEYNAME 10 SA-KEY-ALPHA PIC X(7). 000200
  1079. u 8,9 // 9 KEYNUM 10 SA-KEY-NUMERIC PIC 9(2). 000250
  1080. ...
  1081. Using the RELAY.VDM Macro
  1082. -------------------------
  1083. When an EBCDIC file with packed fields is converted into an ASCII file, the
  1084. records are longer in the ASCII file and the fields do not start in the same
  1085. column as in the EBCDIC file.
  1086. The supplied RELAY.VDM macro calculates the (ASCII) output column number for
  1087. each field in a .LAY file and adds the output column number to the .LAY file
  1088. in the comment field. When the DBASE option is selected, it also generates a
  1089. .XRF file containing user supplied field names. See topics "Options for
  1090. RELAY.VDM" and "RELAY.VDM and DBASE Output", below.
  1091. The ASCII output column numbers are very useful for viewing the ASCII file
  1092. and for creating a database "import filter". For example, consider the sample
  1093. .LAY from above:
  1094. r=114,0 //Record length is 114, convert to DOS newlines
  1095. o=z,b2z //Output leading zeros (blank '+' sign; sign at end)
  1096. //Convert all-blank/null numeric fields to zeros
  1097. e=0,ebcdic.err //Only report serious errors in EBCDIC.ERR
  1098. d 10-14 u v2 //Packed-decimal (no sign, explicit decimal point)
  1099. d 20-21 u //Packed-decimal (no sign)
  1100. d 22-23 //Packed-decimal
  1101. b 30-33,=9; //Packed-binary (9 digits; default is 8)
  1102. z 42-46 //Zoned number (5 digits plus sign)
  1103. u 51-55 //Unsigned number; want leading blanks converted to zeros
  1104. //(o=b2z); otherwise redundant
  1105. l 56-59,=7; v2 //Short (single precision) floating point; upto 7 digits
  1106. // with two past a decimal point
  1107. l 60-67,=12; v2 //Long (double precision) floating point; upto 12 digits,
  1108. // 2 fractional
  1109. RELAY.VDM changes the sample .LAY file above to:
  1110. r=114,0 //Record length is 114, convert to DOS newlines
  1111. o=z,b2z //Output leading zeros (blank '+' sign; sign at end)
  1112. //Convert all-blank/null numeric fields to zeros
  1113. e=0,ebcdic.err //Only report serious errors in EBCDIC.ERR
  1114. d 10-14 u v2 // 10 Packed-decimal (no sign, explicit decimal point)
  1115. d 20-21 u // 25 Packed-decimal (no sign)
  1116. d 22-23 // 28 Packed-decimal
  1117. b 30-33,=9; // 38 Packed-binary (9 digits; default is 8)
  1118. z 42-46 // 56 Zoned number (5 digits plus sign)
  1119. u 51-55 // 66 Unsigned number; want leading blanks converted to zeros
  1120. //(o=b2z); otherwise redundant
  1121. l 56-59,=7; v2 // 71 Short (single precision) floating point; upto 7 digits
  1122. // with two past a decimal point
  1123. l 60-67,=12; v2 // 80 Long (double precision) floating point; upto 12 digits,
  1124. // 2 fractional
  1125. // 93 (RecLen)
  1126. The RELAY.VDM macro is used by COBOL2V.VDM but may be run stand-alone on any
  1127. .LAY file:
  1128. c:\vedit\vpw -x relay.vdm layout.lay
  1129. RELAY.VDM handles numeric output options, taking into account the signed or
  1130. unsigned option, explicit decimal points, maximum # digits to be ouput, field
  1131. padding options, the "quoted-comma-delimited" command "qcd", any user
  1132. specified output field delimiter string, e.g. "v=Reg_Set(XDREG,/ | /)" and
  1133. the DBASE output option (regarding which, see below). Use this macro any time
  1134. a substantive change is made to the layout file.
  1135. Options for RELAY.VDM
  1136. ---------------------
  1137. RELAY.VDM now supports options on its invocation command line:
  1138. c:\vedit\vpw -x relay.vdm layout.lay -u option_list
  1139. where option_list is any sequence of the following, blank separated:
  1140. DOS UNIX MAC DBASE
  1141. cc=col_num
  1142. INSERT OVERWRITE
  1143. DETAB RETAB
  1144. ISHORT OSHORT
  1145. CONVERT
  1146. NOXREF
  1147. NOD
  1148. The options from the first line cause the "r=reclen" line to be
  1149. edited to form:
  1150. r=reclen,0 // DOS
  1151. r=reclen,1 // UNIX
  1152. r=reclen,2 // MAC
  1153. r=reclen,DBASE-III // DBASE
  1154. respectively. The default is to use the "r=reclen" line "as is".
  1155. Output column numbers are affected by the presence or absence of
  1156. DBASE on the "r=reclen" line. Also, see "RELAY.VDM and DBASE Output",
  1157. below.
  1158. Specifying "col_num" via the "cc=col_num" option sets the start of the
  1159. comment fields to the specified column.
  1160. Ordinarily, when run "stand alone", output-column-numbers overwrite the
  1161. first several columns past the comment indicators. Use the "INSERT"
  1162. option to insert the column numbers instead of ovewriting.
  1163. RELAY.VDM detabs the .LAY file when it begins. It again detabs the file
  1164. when finished, unless more than 6 tabs were present in the source file.
  1165. Use one of DETAB, to force, or RETAB, to prevent, the second detabbing.
  1166. CONVERT forces RELAY.VDM to change any "+len" field specifications into
  1167. the standard "begin_col,end_col" format.
  1168. NOXREF prevents RELAY.VDM from generating/overwriting any .xrf file
  1169. when the DBASE option is present whether specified by the"-u DBASE"
  1170. option or by the "r=len,DBASE-III" line in the .lay file.
  1171. NOD forces RELAY.VDM to ignore the presence of any explicit decimal
  1172. point "vn" option on any field specification.
  1173. RELAY.VDM and DBASE Output
  1174. --------------------------
  1175. Even when DBASE style output is wanted eventually, it may be desirable,
  1176. while producing the .LAY specifications, to output normal line termination
  1177. characters for easier viewing. To later convert the .LAY file for DBASE
  1178. output, just run RELAY.VDM with the "-u DBASE" option:
  1179. vpw -x relay.vdm myfile.lay -a mydbf.lay -u DBASE
  1180. or
  1181. copy myfile.lay myfile.sav
  1182. vpw -x relay.vdm myfile.lay -u DBASE
  1183. This will edit the "r=reclen" specification to include the DBASE-III output
  1184. parameter and update the ASCII output column numbers to reflect the
  1185. DBASE initial "record-deleted" field. For example:
  1186. r=114,DBASE-III // Input reclen, emit DOS newlines
  1187. ...
  1188. e 1,7 // 2 10 SA-KEY-ALPHA PIC X(7). 000200
  1189. ...
  1190. // 132 (RecLen)
  1191. The (unedited) comment in the "r=" specification is now incorrect.
  1192. The first ASCII output field starts in column 2 because of the DBASE
  1193. "deleted-field" column.
  1194. Alternatively, one could edit the .LAY file, replacing ",0" with ",DBASE-III"
  1195. and then run RELAY.VDM to update the ASCII output column numbers:
  1196. vpw -x relay.vdm myfile.lay
  1197. If explicit DBASE field names are desired, you might want to use the
  1198. "ISHORT" parameter:
  1199. vpw -x relay.vdm myfile.lay -u dbase ishort
  1200. This will generate short names for each field in a uniform 12 space field.
  1201. One can then overwrite the names with the desired explicit field names.
  1202. You must also include the "xrf=on" or "xrf=1" specification in the .LAY
  1203. file. When finished creating the short names, it is necessary to run
  1204. RELAY.VDM again to generate a .XRF file containing the explicit names:
  1205. copy myfile.lay myfile.sav // Be safe!
  1206. vpw -x relay.vdm myfile.lay
  1207. (Notice the absence of the "-u" parameter).
  1208. The pertinent lines from the .LAY file are shown below. See "COBOL2V.VDM
  1209. and DBASE Output", above, for a more complete example.
  1210. r=114,DBASE-III // Input reclen, emit DBASE-3 records
  1211. xrf=on // <----- Necessary to force use of .XRF file with explicit field names
  1212. // Otherwise, field names will be auto-generated.
  1213. // Also, RELAY.VDM must have been run to generate the .XRF file
  1214. e 1,7 // 2 KEYNAME 10 SA-KEY-ALPHA PIC X(7). 000200
  1215. u 8,9 // 9 KEYNUM 10 SA-KEY-NUMERIC PIC 9(2). 000250
  1216. ...
  1217. Note: "ISHORT" inserts; whereas, "OSHORT" overstrikes.
  1218. Custom Field Conversion
  1219. -----------------------
  1220. The layout file can specify the field type of "c" to convert a field using a
  1221. custom VEDIT macro. This topic is complex and specialized; only an overview
  1222. is given here.
  1223. Custom conversion fields don't necessarily have anything to do with EBCDIC.
  1224. They could be used to clean up a file which has already been converted to
  1225. ASCII, or even to convert a file which was exported from a Window/DOS
  1226. database or spreadsheet program. For example, it could be used to create
  1227. a file with quoted and comma-delimited fields.
  1228. The supplied custom macro LEADZERO.CUS converts unpacked EBCDIC numbers to
  1229. ASCII and then strips any leading zeroes. It optionally inserts a period
  1230. before the second last or third last digit.
  1231. When specifying custom fields, the name of the custom macro must also be
  1232. specified. For example, the following lines in the layout file use
  1233. LEADZERO.CUS to convert one field:
  1234. v=Reg_Load(EBC_Settings(CustomMacro),'leadzero.cus')
  1235. c 15,19 :2 //Insert "." before last 2 digits
  1236. The ":2" is an option that can be passed to the custom macro. Its meaning
  1237. will depend upon the particular custom macro.
  1238. To enable RELAY.VDM to properly generate ASCII output columns for each field
  1239. into the comment field of the .LAY file, any "inflation" must be indicated
  1240. using the "i=inflation;" option. E.g.,
  1241. c 15,19 i=1; :2 // Inserting '.' before the last 2 digits inflates
  1242. // the output by one column.
  1243. If any custom field is encountered in the .LAY file during preprocessing,
  1244. the file "EBCDIC-2.VCM" is loaded. This contains code to process the
  1245. standard fields. Thus, if under certain conditions, a field is to be
  1246. treated specially, the custom code can process it, but otherwise just
  1247. pass the field along. To do this, just "call('code_letter'-32). E.g.,
  1248. if the custom macro wishes to simply unpack a packed decimal field with
  1249. standard options: "call('d'-32)".
  1250. Both standard and custom options are available to the custom macro.
  1251. The syntax for the custom field in the .LAY file is:
  1252. c colspec [sop] [i=inflation;] [#r] [:cusops] [// comments]
  1253. where "sop" are the standard options for any field; "i=inflation" has been
  1254. discussed above; "r" is the text register containing the custom macro
  1255. (default is EBC_Settings(CustomMacro) which is Text_Register 12 unless
  1256. the conversion is being performed under WILDFILE.VDM or WILDFWIZ.VDM).
  1257. To access the custom parameters, switch to the .LAY buffer; CurPos will be
  1258. just past the ":". E.g.,
  1259. Buf_Switch(XLAY)
  1260. process custom parameters starting at CurPos.
  1261. Buf_Switch(XDATA)
  1262. process XInpFieldSize data bytes starting at CurPos.
  1263. The custom macro must completely process the specified bytes, leaving CurPos
  1264. at the start of the next data field.
  1265. Users who need custom conversions and are very familiar with the VEDIT macro
  1266. language can use LEADZERO.CUS as a template for creating their own custom
  1267. macros. LEADZERO.CUS and EBCDIC-T.VDM contain internal (terse) documentation
  1268. on how custom macros work.
  1269. However, users may want to contract us to write any needed custom macros.
  1270. Contact Greenview Data, Inc
  1271. ---------------------------
  1272. Sales: 1-800-458-3348 sales@vedit.com
  1273. Tech support: (734) 996-1300 support@vedit.com
  1274. Fax: (734) 996-1308
  1275. Website: www.vedit.com
  1276. Greenview Data, Inc.
  1277. PO Box 1586
  1278. Ann Arbor, MI 48106