UPLOAD PC FILE

Structured Mode Syntax

UPLOAD
READ

PC
WORK

[FILE] work-file-number  [ONCE]    

RECORD operand1

[AND] [SELECT]

OFFSET n
FILLER nX

operand2
[GIVING LENGTH operand3]
[AT [END] [OF] [FILE] statement END-ENDFILE]
statement
END-WORK

Reporting Mode Syntax

UPLOAD
READ

PC
WORK

[FILE] work-file-number  [ONCE]

RECORD {operand1 [FILLER nX]}

[AND] [SELECT]

OFFSET n
FILLER nX

operand2
[GIVING LENGTH operand3]

AT [END] [OF] [FILE]

statement
DO statement DOEND

statement
LOOP

This document covers the following topics:

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

Related Statements: CLOSE PC FILE | DOWNLOAD PC FILE | READ WORK FILE

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


Function

The UPLOAD PC FILE statement is used to transfer data from a PC to a UNIX platform.

See also:

Syntax Description

Operand Definition Table:

Operand Possible Structure Possible Formats Referencing Permitted Dynamic Definition
operand1   S A G   A U N P I F B D T L C yes yes
operand2   S A G   A U N P I F B D T L C yes yes
operand3   S               I             yes yes

When using the work file types ENTIRECONNECTION or TRANSFER, operand2 may not be of Format C.

Syntax Element Description:

Syntax Element Description
work-file-number
Work File Number:

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

operand1-2
Field Specification:

With operand1 and operand2 you specify the fields to be uploaded from the PC. The fields may be database fields or user-defined variables.

statement
Statement(s) to be Executed:

In place of statement, you must supply one or several suitable statements, depending on the situation.

No I/O statement may be placed with the UPLOAD PC FILE processing.

ONCE, SELECT, GIVING LENGTH

RECORD

Options:

For a description of the ONCE, SELECT, GIVING LENGTH options, refer to the corresponding sections in the description of the READ WORK FILE statement.

The RECORD option is not permitted for PC work files. It will be rejected at runtime.

When uploading data: If you wish to define a filler, you must use a dummy variable instead of the standard filler notation.

END-WORK
End of UPLOAD PC FILE Statement:

In structured mode, the Natural reserved keyword END-WORK must be used to end the UPLOAD PC FILE statement.

In reporting mode, the Natural statement LOOP is used to end the UPLOAD PC FILE statement.

LOOP

Example

The following program demonstrates the use of the UPLOAD PC FILE statement. The data is first uploaded from the PC and then processed on the UNIX platform.

** Example 'PCUPEX1': UPLOAD PC FILE                                    
**                                                                      
** NOTE: Example requires that Natural Connection is installed.         
** CAUTION: Executing this example will modify the database records!    
************************************************************************
DEFINE DATA LOCAL                                                       
01 EMPL VIEW OF EMPLOYEES                                               
   02 PERSONNEL-ID                                                      
   02 INCOME                                                            
      03 SALARY (1)                                                     
*                                                                       
01 #PID (A8)                                   /* Personnel ID on PC    
01 #NEW-INCREASE (N4)                          /* Increase for salary   
END-DEFINE                                                              
*                                                                       
UPLOAD PC FILE 7 #PID #NEW-INCREASE            /* Data upload        
*                                                                       
  FIND EMPL WITH PERSONNEL-ID = #PID           /* Data selection        
    ADD #NEW-INCREASE TO SALARY (1)            /* Data update on host   
    UPDATE         
    END TRANSACTION
    ESCAPE BOTTOM  
  END-FIND         
*                  
END-WORK           
END

Output of Program PCUPEX1:

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.