Natural for OpenVMS Version 6.3.12 for OpenVMS
 —  Statements  —

CLOSE PC FILE

CLOSE

PC

[FILE] work-file-number
WORK

This document covers the following topics:

For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.

Related Statements: DOWNLOAD PC FILE | UPLOAD PC FILE

Belongs to Function Group: Control of Work Files / PC Files


Function

The statement CLOSE PC FILE is used to close a specific PC work file. It allows you to explicitly specify in a program that a PC work file is to be closed.

A work file is also closed automatically when command mode is reached.

See also the Natural Connection and Entire Connection documentation.

Top of page

Syntax Description

Syntax Element Description
work-file-number

The work-file-number is the number of the PC work file to be closed.

This number must correspond to one of the work file numbers for the PC as defined to Natural.

Top of page

Example

The following program demonstrates the use of the CLOSE PC FILE statement.

** Example 'PCCLEX1': CLOSE PC FILE                                     
**                                                                      
** NOTE: Example requires that Natural Connection is installed.         
************************************************************************
DEFINE DATA LOCAL                                                       
01 W-DAT   (A40)                                                        
01 REC-NUM (N3)                                                         
01 I       (P3)                                                         
END-DEFINE                                                              
*                                                                       
REPEAT                                                                  
UPLOAD PC FILE 7 ONCE W-DAT                /* Data upload   
  AT END OF FILE                                                        
    ESCAPE BOTTOM                                                       
  END-ENDFILE                                                           
  INPUT 'Processing file' W-DAT (AD=O)                                  
    /   'Enter record number to display' REC-NUM                        
  IF REC-NUM = 0                                                        
    STOP                                                                
  END-IF                                                       
  FOR I = 1 TO REC-NUM                                         
    UPLOAD PC FILE 7 ONCE W-DAT                                
    AT END OF FILE                                             
      WRITE 'Max. record number reached, last record is'       
      ESCAPE BOTTOM                                            
    END-ENDFILE                                                
  END-FOR                                                      
  I := I - 1                                                   
  WRITE 'Record' I ':' W-DAT                                     
CLOSE PC FILE 7                            /* Close PC file 7
END-REPEAT                                                     
END                                                           

Output of Program PCCLEX1:

When you run the program, a window appears in which you specify the name of the PC file from which the data is to be uploaded. The data is then uploaded from the PC. At the end of each loop, the PC file is closed.

Top of page