I have written the following code it reads the reords from file
breaks into respective variables the values appear in the host variables used to insert values in database it executes with maxcc zero but fails
data rows do not get insert into database sql code generated is
00000031j can anyone locate and explain the error
IDENTIFICATION DIVISION.
PROGRAM-ID. PROG30.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT IFILE ASSIGN TO DD1.
DATA DIVISION.
FILE SECTION.
FD IFILE.
01 IREC.
02 FID PIC X(4).
02 FILLER PIC X(2).
02 FNAME PIC X(10).
02 FILLER PIC X(3).
02 FSAL PIC X(4).
02 FILLER PIC X(57).
WORKING-STORAGE SECTION.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
01 DCLEMP.
10 EID PIC S9(4) USAGE COMP.
10 ENAME.
49 ENAME-LEN PIC S9(4) USAGE COMP.
49 ENAME-TEXT PIC X(10).
10 ESAL PIC S9(4) USAGE COMP.
77 TID PIC 9(4).
77 TNAME PIC A(10).
77 TSAL PIC 9(4).
77 EOF PIC X VALUE 'N'.
77 VAR1 PIC X(80).
PROCEDURE DIVISION.
OPEN INPUT IFILE.
READ IFILE.
MOVE IREC TO VAR1.
UNSTRING VAR1 DELIMITED BY ALL SPACE INTO TID, TNAME, TSAL.
MOVE TID TO EID.
MOVE TNAME TO ENAME.
MOVE TSAL TO ESAL.
DISPLAY "ENAME:", ENAME.
DISPLAY "EID: ", EID.
DISPLAY "ESAL:", ESAL.
EXEC SQL
INSERT INTO EMP VALUES ( :EID, :ENAME, :ESAL)
END-EXEC .
DISPLAY SQLCODE.
CLOSE IFILE.
STOP RUN.
PROGRAM-ID. PROG30.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT IFILE ASSIGN TO DD1.
DATA DIVISION.
FILE SECTION.
FD IFILE.
01 IREC.
02 FID PIC X(4).
02 FILLER PIC X(2).
02 FNAME PIC X(10).
02 FILLER PIC X(3).
02 FSAL PIC X(4).
02 FILLER PIC X(57).
WORKING-STORAGE SECTION.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
01 DCLEMP.
10 EID PIC S9(4) USAGE COMP.
10 ENAME.
49 ENAME-LEN PIC S9(4) USAGE COMP.
49 ENAME-TEXT PIC X(10).
10 ESAL PIC S9(4) USAGE COMP.
77 TID PIC 9(4).
77 TNAME PIC A(10).
77 TSAL PIC 9(4).
77 EOF PIC X VALUE 'N'.
77 VAR1 PIC X(80).
PROCEDURE DIVISION.
OPEN INPUT IFILE.
READ IFILE.
MOVE IREC TO VAR1.
UNSTRING VAR1 DELIMITED BY ALL SPACE INTO TID, TNAME, TSAL.
MOVE TID TO EID.
MOVE TNAME TO ENAME.
MOVE TSAL TO ESAL.
DISPLAY "ENAME:", ENAME.
DISPLAY "EID: ", EID.
DISPLAY "ESAL:", ESAL.
EXEC SQL
INSERT INTO EMP VALUES ( :EID, :ENAME, :ESAL)
END-EXEC .
DISPLAY SQLCODE.
CLOSE IFILE.
STOP RUN.
regards
Sibi Varghese