View previous topic :: View next topic
|
Author |
Message |
kumar1234
New User
Joined: 06 Nov 2007 Posts: 84 Location: bangalore
|
|
|
|
Hi All,
I am reading a file and then building a table array ,and then moving the required variable from the file to the array table in my program. Then I am giving a search in my prog then matching with the required variable and moving that variable to another file.
When I run the job I am getting maxcc 0 but the required variable is not moving to the file.
Here is the syntax which I have used for search...
5200-CHECK-USER-ID.
SET USERNDX TO 1.
DISPLAY 'ADJ-CODE', ADJ-CODE.
DISPLAY 'USER-ID(USERNDX)', USER-ID(USERNDX).
SEARCH WS-USER-ID-TABLE
AT END
GO TO 5200-EXIT
WHEN ADJ-CODE = USER-ID(USERNDX)
MOVE 'Y' TO ADJUSTER-SW
DISPLAY 'LD-ID (USERNDX)', LD-ID (USERNDX).
MOVE LD-ID (USERNDX) TO GARD-ED-ID.
5200-EXIT.
EXIT.
Can anyone let me know what could be the problem.
Thanks. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
table array is redundent.
a db2 table is a linear vsam collection supported by db2. a table is external to a cobol program.
an array is an internal table for rexx, c, etc.
a cobol internal table is an internal structure within a cobol table to provide access to common type elements.
without seeing your table definition and the code used to populate the internal cobol table, hard to give you an answer why your code is not successful.
get out of the habit of trying to relate a maxx cc of 0 for an execution and a sucessful run by your program. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
What does the table look like? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If you still have no resolution, you might add some code (just after you complete loading the array) to display the contents of the array.
As of now, it is unknown whether the array is loaded correctly or not, or if there is some other problem in the code. |
|
Back to top |
|
|
kumar1234
New User
Joined: 06 Nov 2007 Posts: 84 Location: bangalore
|
|
|
|
Hi,
This is how is my table,
01 WS-USER-ID-TABLES.
05 WS-USER-ID-TABLE OCCURS 9999 TIMES
INDEXED BY USERNDX.
15 TD-USER-ID PIC X(07).
15 TD-ED-ID PIC X(30).
Thanks, |
|
Back to top |
|
|
sr arun
New User
Joined: 24 Aug 2007 Posts: 1 Location: bangalore
|
|
|
|
Kumar,
Can you please let us know the output. Because of the '.' before the move statement (hi-lighted in red)
DISPLAY 'LD-ID (USERNDX)', LD-ID (USERNDX).
MOVE LD-ID (USERNDX) TO GARD-ED-ID.
we might end up moving the ld-id to yuor gard-ed-id.
Do you mean to say you do get the display of ld-id(userndx) correctly but still it is not updated to the file?? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Code: |
5200-CHECK-USER-ID.
SET USERNDX TO 1.
DISPLAY 'ADJ-CODE', ADJ-CODE.
DISPLAY 'USER-ID(USERNDX)', USER-ID(USERNDX).
SEARCH WS-USER-ID-TABLE
AT END MOVE 'N' TO ADJUSTER-SW
WHEN ADJ-CODE = USER-ID(USERNDX)
MOVE 'Y' TO ADJUSTER-SW
DISPLAY 'LD-ID (USERNDX)', LD-ID (USERNDX)
END-SEARCH.
IF ADJUSTER-SW = 'Y'
THEN
MOVE LD-ID (USERNDX) TO GARD-ED-ID
END-IF.
5200-EXIT.
EXIT.
|
does your DISPLAY 'LD-ID (USERNDX)', LD-ID (USERNDX)
display the proper id?
what is your table load code look like? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Did you display the contents of the array after loading it? Is it correct?
Might we see the code to load the array soon? |
|
Back to top |
|
|
ravi.suresh
New User
Joined: 03 Mar 2008 Posts: 3 Location: bangalore
|
|
|
|
hello ,
Try by putting the variable associated with index(userndx) to the left of
'=' sign in when clause of search statement. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Code: |
SEARCH WS-USER-ID-TABLE
AT END MOVE 'N' TO ADJUSTER-SW
WHEN ADJ-CODE = USER-ID(USERNDX)
MOVE 'Y' TO ADJUSTER-SW
DISPLAY 'LD-ID (USERNDX)', LD-ID (USERNDX)
END-SEARCH.
|
There is nothing to stop the search when a match is found, you will continue after the match and userndx and adjuster-sw will have the wrong value when the search ends. |
|
Back to top |
|
|
|