Microsoft KB Archive/43265

COBOL 3.0: MS-DOS Redirection Allowed by ACCEPT FROM CONSOLE

PSS ID Number: Q43265 Article last modified on 04-20-1993

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

Summary: Only one implementation of the Microsoft COBOL Version 3.0 or 3.0a ACCEPT verb allows for MS-DOS redirection. The sample program below uses the ACCEPT FROM CONSOLE implementation that allows MS-DOS redirection.

More Information: MS-DOS redirection allows a program to use an input file to feed the program input and to use an output file that saves the program output. Code Example The input file contains a value for the field and a carriage return, such as the following: testit To invoke the program, the command line should appear as follows: PROG1 < INPUT.DAT > OUTPUT.DAT The OUTPUT.DAT file contains the output from running the program, such as the following: field1: the value entered for field1 is: testit * This is PROG1.COB ******* WORKING-STORAGE SECTION. 01 WS-ITEM PIC X(20). PROCEDURE DIVISION. DISPLAY “field1:” UPON CONSOLE. ACCEPT WS-ITEM FROM CONSOLE. DISPLAY “the value entered for field1 is:” UPON CONSOLE. DISPLAY WS-ITEM UPON CONSOLE. STOP RUN.

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.