Trading InfoSuccessful VS/PC exchanges require knowing your files inside and out |
|
From "VS Workshop", Access to Wang, December 1991 |
|
[ Prior Article ] [ Return to the Catalog of articles ] [ Next Article ] |
A large number of VS users have found it helpful - sometimes even vital - to move information between VS and PC applications. Yet many Wang users do not understand how the internal file structures of the two systems compare and, therefore, do not make maximum use of the informational exchange. Without the time to experiment, they often settle for less-than-ideal solutions rather than wrestling the problem to the ground.
As one who views information exchange between unlike systems as the ultimate hacking challenge, I have pursued opportunities to exchange formats whenever there was need. The result of this experimentation has been a greater appreciation of exchange issues and the ability to better meet the requirements of new system conversions as they occur.
This month we can bring the file transfer laboratory to your shop. The only prerequisites are some sort of file transfer software, a number of VS and PC files of all types to use for tests, and an interest in the physical and logical properties of files. The file transfers can be performed by any transfer software, including 2110 emulation software or products that make use of a Wang WLOC (Wang Local Office Connection) terminal emulation board in a PC.
First, some file lexicon is in order. The definition of a text file is probably one of the most debated terms in this profession. As used here, a text file is a consecutive file with records delimited by LINE FEED/CARRIAGE RETURN combinations. The text itself must be displayable characters normally found on a typewriter keyboard (e.g. above X'1F and below X'7F) plus a handful of control characters. Valid control characters include FORM FEED (X'0C), LINE FEED (X'0D), CARRIAGE RETURN (X'0A), TAB (X'09), and END OF FILE (X'1A).
File access methods are the means available to access field information. Sequential files on either system can be accessed in record order or randomly by record number. Sequential or random access by a field value is supported by indexed and alternate-indexed files on the VS. There is no direct equivalent in the PC world; instead, a number of indexed file access methods are supported by specific languages, compilers, and data base systems. Meaningful exchange of indexed information requires programming effort at either or both ends to convert the field data to a common format (typically text) and provide the indexed fields separately.
Proper file exchange depends on an understanding of the physical and logical characteristics of the VS and PC environments. File characteristics can be grouped into three categories: Physical, Logical, and Other.
Physical characteristics are the dimensions of the file, including the following:
Record delimiter: In VS files the record size (length) specified in the FDR determines the size of each record and, therefore, its end. In PC files, records are terminated (delimited) by hex characters - typically a LINE FEED/CARRIAGE RETURN combination (X'0D0A). Note that PC files may have other delimiters (example: CARRIAGE RETURN/LINE FEED) or no record delimiter at all (stream files).
File delimiter: The physical end of the file. Again, this information is carried in the FDR of VS files in the form of a record count. PC file directories store the total byte count of the file, which does not translate directly to record counts due to the variable length of PC text records. PC files may also make use of a END OF FILE indicator - typically X'1A. Note that an approximate record count is always necessary when creating VS files due to the need to set the file's allocation of disk space; this is not an issue for PCs since PC directories allocate file space as needed.
Logical characteristics refer to internal record structure and its use. These parameters include:
File type: The eight VS file types (consecutive, print, log, relative, indexed, alternate-indexed, program, and word processing) each define a set of predictable attributes of the file and its use. While there are no file types on PC systems, file naming conventions usually indicate the internal characteristics of the file.
Record type: VS files may be fixed, variable-length, or compressed. PC files may be in archived format (described in this column last July) but otherwise have no record type. VS record types are extracted to their full lengths transparently by the operating system and have no bearing on transfers to the PC; however, transfers in the other direction require knowledge of the appropriate record type for VS applications to function correctly.
Field delimiter: VS files usually depend on an external definition of field locations and types, such as a COBOL FD statement, a CONTROL file, or other means. PC files are also typically defined externally, but many PC applications can also use field delimiters to define field areas. The most popular delimited format uses double quotes and commas; files constructed using these field limits can be used directly by most PC spreadsheets and data bases. Producing delimited files on the VS requires programming effort. (For further information on this process, see "Number Crunching: Transfer VS files to PC spreadsheets", Access to Wang, May 1989, p. 13.)
Field types: Both VS and PC files can contain text information and various forms of signed numerics. Text fields are stored in a similar manner in both systems; the manner in which numeric information is retained differs widely. The most viable means of exchanging numeric information is through display data types; that is, those composed of normal text and numbers with leading signs and explicit decimal points.
Image files: Most file transfer software offers a means of retaining the exact format (image) of PC or VS files on the destination system. These files cannot be used directly on the foreign system; their use is restricted to backup or additional storage capacity.
Other VS file characteristics include create date, modification date, expiration date, file class, Access Control List information, physical disk location, and special access privileges. Other PC file characteristics include create date, create time, physical locations, and file attributes (system, hidden, archive, read only). These parameters are of little interest in file transfers except where they might inhibit access.
The VS file type determines the method used in transferring files to the PC. Some possible approaches include the following:
Consecutive, Log, and Relative files: All of these file types have a sequential organization that is similar to PC text files. Consecutive files and log files differ only in the manner that they were created (e.g. opened OUTPUT versus SHARED); relative files can be accessed randomly by record number, like PC files. The VS record length must be translated to PC line delimiters - typically a LINE FEED/CARRIAGE RETURN combination (e.g. X'0D0A).
Print files: VS print files have a sequential organization and are variable in length, like PC text files. They contain printer control information at the start of each record that advances lines or pages and controls some font attributes. This control information must be translated to the form feed characters and line feeds required by PC files. With some file transfer software you may also convert VS print files to text files without the printer control information.
Indexed, Alternate-Indexed: As described above, the indexed access methods supported directly by the VS operating system are application-specific in the PC world. Conversion of index information is possible using PC programs to rewrite text files supplied by the VS.
Word Processing: VS Word Processing files can be converted to PC text files or to PC document formats. The conversion can be performed using COPYWP or COPYPLUS (for text files) or through purchased document conversion utilities.
Program: VS object files have no direct use on the PC. Image files might be retained in PC format for storage or distribution purposes.
Because PC files do not have many external clues as to their format, transferring PC files to the VS requires careful use of file naming conventions and a greater understanding of the internal contents of the file. Some practical uses include:
Spreadsheet and data base files: Records should be saved as text, print image, or delimited files for transfer to the VS as text files. Some programming may be required on the VS side to separate the data into fields. Due to the variable nature of delimited files, the VS file size should be set high and compression used to reduce the impact to file allocations. The number of rows - if known - could be used for the initial estimate of record count.
Text files: Most text files can be transferred directly to the VS as consecutive files. Since the VS requires a file size, the contents of the records must be known prior to the transfer. The presence of printer control information (form feed, etc.) dictates that a VS print file should be the designated output format.
Word processing files: Document conversion software, if available, may be used to retain formatting information. Many PC word processors can also save files in text form; this can be converted (crudely) into WP using the COPYWP or COPYPLUS utilities. For the truly adventurous it is also possible to write conversion software using COPYWP and the IMAGE file type; consult the Media, Transfer, and Device Utilities Reference (715-1716) for details.
Any other PC file: All other PC files may be stored on the VS in image format for backup or distribution purposes.
Other issues in file exchange with PCs include the use of the tab character (X'09) to replace leading spaces in PC files, the presence of trailing spaces in VS files, and end-of-file markers in PC files. Some PC programs use tabs to replace leading characters and reduce the size of files. Normally these tabs are set at increments of eight characters - an ASCII standard. VS files are also expanded to their maximum length during a READ operation, possibly introducing trailing space characters in the PC output. Finally, there appears to be a division of opinion in the PC world whether the MS-DOS END OF FILE marker should be used. Better file transfer software gives you control of all of these factors. (For a utility to remove trailing spaces, see "To Any Length", Access to Wang, October 1989, p. 45.)
Obviously, there is a large amount of information that must be exchanged about the format of unlike files to make effective use of data in both environments. Please share any ideas you have for making this process more reliable.
Copyright © 1991 Dennis S. Barnes
Reprints of this article are permitted without notification
if the source of the information is clearly identified