How to count the number of records based on given situation?



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

How to count the number of records based on given situation?

Postby madluigie18 » Thu Oct 22, 2009 4:20 pm

Hello I have this simple complicated problem...

I created a program which has a CSV output on a fixed block file. The CSV is a report type which contains MAIN HEADER, SUB HEADERS. and DETAIL HEADERS.
Well, this is it..The main header and subheaders together with detail headers are repeated many times depending of the change or break of main header field or subheader field... It is simple to count records including or excluding headers but the problem is I have to coordinate this one on the Excel sheet since this is CSV file.. the limit is 65536 (no of lines they told me Excel sheet could hold). The hard thing is, how to cut it off on the excel sheet limit without breaking up the records on a certain main header or subheader field... the separated file could be written on another CSV fixed block file...

Main Header

SubHeader
Detail Header.......

Values........

Main Header

SubHeader
Detail Header.......

Values........ and so on... thanks I really need a help on this..deadline is coming sorry guys..
madluigie18
 
Posts: 2
Joined: Thu Oct 22, 2009 4:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to count the number of records based on given situation?

 

Re: How to count the number of records based on given situation?

Postby dick scherrer » Fri Oct 23, 2009 12:00 am

Hello,

While reading the "input" load the data for one "group of data" into an internal array in the program (counting the number of entries).

While writing the csv output, count the records written. If the number of entries in the array plus the number of records already written to the csv output is greater than the maximum, the csv file is "full".

Additional output FD's could be used for the 2nd thru the nth csv needed or the job could re-submit itself using the "start group" as the input parameter so the code would know where to "begin". Each iteration would use a different output dataset name.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: How to count the number of records based on given situation?

Postby madluigie18 » Fri Oct 23, 2009 8:52 pm

Thank you d.sch. for the response.

Sorry for this but I am not that familiar with array..and How about the breaks of headers and subheaders?
Please provide me even a pseudocode for this and array declaration sample for this.


Thanks again..
madluigie18
 
Posts: 2
Joined: Thu Oct 22, 2009 4:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to count the number of records based on given situation?

Postby swd » Fri Oct 23, 2009 10:15 pm

madluigie18 wrote:Sorry for this but I am not that familiar with array....


I purchased a book called the Student's Guide to COBOL, more years ago than I care to remember. In every COBOL book, manual, or whatever, it goes into some detail about arrays. If you program in COBOL, or any other language, you MUST have some concept of array's, or working storage tables - call them what you will.

This is your problem, you must be responsible for doing some research yourself - you can't expect someone else to develop a solution for you. The idea of the forum is to help you with a problem, not develop solutions for you.

That's my rant over with.
User avatar
swd
 
Posts: 109
Joined: Wed Feb 18, 2009 9:18 pm
Location: UK
Has thanked: 0 time
Been thanked: 0 time

Re: How to count the number of records based on given situation?

Postby dick scherrer » Sat Oct 24, 2009 1:56 am

Hello,

If you do not have a basic understanding of a Working-Storage table/array, you need to get this before going any further. If you have no experience with arrays and the deadline is approaching, i suggest you inform the manager that this will possibly take longer than the current plan. . .

No manager likes "bad news" but springing it near the expected completion date makes it even worse.

How many records are there under a "main header"? Suggest you break the file at the "main header" so that everything in the particular output file is cohesive.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post