Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

fetching data from table using occurs clause

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
malathys

New User


Joined: 07 Aug 2008
Posts: 10
Location: chennai

PostPosted: Thu Aug 14, 2008 11:32 am    Post subject: fetching data from table using occurs clause
Reply with quote

Hi,
I am a new user to this forum.
I am trying to fetch the data from the table using occurs clause.I have tried using perform statement for accepting table variables. can i do it?
Here is my code:
working-storage section.
01 emp-record.
02 emp-table occurs 3 times indexed by idx.
03 emp-id pic 9(10).
03 emp-name pic x(10).
procedure division.
para1.
set idx to 1.
perform varying idx from 1 by 1 until idx is greater than 2
accept emp-id(idx)
accept emp-name(idx)
set idx up by 1
end-perform.


please help me.thanks in advance.
Back to top
View user's profile Send private message

rakesha.hg

Active User


Joined: 21 Mar 2008
Posts: 161
Location: bangalore

PostPosted: Thu Aug 14, 2008 11:38 am    Post subject: Reply to: fetching data from table using occurs clause
Reply with quote

Hi malathys,

Welcome to the forums!

Quote:
I am trying to fetch the data from the table using occurs clause

please clarify? give us what your inputs looks like & sample output?

If your using accept variable? are you passing the values through jcl?

please make the requirement clear.
Back to top
View user's profile Send private message
malathys

New User


Joined: 07 Aug 2008
Posts: 10
Location: chennai

PostPosted: Thu Aug 14, 2008 11:45 am    Post subject:
Reply with quote

Hi,

Thanks for your reply. Yes, you are correct. I am passing the values through jcl.See i am trying to fetch the variables from the table and write it into the file.My output file should contain the table variables.should i be more clear? or is it enough? waiting for reply.thanks.
Back to top
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Thu Aug 14, 2008 11:56 am    Post subject:
Reply with quote

Hi,
The code you have posted here will just take the data from JCL and load into your array/table. Once your array is loaded, do the process u want by reading the array and move the table variables to file record fields. Then write into your file record.
Back to top
View user's profile Send private message
rakesha.hg

Active User


Joined: 21 Mar 2008
Posts: 161
Location: bangalore

PostPosted: Thu Aug 14, 2008 12:04 pm    Post subject: Reply to: fetching data from table using occurs clause
Reply with quote

hi ,

In that case as nuthan suggested this will load your table ....... you can write file as per your requirement in the file.

If you have to consider any other things let the forum know?
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: Thu Aug 14, 2008 4:26 pm    Post subject: Re: fetching data from table using occurs clause
Reply with quote

malathys wrote:
Code:
working-storage section.
    01 emp-record.
          02 emp-table occurs 3 times indexed by idx.
               03 emp-id       pic 9(10).
               03 emp-name pic x(10).
procedure division.
para1.
    set idx to 1.
    perform varying idx from 1 by 1 until idx is greater than 2
         accept emp-id(idx)
         accept emp-name(idx)
         set idx up by 1
    end-perform.
Huh? Why are you setting idx up by one when the perform is doing it too?
First pass, idx is one, second pass idx is three and the perform loop is terminated.......
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: Thu Aug 14, 2008 9:31 pm    Post subject:
Reply with quote

Hello,

Once you correct the handling of idx, what will you do with the values in the array?
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 Passing data from REXX to C programme... chong.zhou CLIST & REXX 2 Wed Jul 26, 2017 9:11 pm
No new posts Passing data from REXX to C programme... chong.zhou All Other Mainframe Topics 0 Wed Jul 26, 2017 4:55 pm
No new posts copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us