IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Problem in moving data from a table(array) to a file.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kumar1234

New User


Joined: 06 Nov 2007
Posts: 84
Location: bangalore

PostPosted: Tue Feb 26, 2008 3:59 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Feb 26, 2008 4:22 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Feb 26, 2008 5:54 pm
Reply with quote

What does the table look like?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Feb 26, 2008 9:54 pm
Reply with quote

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
View user's profile Send private message
kumar1234

New User


Joined: 06 Nov 2007
Posts: 84
Location: bangalore

PostPosted: Wed Feb 27, 2008 1:11 pm
Reply with quote

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
View user's profile Send private message
sr arun

New User


Joined: 24 Aug 2007
Posts: 1
Location: bangalore

PostPosted: Wed Feb 27, 2008 2:55 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Feb 27, 2008 3:07 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 27, 2008 10:29 pm
Reply with quote

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
View user's profile Send private message
ravi.suresh

New User


Joined: 03 Mar 2008
Posts: 3
Location: bangalore

PostPosted: Thu Mar 06, 2008 12:08 pm
Reply with quote

hello ,
Try by putting the variable associated with index(userndx) to the left of
'=' sign in when clause of search statement.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Mar 06, 2008 6:51 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top