Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

6.2.1.1 Data Transfer




    ___ Format 1--Data Transfer ____________________________________________ 
   |                                                                        |
   | >>__ACCEPT__identifier-1__ ______________________________ __________>< |
   |                           |_FROM__ _mnemonic-name-1____ _|             |
   |                                   |_ environment-name _|               |
   |                                                                        |
   |________________________________________________________________________|
Format 1 transfers data from an input/output device into identifier-1. When the FROM phrase is omitted, the system input device is assumed.

Format 1 is useful for exceptional situations in a program when operator intervention (to supply a given message, code, or exception indicator) is required. The operator must, of course, be supplied with the appropriate messages with which to reply.

>_Workstation_> Under AIX, OS/2, and Windows, the input file must be a byte stream file (for example, a file consisting of text data with records delimited by a record terminator). You can create a byte stream file in
X your COBOL program using line sequential file I-O or with the DISPLAY statement. (Most text editors can be used to create a byte stream file as well.)

The input file cannot be a VSAM, Btrieve, SFS, or STL file (including sequential, relative, or indexed files).

If the source of the ACCEPT statement is a file and identifier-1 is filled without using the full record delimited by the record terminator, the remainder of the input record is used in the next ACCEPT statement for the file. The record delimiter characters are removed from the input data before the input records are moved into the ACCEPT receiving area.

If the source of the ACCEPT statement is a terminal, the data entered at the terminal, followed by the enter key, is treated as the input data. If the input data is shorter than identifier-1, the area is padded with spaces. <_Workstation_<

identifier-1
Can be any group item, or an elementary alphabetic, alphanumeric, alphanumeric-edited, numeric-edited or external decimal item.


X It can also be a DBCS data item or an external floating-point item.

mnemonic-name
Must be associated in the SPECIAL-NAMES paragraph with an input/output device: either a system input device or a console. For more information on acceptable values for mnemonic-name, see "SPECIAL-NAMES Paragraph" in topic 4.1.3.

  • System input device
    
    
    • Record length of 80 characters is assumed even if a logical record length of other than 80 characters is specified.
      
      
    • The system input device is read until identifier-1 is filled or EOF is encountered. If the length of identifier-1 is not an even multiple of the system input device record length, the final record will be truncated as required. If EOF is encountered after data has been moved, and before identifier-1 has been filled, identifier-1 is padded with blanks. If EOF is encountered before any data has been moved to identifier-1, padding will not take place and identifier-1 contents will remain unchanged. Each input record is concatenated with the previous input record.
      
      
    • If the input record is of the fixed-length format, the entire input record is used. No editing is performed to remove trailing or leading blanks.
      
      
    • >_Host_> Under OS/390 and VM, if the input record is of the variable-length format, the actual record length is used to determine the amount of data received. With variable format records, the Record Definition Word (RDW) is removed from the beginning of the input record. Only the actual input data is transferred to identifier-1. <_Host_<
      
      

  • Console
    
    
    >_Host_> Under OS/390 and VM:
    
    
    1. A system-generated message code is automatically displayed, followed by the literal AWAITING REPLY.
      
      
      The maximum length of an input message is 114 characters.
      
      
    2. Execution is suspended.
      
      
    3. After the message code (the same code as in item 1) is entered from the console and recognized by the system, ACCEPT statement execution is resumed. The message is moved to identifier-1 and left-justified, regardless of its PICTURE clause.
      
      
      The ACCEPT statement is terminated after any of the following occurs:
      
      
      • If no data is received from the console. For example, if the operator hits the ENTER key
        
        
      • The identifier is filled with data
        
        
      • Fewer than 114 characters of data are entered
        
        

      If 114 bytes of data are entered and the identifier is still not filled with data, then more requests for data are issued to the console.
      
      
      If more than 114 characters of data are entered, only the first 114 characters will be recognized by the system.
      
      
      If the identifier is longer than the incoming message, the rightmost characters are padded with spaces.
      
      
      If the incoming message is longer than the identifier, the character positions beyond the length of the identifier are truncated. <_Host_<
      
      

>_Workstation_> Under AIX, OS/2, and Windows: ACCEPT or DISPLAY with an environment name is directed to the destination based on the value of the environment variable corresponding to the COBOL environment name (SYSIN or CONSOLE).

If the environment variable corresponding to the COBOL environment name is not set, ACCEPT from SYSIN, SYSIPT, or CONSOLE is from the system logical input device (stdin) and DISPLAY on SYSOUT, SYSLIST, or SYSLST is to the system logical output device (stdout). DISPLAY to SYSPUNCH or SYSPCH is supported only if the environment variable for SYSPUNCH is set to a valid display target. <_Workstation_<


X environment-name

X A valid environment-name can be specified. See Table 8 in topic 4.1.3
X for a list of valid environment-names.


X >_Workstation_> Under AIX, OS/2, and Windows, ACCEPT (or DISPLAY) with
X an environment name is directed to the destination based on the
X assignment of the system target for the environment name via the
X environment variable assignment.


X If the environment variable is not set, the first three are directed
X to the system logic input device, the system logic output device, and
X the user terminal, respectively as determined by COBOL for the
X platform. (For example, CONSOLE would be stdin as the default.)
X DISPLAY to SYSPUNCH/SYSPCH fails unless you set the corresponding
X environment variable to indicate a valid target. The target file is
X determined by checking the COBOL environment-name (CONSOLE, SYSIN,
X SYSIPT, SYSOUT, SYSLIST, SYSLST, SYSPUNCH, and SYSPCH). If an
X environment variable is defined corresponding to the COBOL environment
X variable, the value of the environment variable is used as the system
X file identifier. For more information on environment-variables, see
X the IBM COBOL Programming Guide for your platform. <_Workstation_<


X Note: If the device is the same as that used for READ statements, results
X are unpredictable.

Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.