Progress0 of 0 lessons

CICS ACCEPT - Accept Input

CICS ACCEPT provides input acceptance capabilities for programs and transactions. It enables programs to accept user input, process input data, and handle input validation in CICS environments.

What is CICS ACCEPT?

CICS ACCEPT is a command that allows programs to accept input from users or other sources in the system. It provides input acceptance capabilities, input processing, and input validation for CICS applications.

Command Syntax

cobol
1
2
3
4
5
EXEC CICS ACCEPT [FROM(data-area)] [LENGTH(data-length)] [RESP(response-code)] END-EXEC

Parameters

Optional Parameters

  • FROM(data-area) - Data area to receive input
  • LENGTH(data-length) - Length of input data
  • RESP(response-code) - Response code variable

Input Types

Terminal Input

Terminal input types

  • 3270 TERMINALS - 3270 terminal input
  • 5250 TERMINALS - 5250 terminal input
  • VT100 TERMINALS - VT100 terminal input
  • ASCII TERMINALS - ASCII terminal input

File Input

File input types

  • SEQUENTIAL FILES - Sequential file input
  • VSAM FILES - VSAM file input
  • QSAM FILES - QSAM file input
  • BDAM FILES - BDAM file input

Network Input

Network input types

  • TCP/IP INPUT - TCP/IP network input
  • SNA INPUT - SNA network input
  • APPC INPUT - APPC network input
  • HTTP INPUT - HTTP network input

System Input

System input types

  • OPERATOR INPUT - Operator console input
  • BATCH INPUT - Batch job input
  • JCL INPUT - JCL input
  • PARAMETER INPUT - Parameter input

Programming Examples

Basic Input Acceptance

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
IDENTIFICATION DIVISION. PROGRAM-ID. ACCEPT01. DATA DIVISION. WORKING-STORAGE SECTION. 01 INPUT-DATA PIC X(80). 01 INPUT-LENGTH PIC S9(4) COMP. 01 RESPONSE-CODE PIC S9(8) COMP. PROCEDURE DIVISION. DISPLAY 'Accepting input from user' EXEC CICS ACCEPT FROM(INPUT-DATA) LENGTH(INPUT-LENGTH) RESP(RESPONSE-CODE) END-EXEC IF RESPONSE-CODE = DFHRESP(NORMAL) DISPLAY 'Input accepted successfully' DISPLAY 'Input data: ' INPUT-DATA DISPLAY 'Input length: ' INPUT-LENGTH ELSE DISPLAY 'Input acceptance failed' END-IF EXEC CICS RETURN END-EXEC.

Advanced Input Processing

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
IDENTIFICATION DIVISION. PROGRAM-ID. ACCEPT02. DATA DIVISION. WORKING-STORAGE SECTION. 01 INPUT-DATA PIC X(80). 01 INPUT-LENGTH PIC S9(4) COMP. 01 RESPONSE-CODE PIC S9(8) COMP. 01 INPUT-COUNT PIC S9(2) COMP VALUE 0. 01 MAX-INPUTS PIC S9(2) COMP VALUE 5. 01 INPUT-STATUS PIC X(1). 01 INPUT-LIST. 05 INPUT-ITEM OCCURS 5 TIMES. 10 INPUT-ID PIC X(8). 10 INPUT-DATA PIC X(80). 10 INPUT-LENGTH PIC S9(4) COMP. 10 INPUT-STATUS PIC X(1). PROCEDURE DIVISION. PERFORM INITIALIZE-INPUTS PERFORM ACCEPT-MULTIPLE-INPUTS EXEC CICS RETURN END-EXEC. INITIALIZE-INPUTS. MOVE 'INPUT001' TO INPUT-ID(1) MOVE 'INPUT002' TO INPUT-ID(2) MOVE 'INPUT003' TO INPUT-ID(3) MOVE 'INPUT004' TO INPUT-ID(4) MOVE 'INPUT005' TO INPUT-ID(5). ACCEPT-MULTIPLE-INPUTS. PERFORM VARYING INPUT-COUNT FROM 1 BY 1 UNTIL INPUT-COUNT > MAX-INPUTS PERFORM ACCEPT-SINGLE-INPUT IF RESPONSE-CODE = DFHRESP(NORMAL) MOVE INPUT-DATA TO INPUT-DATA(INPUT-COUNT) MOVE INPUT-LENGTH TO INPUT-LENGTH(INPUT-COUNT) MOVE 'A' TO INPUT-STATUS(INPUT-COUNT) DISPLAY 'Input ' INPUT-COUNT ' accepted successfully' ELSE MOVE 'F' TO INPUT-STATUS(INPUT-COUNT) DISPLAY 'Input ' INPUT-COUNT ' acceptance failed' END-IF END-PERFORM. ACCEPT-SINGLE-INPUT. EXEC CICS ACCEPT FROM(INPUT-DATA) LENGTH(INPUT-LENGTH) RESP(RESPONSE-CODE) END-EXEC.

