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

Storing data in cobol array


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

New User


Joined: 06 Aug 2009
Posts: 21
Location: chennai

PostPosted: Tue Aug 11, 2009 5:20 pm
Reply with quote

Hi All,

I have successfully coded my program for the first time.

Thanks alot to you all for your help.

Now one more qlarification that I need from you.

01 REPORT-ARRAY-F01140.
05 FILING-DETAILS-TABLE-F01140 OCCURS 50 TIMES

I have coded my array like this, but when I tried to move data from array to output file, all the other occurrences are coming as spaces, because my input file has only 20 records but occurs 50 times.

How to avoid those spaces. I heard this can be done by dynamic array.
What is that and how it can be?

Could you please guide me.

Thanks
Prasad
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Aug 11, 2009 5:33 pm
Reply with quote

Hi Prasad...

Kudos on getting your first code working... icon_cool.gif

Quote:
How to avoid those spaces. I heard this can be done by dynamic array.
What is that and how it can be?


icon_eek.gif well .. i will also ask the same question... what do u mean by "avoid spaces"... how can we "avoid" spaces....
Back to top
View user's profile Send private message
PPRASAD2

New User


Joined: 06 Aug 2009
Posts: 21
Location: chennai

PostPosted: Tue Aug 11, 2009 5:35 pm
Reply with quote

I mean after writing my 10 input records, it takes spaces for other occurrences because there is no data from 11th occurence.

I meant this
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Aug 11, 2009 5:38 pm
Reply with quote

Hi Prasad,

You have already told that you are getting spaces... agreed ... I do not have any issues in that.. icon_smile.gif
What is it that you are expecting... Are u expecting something else other than spaces.
Back to top
View user's profile Send private message
PPRASAD2

New User


Joined: 06 Aug 2009
Posts: 21
Location: chennai

PostPosted: Tue Aug 11, 2009 5:42 pm
Reply with quote

No Binop.

After I have coded 4 arrays and stored same type of data in those arrays and need to write them all to an output file one by one.

first array is writing 10 records after that 40 empty lines are coming
after that next array is getting dispalyed..like that it's happening

Report should be line after line right.

Hope you got it
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Aug 11, 2009 5:48 pm
Reply with quote

as someone said earlier, as you load the table, keep a counter of occurances used, then you don't have the problem during output.

by dynamic you mean ODO - occurs depending on - learn the proper terminology.

either check your item for spaces before outputing or do it the easy way and maintain a counter of items in the array and use the counter to control a perform loop.
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Aug 11, 2009 5:50 pm
Reply with quote

Hi Prasad,

By the looks of it, I guess your problem is related to your coding logic.

I would suggest you spend some more time reviewing your code and then probably you could post us with your findings.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Aug 11, 2009 7:06 pm
Reply with quote

Have you read up on the OCCURS DEPENDING ON clause? Are you keeping track of the number of occurrences you are loading into the table so that when you unload it, you know when you've exceeded the actual number of occurrences you've loaded? If you've loaded 20 of your 50 occurrences, you should not be referencing occurrences 21 through 50 in your logic. Oops, I failed to read page 2 of the posts before responding. icon_redface.gif
Back to top
View user's profile Send private message
sijayapal

New User


Joined: 23 Dec 2008
Posts: 69
Location: India

PostPosted: Thu Aug 13, 2009 9:47 pm
Reply with quote

Is it possible to pass an array from one prog to another via linkage section?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Aug 13, 2009 10:22 pm
Reply with quote

Sure, that's not a problem.

If you're on VS/COBOL II and greater, check out EXTERNAL DATA, which is available to ALL programs within the run-unit, without having to "pass" them (actually under the covers, it's the address), in a CALL statement.

Bill
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 Goto page Previous  1, 2

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top