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: Fri Aug 07, 2009 6:51 pm
Reply with quote

Yes Terry and Dick, I saw it's working

Thank you
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: Fri Aug 07, 2009 7:15 pm
Reply with quote

Sometime in the future, if you are feeling more confident with your skills -

www.ibmmainframes.com/viewtopic.php?p=176368&highlight=#176368

Bill
Back to top
View user's profile Send private message
PPRASAD2

New User


Joined: 06 Aug 2009
Posts: 21
Location: chennai

PostPosted: Sat Aug 08, 2009 12:12 am
Reply with quote

hey

Is any thing wrong in my code?
FD REPORT-FILE
RECORD CONTAINS 149 CHARACTERS
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD
DATA RECORDS ARE REPORT-RECORD.
01 REPORT-RECORD.
05 MOBIUS-DETAIL-LINE.
.
.
.
.


SET AI TO 1.
PERFORM 0180-PRINT-HEADING.
PERFORM 0170-READ-ARRAY VARYING AI FROM 1 BY 1 UNTIL
AI > 1000.
.
.
.
.
0170-READ-ARRAY.

MOVE FILING-DETAILS-TABLE(AI) TO REPORT-RECORD.
MOVE REPORT-DETAIL-LINE-CC(AI) TO MOBIUS-DETAIL-LINE.
MOVE REPORT-DETAIL-SYMBOL(AI) TO MOBIUS-DETAIL-SYMBOL.
MOVE REPORT-DETAIL-NUMBER(AI) TO MOBIUS-DETAIL-NUMBER.
WRITE REPORT-RECORD.


when I display array contents , it is displaying properly but in out put records are not coming
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: Sat Aug 08, 2009 1:12 am
Reply with quote

You need to show us the definition of your COBOL table and tell us whether or not you are checking the file status of all file I-O including the WRITE statement and what you mean by
Quote:
in out put records are not coming
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Sun Aug 09, 2009 7:31 am
Reply with quote

Prasad,

I doubt with your array declaration for the above problem. Can you post the array declaration here...?

Also your performing the loop until AI reaches 1001 (atleast 1000 times). since your loading the array using your input file, load the array until end of file and keep increament some counter(declare some counter variable) for each read of your i/p file, then at end of last recod your counter will be having total number of record that your i/p file have. Then you can perform the array as below

PERFORM 0170-READ-ARRAY VARYING AI FROM 1 BY 1 UNTIL
AI > 1000 or AI > your-counter-variable

or

PERFORM 0170-READ-ARRAY VARYING AI FROM 1 BY 1 UNTIL
AI > your-counter-variable
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: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 1, 2  Next

 


Similar Topics
Topic Forum Replies
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
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
Search our Forums:

Back to Top