View previous topic :: View next topic
|
Author |
Message |
sweta.ssm
New User
Joined: 28 Feb 2010 Posts: 3 Location: India
|
|
|
|
Hi,
Below is the sample code am trying to executemy code.....
Code: |
PERFORM UNTIL EOF(END OF REC IN DATABASE)
PERFORM FETCH
WHEN SQLCODE = 0
MOVE RECORDS TO TSQ-DATA
WRITE TSQ
WHEN SQLCODE = 100
SET EOF |
Suppose there are 2 records in database...
Record1
Record2
My TSQ has 4 entries in the following order-
Record1
Record2
Record2
Record1
For the above code, I was expecting only 2 records in TSQ Record1 and Record2.
Not getting to know whats the problem. I would be glad if anyone can help.. |
|
Back to top |
|
|
avinash pandey
New User
Joined: 10 Apr 2008 Posts: 17 Location: Bangalore
|
|
|
|
your approach, when DB has the 2 records :
Code: |
Perform Until EOF-CURSOR
Exec sql
Fetch cursor1
Into :column1
End-sql
Evaluate sqlcode
When +0
Count = Count + 1
Move <8-byte-qid> to Qid
Move column1 to q-data-area
Exec cics
WRITE TSQ
QID (QID-NAME)
FROM(Q-DATA-AREA)
ITEMS(count)
End-exec
When +100
Set EOF-CURSOR to true
When other
DB2-Abend error
End-evaluate |
Here two records would be fetched using the cursor and these 2 records would be written to the Queue. Is this what you wanted |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Sweta,
Welcoming you to the forum...
Are u deleting the TSQ before starting to write to the queue ? |
|
Back to top |
|
|
|