View previous topic :: View next topic
|
Author |
Message |
malathys
New User
Joined: 07 Aug 2008 Posts: 10 Location: chennai
|
|
|
|
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 |
|
|
rakesha.hg
Active User
Joined: 21 Mar 2008 Posts: 161 Location: bangalore
|
|
|
|
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 |
|
|
malathys
New User
Joined: 07 Aug 2008 Posts: 10 Location: chennai
|
|
|
|
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 |
|
|
nuthan
Active User
Joined: 26 Sep 2005 Posts: 146 Location: Bangalore
|
|
|
|
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 |
|
|
rakesha.hg
Active User
Joined: 21 Mar 2008 Posts: 161 Location: bangalore
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Once you correct the handling of idx, what will you do with the values in the array? |
|
Back to top |
|
|
|