Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Problem in moving data from a table(array) to a file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Problem in moving data from a table(array) to a file.
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: 6968
Location: porcelain throne

PostPosted: Tue Feb 26, 2008 4:22 pm    Post subject:
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: 2150
Location: At my coffee table

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

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

Site Director


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

PostPosted: Tue Feb 26, 2008 9:54 pm    Post subject:
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    Post subject: Reply to: Problem in moving data from a table(array) to a fi
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    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Wed Feb 27, 2008 3:07 pm    Post subject:
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

Site Director


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

PostPosted: Wed Feb 27, 2008 10:29 pm    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us