Undocumented features
Command line arguments
When doing an ACCEPT, the first call will receive any arguments given to the program on the command line. If no arguments are given or the argument is shorter than the buffer, the rest will be filled with spaces.
This does not apply if CONSOLE IS CRT
is stated under SPECIAL-NAMES.
In that case an ACCEPT FROM CONSOLE
must be used.
Example: args.cbl
* Minimal program to test accept of arguments DATA DIVISION. WORKING-STORAGE SECTION. 01 BUFFER. 05 FILLER PIC X(10) VALUE "Argument:{". 05 ARGS PIC X(60). 05 FILLER PIC X VALUE "}". PROCEDURE DIVISION. ACCEPT ARGS. DISPLAY BUFFER. STOP RUN.
Compilation:
B>cobol args.cbl ** CIS COBOL V4.4 COPYRIGHT (C) 1978,1981 MICRO FOCUS LTD **COMPILING ARGS.CBL ** ERRORS=00000 DATA=00459 CODE=00181 DICT=00048:17603/17651 GSA FLAGS= OFF
Execution:
B>runa args.int This is a test Argument:{THIS IS A TEST } B>