View previous topic :: View next topic
|
Author |
Message |
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
Hi,
Can we use depending on like this. I have given the declaration
Code: |
01 WV-OUT-PARM1.
05 WV-REG-CODE1 PIC X(02).
05 WV-REG-OPEN-CNT1 PIC 9(05).
05 WV-REG-SUB-CNT1 PIC 9(05).
05 WV-DISTRICT1 OCCURS 1 TO 20 TIMES
DEPENDING ON WV-DIST-MAX
ASCENDING KEY IS WV-DIST-CD1
INDEXED BY WV-DIST1-IDX .
10 WV-DIST-CD1 PIC X(02).
10 WV-DIST-OPEN-CNT1 PIC 9(05).
10 WV-DIST-SUB-CNT1 PIC 9(05).
10 WV-DEALER1 OCCURS 1 TO 40 TIMES
DEPENDING ON WV-DLR-MAX
ASCENDING KEY IS WV-DLRT-CD1
INDEXED BY WV-DLR1-IDX.
15 WV-DLR-CD1 PIC X(05).
15 WV-DLR-NAME1 PIC X(30).
15 WV-STATUS-CD1 PIC X(02).
10 WV-FILLER1 PIC X(01). |
After fetching from db2 tables, I am moving the fetched values to these declarations. I ran the sql seperately and that fetching eight values.
My problem is I am not getting the wv-dlr-cd1, dlr-name1 , status-cd1 values in order. For ex , for the first to seven indexes I am not getting any wv-dlr-cd1, dlr-name1 , status-cd1 values and for the last eighth index alone I am getting values.
Can anyone suggest me whats wrong in this. When I displayed the wv-dlr-cd1, dlr-name1 , status-cd1 values seperately, I am able to see . But when i tried to display as group item WV-OUT-PARM1., I am not able to see that. Please suggest me. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
birdy K wrote: |
Can we use depending on like this. |
Yes.....
Quote: |
After fetching from db2 tables, I am moving the fetched values to these declarations. |
In what order? When are you setting the indexes? |
|
Back to top |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
hi,
Before move I am setting both the indexes to one. It should be in fetched order. The values should be in order as fetched but for me there are no values for first seven indexes, When i displayed as group item. The values are there from eighth index.
I think the values are relocated. The problem is in depending on WV-DIST-MAX and WV-DLR-MAX. When I remove the depending on clause, I am getting the values in order. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
It would help to see the actual move statements -- complex ODO structures like this are easy to get wrong. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
what values do you populate in WV-DIST-MAX and WV-DLR-MAX?
when do you populate them? |
|
Back to top |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
HI,
I am not using that in this program. Usually I can use that wv-dist-max for some process. For ex. set wv-dist-max =1
perform para1 until wv-dist1-indx = wv-dist-max.
I have to declare like that. Thats the must in our pgming guidelines. |
|
Back to top |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
Hi,
Little changes in prev post. After fetch, the max will be automatically set. So I can use wv-dist-max like this. For ex. set wv-dist-indx =1
perform para1 until wv-dist-indx = wv-dist-max.
Suggest me what wrong in the code. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
show us the code you use to load the tables.
stop showing us little things that you want to share. you have a problem, show us the code. we can then try to help.
stop determining what we need to see. if you knew, you would not need our help and be hopelessly going around in circles. |
|
Back to top |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
Hi,
Code: |
PERFORM UNTIL WV-END-OF-CSR
IF STATUS-CD OF BTC04430 NOT = '40'
IF DSTRCT-CD OF BTC02090 = WV-DIST-CODE
MOVE DLR-CD OF BTC02010 TO
WV-DLR-CD1 (WV-DIST1-IDX,WV-DLR1-IDX)
MOVE DBA-NM OF BTC02010 TO
WV-DLR-NAME1 (WV-DIST1-IDX,WV-DLR1-IDX)
MOVE STATUS-CD OF BTC04430 TO
WV-STATUS-CD1 (WV-DIST1-IDX,WV-DLR1-IDX)
SET WV-DLR1-IDX UP BY +1
ELSE
MOVE WV-DIST-OPEN-CNT11 TO
WV-DIST-OPEN-CNT1(WV-DIST1-IDX)
MOVE WV-DIST-SUB-CNT11 TO
WV-DIST-SUB-CNT1(WV-DIST1-IDX)
MOVE ';' TO WV-FILLER1(WV-DIST1-IDX)
MOVE ZEROES TO WV-DIST-OPEN-CNT11
WV-DIST-SUB-CNT11
SET WV-DIST1-IDX UP BY +1
SET WV-DLR1-IDX TO +1
MOVE DSTRCT-CD OF BTC02090 TO WV-DIST-CODE
WV-DIST-CD1(WV-DIST1-IDX)
MOVE DLR-CD OF BTC02010 TO
WV-DLR-CD1 (WV-DIST1-IDX,WV-DLR1-IDX)
MOVE DBA-NM OF BTC02010 TO
WV-DLR-NAME1 (WV-DIST1-IDX,WV-DLR1-IDX)
MOVE STATUS-CD OF BTC04430 TO
WV-STATUS-CD1 (WV-DIST1-IDX,WV-DLR1-IDX)
SET WV-DLR1-IDX UP BY +1
END-IF
PERFORM R1000-FETCH-ABP-RGN-CSR THRU R1000-EXIT
END-PERFORM. |
I have given the code. Please suggest me . |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Is the code presented as it actually is in the program? What is posted does not appear to have continuity (i may be mis-reading something). It is not clear what values will be in the indexs as they are used/incremented.
Suggest you map out your process on paper and "play computer" with some sample data.
You might want to put some displays in the code to show which table entries are being referenced as the code is executed. You would only need to process a very small amount of data for this test. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Unless I'm missing something, you have an unmatched IF statement in your code. Does this compile successfully? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Code: |
PERFORM UNTIL WV-END-OF-CSR
IF STATUS-CD OF BTC04430 NOT = '40'
IF DSTRCT-CD OF BTC02090 = WV-DIST-CODE
MOVE DLR-CD OF BTC02010 TO
WV-DLR-CD1 (WV-DIST1-IDX,WV-DLR1-IDX)
MOVE DBA-NM OF BTC02010 TO
WV-DLR-NAME1 (WV-DIST1-IDX,WV-DLR1-IDX)
MOVE STATUS-CD OF BTC04430 TO
WV-STATUS-CD1 (WV-DIST1-IDX,WV-DLR1-IDX)
SET WV-DLR1-IDX UP BY +1
ELSE |
1. As Terry says, you've got more IF than END-IF statements.
2. You use WV-DIST1-IDX and WV-DLR1-IDX without bothering to tell us how they are set.
3. You increment WV-DLR1-IDX without bothering to check for hitting the boundary.
4. You increment WV-DLR1-IDX without letting us know the value of WV-DLR-MAX, nor do you increment the value of WV-DLR-MAX before incrementing WV-DUR1-IDX. If WV-DLR1-IDX exceeds WV-DLR-MAX the results of your MOVE statements is suspicious at best, possibly dangerous to your data at worst.
5. WV-DIST-MAX must be carefully controlled or you will invalidate your table. Incrementing WV-DIST1-IDX past WV-DIST-MAX will definitely cause you problems.
From the Programming Guide:
Quote: |
Be careful if you reference a complex-ODO index-name, that is, an index-name for a table with variable-length elements, after having changed the value of the ODO object for a subordinate data item in the table. When you change the value of an ODO object, the byte offset in an associated complex-ODO index is no longer valid because the table length has changed. Unless you take precautions, you will obtain unexpected results if you then code a reference to the index name such as:
* A reference to an element of the table
* A SET statement of the form SET integer-data-item TO index-name (format 1)
* A SET statement of the form SET index-name UP|DOWN BY integer (format 2) |
|
|
Back to top |
|
|
|