Piping can be used for files declared as:
a) a printer file (ASSIGN TO PRINTER)
b) a line sequential file (assuming to compile with -flsu)
In all other cases (relative file, binary sequential file etc) piping it is not allowed.
Here a simple program:
program-id. pipe.
environment division.
input-output section.
file-control.
select my-file assign to printer '-p sh -c cat>pipe.txt'.
data division.
file section.
fd my-file.
01 my-rec pic x(60).
procedure division.
main.
open output my-file.
write my-rec from "abcdefghijk".
write my-rec from "01234567890"
close my-file.
Some hints:
open output my-file.
write my-rec from "abcdefghijk" NO CONTROL.
write my-rec from "01234567890" NO CONTROL.
close my-file.
open output my-file.
write my-rec from "abcdefghijk" NO CONVERSION.
write my-rec from "01234567890" NO CONVERSION.
close my-file.
select my-file assign to printer '+p sh -c cat>pipe.txt'.
Article ID: 219
Created: November 21, 2013
Last Updated: February 28, 2024
Author: Support KB Author
Online URL: https://support.veryant.com/phpkb/article.php?id=219