| Introduction | MTB Statements | File System | Compiler | Applications | Reference Guide | Index |
| Language Structure | Data Division | I/O Format Division | Procedure Division | Mnemonics |
| Overview | Statement Summary | Common Parameters | Exception Handling |
In a foreground partition, lun 0 is opened (by the QMONITOR program) and assigned to the video screen. Thus luns 1 through 49 are available for data files, printers, spoolers, gateways, etc.
In a background partition, lun 0 is not opened by QMONITOR, as there is no video screen associated with a background partition.
Logical unit number assignments are concluded with the CLOSE statement.
| Example 1: |
PRINT (0) "HELLO WORLD"In this example, the message "HELLO WORLD" is displayed on logical unit number 0 (the video screen). |
| Example 2: |
OPEN (1) "LP1" . PRINT (1) "CUSTOMER MASTER LISTING" . CLOSE (1)In this example, logical unit number 1 is associated with the printer named LP1. This association is established with the OPEN statement, then used via the PRINT statement, and finally concluded with the CLOSE statement. |
| Example 3: |
1000 FORMAT CUSTNUM$;NAME$;ADDRESS$;CITY$;STATE$;ZIP$ OPEN (5) "CUSTFILE" . READ (5,1000) KEY=CUSTNUM$ . CLOSE (5)In this example, logical unit number 5 is associated with the data file named "CUSTFILE." This association is established with the OPEN statement, then used via the READ statement, and finally concluded with the CLOSE statement. |