Using the Command Line Application Program Interface

You can invoke any of the command line interface options from within a COBOL program by executing the following code. Other programming languages, such as C, can be used to invoke the command line as well.

IDENTIFICATION DIVISION. 
PROGRAM-ID. TESTCLIX. 
ENVIRONMENT DIVISION. 
CONFIGURATION SECTION. 
SOURCE-COMPUTER.   IBM-PC. 
OBJECT-COMPUTER.   IBM-PC. 
DATA DIVISION. 
WORKING-STORAGE SECTION. 
01 RESULT          PIC X      COMP-X. 
01 FUNC            PIC X      COMP-X VALUE 35. 
01 COMMAND. 
   05 LEN          PIC X      COMP-X VALUE 10. 
   05 PGM          PIC X(10) VALUE 'MFDAS.EXE'. 
PROCEDURE DIVISION. 
   DISPLAY "DIR PDS CSI01.JPD.CNTL" UPON COMMAND-LINE 
   CALL X'91' USING RESULT FUNC COMMAND 
   IF RESULT = 0 
*>    EXECUTE SUCCESSFUL CODE HERE 
   END-IF

On return, Drag and Drop sets the COBOL RESULT variable. The following return-codes are produced:

00 Successful call
01 An error was returned from MFLSC
14 The program MFLSC is missing
15 Call to DFCONV failed
48 The mainframe member is locked by another user
49 A mainframe ABEND occurred
50 A dynamic allocation error occurred when accessing a data set
51 An open error occurred on the mainframe
52 An invalid request for a valid function was detected
53 An I/O error has occurred on a mainframe data set
54 An invalid sub-code was given to the mainframe
55 A load error on a program on the mainframe was detected
56 A length error, at a record level, has been detected
57 A general security error has been detected
58 A hash code mismatch has been detected
59 The remote execution failed
60 The JES spool file is not an output file
61 The JES spool file is not a held output file
100 Syntax error in call
125 Too many concurrent users are active
139 The record length was too large
218 The DCB is not supported. This is usually caused by trying to use RECFM=U
219 The mainframe load libraries are not APF authorized
220-241 Various SAF security return codes
242 The component in use has not been activated on the mainframe
243 Unable to write the specified file to the workstation
244 Unable to read the specified file from the workstation
245 The catalog search detected an error
246 The catalog search did not yield any results
247 The /F MFENDDRV* statement was not in FHREDIR.CFG
248 The /F MFLSCDRV* statement was not in FHREDIR.CFG
249 The file FHREDIR.CFG could not be located
250 A communications failure occurred
251 The file did not have a positive length
252 An invalid mask was given
253 The local access mask was not specified
254 The local access mode was not set
255 Invalid function was requested