View previous topic :: View next topic |
Author |
Message |
sri50131 Beginner
Joined: 07 Oct 2004 Posts: 38 Topics: 15
|
Posted: Thu Oct 07, 2004 9:42 am Post subject: Loading a cursor into a Cobol internal table |
|
|
Hello,
I need to dump the result of the cursor in my program into an interanl table? I have declared an internal table as follows:
01 TEMP-TBL.
05 WS-TEMP-TBL OCCURS 1000 TIMES INDEXED BY X1.
10 WS-COVERAGE PIC X(20).
10 WS-ENDORSEMENT PIC X(10).
The fetch statement is as follows:
EXEC SQL
FETCH ENDRSCURS
INTO :WS-COVERAGE
,:WS-ENDORSEMENT
END-EXEC.
Since the above to columns are part of the internal table, I have to use a subscript, but I cannot subscript in the Fetch. Can you please let me know how to do it?
Thanks. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
Posted: Thu Oct 07, 2004 9:57 am Post subject: |
|
|
sri50131,
Try this
Code: |
01 DB2-COVERAGE PIC X(20).
01 DB2-ENDORSEMENT PIC X(10)
01 S-EOF-CURSOR PIC X(01) VALUE 'N'
01 W-SUB PIC S9(09) COMP VALUE ZERO.
PERFORM 100-OPEN-CURSOR
PERFORM 200-FETCH-CURSOR
PERFORM 300-LOAD-INTERNAL-TABLE UNTIL S-EOF-CURSOR = 'Y'
200-FETCH CURSOR.
EXEC SQL
FETCH ENDRSCURS
INTO :DB2-COVERAGE
,:DB2-ENDORSEMENT
END-EXEC.
300-LOAD-INTERNAL-TABLE
ADD +1 TO W-SUB.
MOVE DB2-COVERAGE TO WS-COVERAGE(W-SUB)
MOVE DB2-ENDORSEMENT TO WS-ENDORSEMENT(W-SUB)
PERFORM 200-FETCH-CURSOR
.
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|