Error Handling with Input Acceptance

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
IDENTIFICATION DIVISION. PROGRAM-ID. ACCEPT03. DATA DIVISION. WORKING-STORAGE SECTION. 01 INPUT-DATA PIC X(80). 01 INPUT-LENGTH PIC S9(4) COMP. 01 RESPONSE-CODE PIC S9(8) COMP. 01 RETRY-COUNT PIC S9(2) COMP VALUE 0. 01 MAX-RETRIES PIC S9(2) COMP VALUE 3. 01 INPUT-ACCEPT-SUCCESSFUL PIC X(1) VALUE 'N'. PROCEDURE DIVISION. PERFORM ACCEPT-INPUT-WITH-RETRY EXEC CICS RETURN END-EXEC. ACCEPT-INPUT-WITH-RETRY. PERFORM ACCEPT-INPUT IF RESPONSE-CODE NOT = DFHRESP(NORMAL) AND RETRY-COUNT < MAX-RETRIES ADD 1 TO RETRY-COUNT DISPLAY 'Retry ' RETRY-COUNT ' input acceptance operation' PERFORM ACCEPT-INPUT-WITH-RETRY END-IF. ACCEPT-INPUT. EXEC CICS ACCEPT FROM(INPUT-DATA) LENGTH(INPUT-LENGTH) RESP(RESPONSE-CODE) END-EXEC EVALUATE RESPONSE-CODE WHEN DFHRESP(NORMAL) MOVE 'Y' TO INPUT-ACCEPT-SUCCESSFUL DISPLAY 'Input acceptance operation successful' WHEN DFHRESP(NOTAUTH) DISPLAY 'Not authorized to accept input' WHEN DFHRESP(INVREQ) DISPLAY 'Invalid input acceptance request' WHEN DFHRESP(INPUTERR) DISPLAY 'Input acceptance error' WHEN DFHRESP(INPUTNOTFOUND) DISPLAY 'Input not found' WHEN DFHRESP(INPUTINUSE) DISPLAY 'Input is in use' WHEN OTHER DISPLAY 'Unexpected input acceptance error' END-EVALUATE.

Input Processing

Input Validation

  • Input Format Validation - Validate input format
  • Input Length Validation - Validate input length
  • Input Content Validation - Validate input content
  • Input Range Validation - Validate input range

Input Processing

  • Input Parsing - Parse input data
  • Input Conversion - Convert input data
  • Input Transformation - Transform input data
  • Input Storage - Store input data

Input Monitoring

  • Input Tracking - Track input usage
  • Input Auditing - Audit input operations
  • Input Reporting - Report input status
  • Input Analysis - Analyze input patterns

Input Error Recovery

  • Input Error Detection - Detect input errors
  • Input Error Recovery - Recover from input errors
  • Input Retry Mechanisms - Implement input retry logic
  • Input Fallback Procedures - Use input fallback procedures

Error Handling

Common Response Codes

  • DFHRESP(NORMAL) - Input acceptance operation successful
  • DFHRESP(NOTAUTH) - Not authorized to accept input
  • DFHRESP(INVREQ) - Invalid input acceptance request
  • DFHRESP(INPUTERR) - Input acceptance error
  • DFHRESP(INPUTNOTFOUND) - Input not found
  • DFHRESP(INPUTINUSE) - Input is in use

Performance Considerations

Input Efficiency

  • Optimize input operations - Use efficient input handling
  • Minimize input overhead - Reduce input processing overhead
  • Use input pooling - Implement input pooling
  • Monitor input frequency - Track input acceptance patterns

System Impact

  • Monitor system impact - Track how input acceptance affects the system
  • Optimize input handling - Ensure efficient input processing
  • Manage input usage - Monitor input consumption
  • Track performance metrics - Monitor input handling performance

Best Practices

Input Acceptance Best Practices

  • • Accept input only when input is needed
  • • Implement proper error handling for input operations
  • • Validate input data before processing
  • • Use appropriate input management techniques
  • • Monitor input acceptance activities and performance
  • • Maintain input acceptance audit trails
  • • Handle input acceptance errors gracefully

Explain It Like I'm 5 Years Old

Think of CICS ACCEPT like asking someone a question:

  • Ask Question: "What is your name?" - Accept input
  • Wait for Answer: "Wait for the answer" - Input processing
  • Get Answer: "My name is John" - Input data
  • Use Answer: "Thank you, John" - Input processing
  • Done: "You are done asking" - Input finished

Exercises

Exercise 1: Basic Input Acceptance

Create a program that accepts basic input from users.

Exercise 2: Advanced Input Processing

Write a program that processes multiple input acceptances.

Exercise 3: Error Handling

Implement comprehensive error handling for input acceptance failures.