Problem:
We are writing an output file that is a Record Sequential data file. We need to convert it to a Line Sequential file. Can this be doen from a Cobol program?
Resolution:
Yes. Reference the following example:
Identification Division.
Program-Id. LORINCE.
* Converts Record Sequential to Line Sequential
* via PRINTER keyword in ASSIGN clause
Environment Division.
Input-Output Section.
File-Control.
Select Out1 Assign to Printer 'RS2LS.Dat'.
* Select Out1 Assign to 'RS2LS.Dat'.
Data Division.
File Section.
Fd Out1
Recording Mode is F.
1 Fd1.
2 Key1 Pic 9(10).
2 Pic X(30).
Working-Storage Section.
1 Ws1.
2 Wskey Pic 9(10).
2 Wsdata Pic X(30).
1 Ctr Pic 9(2).
Procedure Division.
P1.
Initialize Ws1
Open Output Out1
Perform Varying Ctr From 1 by 1 Until Ctr > 10
Add 1 to Wskey
Move All 'A' to Wsdata
Write Fd1 From Ws1
End-Perform
Close Out1
Stop Run.
