Skip to main content

Problem:

Ths is a package of three minimal programs for conversion of line sequential files

Resolution:

BUILD W/RELEASE:     Any Micro Focus Cobol product for Unix.

                                    line2win is not usable in Windows.

                                    rec2line and line2rec may be used with any version of NetExpress

                                       as well as any version of Server Express.

INTRODUCTION

==========

This is a package of three minimal programs for conversion of line sequential files:

- line2rec converts a line sequential file to record sequential.

- rec2line converts a record sequential file to line sequential.

- line2win converts a Unix line sequential file to Windows format.

line2rec and rec2line demonstrate internal FCD access as  documented in manual File Handling.

SOURCE FILES:

==========

Program Files      Description

----------------      -----------------------------------------------------------

line2rec.cbl         Source of line2rec.

rec2line.cbl         Source of rec2line.

line2win.cbl         Source of line2win.

Copy Files:

----------------     -----------------------------------------------------------

$COBDIR/cpylib/XFHFCD.cpy is used by line2rec and rec2line.

REQUIREMENTS:

==========

For line2rec and rec2line, the user must know the record length of the record sequential file, whether it is input (rec2line) or output (line2rec).

If either of the above programs is compiled with NetExpress, one source change is necessary:

"$COBDIR/cpylib/XFHFCD.cpy" must be changed to: "%COBDIR%/cpylib/XFHFCD.cpy"

For line2win, the operating system must be Unix.

OPERATION:

========

All programs:

- Compile each to executable.

- Run each from a command prompt. Command line must contain required parameters documented below.

line2win:  Operating system must be Unix.  Program will  compile and run in Windows, but the output file will not be a valid line sequential file. COBSW environment variable must contain "-N" in its value.

Usage:  line2win infile outfile

   

Where infile is a Unix-style text file, output file outfile will be a Windows-style text file.

Unix text files delimit end of line with X'0A'. Windows text files delimit end of line with X'0D0A'. line2win appends X'0D' to line and lets the file handler append X'0A', as always occurs with line sequential files.

rec2line and line2rec:  

Usage: rec2line reclen infile outfile

            line2rec reclen infile outfile

Where reclen is the numeric length, in bytes, of the record sequential file.  infile is the name of the input file. outfile is the name of the output file.

Example:  line2rec 80 lseqinput rseqoutput

Infile will be converted to outfile format.

Animate either program to observe access to and use of File Control Descriptor (FCD) which is the implementation structure of each FD declared in Data Division, File Section.   

REFERENCES

========

Manual File Handling, chapter File Handler API.

==========================================================

Keywords: Example, sample, demo, demonstration, UNIX, seqfiles.zip

demo.ex

demo.ne

demo.se

Attachments:

Seqfiles.zip

Old KB# 3688