REGARDING MULTIPLE RECORD READING FROM DB2 USING CICS



Support for CICS/ESA, CICS/TS & Transaction Gateway, CICS Configuration Manager and CICS Performance Analyzer

REGARDING MULTIPLE RECORD READING FROM DB2 USING CICS

Postby gabbar » Fri Dec 23, 2011 11:58 am

I HAVE A DB2 TABLE WITH 2 ATTRIBUTES
ACCOUNT ID AND ISSUE ID
A PARTICULAR ISSUE ID WILL HAVE MORE THAN 1 ACCOUNT ID ASSOCIATED WITH IT
FOR EXAMPLE THERE IS AN ISSUE ID ABCDEF ... THIS ABCDEF HAS 3 ACCOUNT ID 00000 00001 00002 ASSOCIATED WITH IT
WHICH MEANS ACCOUNT 00000 HOLDS ABCDEF ISSUE AS WELL AS 000001 AND 000002
SO IN MY CICS MAP WHEN THE USER ENTERS A PARTICULAR ISSUE ID ABCDEF I WILL SEARCH THE DB2 TABLE AND THE CURSOR READS 00000 FROM THE TABLE AND LIST HIM AS A PERSON HOLDING THE ISSUE ABCDEF... NOW ON PRESSING ENTER I NEED TO READ THE TABLE AGAIN AND NOW 00000 SHOULD NOT BE CONSIDERED AS IT HAS ALREADY BEEN DISPLAYED INSTEAD 00001 MUST BE READ FROM THE TABLE AND DISPLAYED ON THE CICS SCREEN SIMILARLY NEXT TIME AROUND 00000 AND 00001 MUST BE IGNORED AND 00002 MUST BE DISPLAYED ON THE CICS SCREEN.
I KNOW HOW TO READ THE FIRST RECORD RELATED TO THE ISSUE ID .. BUT THEN THE FIRST RECORD WONT BE IGNORED FROM NEXT TIME AND WILL BE RE READ AGAIN AND AGAIN ...
WHAT IS THE LOGIC TO ACCOMPLISH WHAT I WANT.
THANK YOU
gabbar
 
Posts: 12
Joined: Fri Dec 23, 2011 11:49 am
Has thanked: 0 time
Been thanked: 0 time

Re: REGARDING MULTIPLE RECORD READING FROM DB2 USING CICS

Postby dick scherrer » Fri Dec 23, 2011 12:12 pm

Hello and welcome to the forum,

First - TURN OFF the CAPS. This is consider is considered to be shouting and rude on the forum.

Is this a COBOL program?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: REGARDING MULTIPLE RECORD READING FROM DB2 USING CICS

Postby dick scherrer » Fri Dec 23, 2011 12:14 pm

Follow on - do NOT post the same question in multiple topics.

The duplicate has been deleted.

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: REGARDING MULTIPLE RECORD READING FROM DB2 USING CICS

Postby gabbar » Fri Dec 23, 2011 12:16 pm

Sorry for the caps, i will not repeat it
yes sir it is a cobol program
gabbar
 
Posts: 12
Joined: Fri Dec 23, 2011 11:49 am
Has thanked: 0 time
Been thanked: 0 time

Re: REGARDING MULTIPLE RECORD READING FROM DB2 USING CICS

Postby dick scherrer » Fri Dec 23, 2011 12:30 pm

Hello,

Sorry for the caps, i will not repeat it
Cool - thanks :)

Is this a business program or a class exercise?

Suggest you look at a few other COBOL programs that run on your system that have a similar function and follow the way they are implemented. Most systems have standards that need to be followed.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: REGARDING MULTIPLE RECORD READING FROM DB2 USING CICS

Postby gabbar » Fri Dec 23, 2011 12:47 pm

It is a business program, i know how to read records and other things required from the table... the problem i face here is there are only two attributes in the table with one to many relationship and i can read only the first one and then it gets repeated the others related to the same account id are not being read.
gabbar
 
Posts: 12
Joined: Fri Dec 23, 2011 11:49 am
Has thanked: 0 time
Been thanked: 0 time

Re: REGARDING MULTIPLE RECORD READING FROM DB2 USING CICS

Postby dick scherrer » Fri Dec 23, 2011 12:59 pm

Hello,

i can read only the first one and then it gets repeated the others related to the same account id are not being read.
You need to change the SELECT to continue from the last row read rather than restarting at the beginning.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: REGARDING MULTIPLE RECORD READING FROM DB2 USING CICS

Postby NicC » Fri Dec 23, 2011 1:04 pm

Why not read all the data for that ID into a cursor and have a loop in the program walking through the cursor displaying each item at a time? Saves going to DB2 each time you want a new item (which turns out to be not the item you need).
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: REGARDING MULTIPLE RECORD READING FROM DB2 USING CICS

Postby gabbar » Fri Dec 23, 2011 2:13 pm

thank you , i think i got you.
will implement and reply if i have a problem
:)
gabbar
 
Posts: 12
Joined: Fri Dec 23, 2011 11:49 am
Has thanked: 0 time
Been thanked: 0 time

Re: REGARDING MULTIPLE RECORD READING FROM DB2 USING CICS

Postby GuyC » Fri Dec 23, 2011 5:56 pm

NicC wrote:Why not read all the data for that ID into a cursor and have a loop in the program walking through the cursor displaying each item at a time? Saves going to DB2 each time you want a new item (which turns out to be not the item you need).

How would you keep the cursor open in a pseudo-conversational setup?

you could
first time (or when issue-id changes) :
if account-id is character move low-values to hv-account-id
if numeric : move -9999 to hv-account-id (make sure your hv is signed)
select ... where ISSUE_ID = :hv-issue-id and ACCOUNT_ID > :hv-account-id
order by account-id
fetch first 1 row only
I can explain it to you, but i can not understand it for you.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Next

Return to CICS

 


  • Related topics
    Replies
    Views
    Last post