Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Cobol Misc > Re: READING 2 R...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 8 Topic 127 of 183
Post > Topic >>

Re: READING 2 RECS before write to PRINT REC

by jeff@[EMAIL PROTECTED] Aug 21, 2006 at 10:16 AM

Keep in mind the program is setup to work off a user defined variable #
Prior Years
If they answered 3 then the recs look like:
2006
2005
2004

2006
2005
2004
So I will need to figure out the percentage from 2006 vs 2005 and
print, 2005 vs 2004 and print and wait until I get another 2006 to
start again.

John Culleton wrote:
> jeff@[EMAIL PROTECTED]
 wrote:
>
> > I have a program that I wrote that creates a work file to read from to
> > create a print record. The program is a sales re****t that allows the
> > user to specify how many years to compare. An example is 07-01-06 thru
> > 07-31-06 If they answer 3 prior years it would show sales data (it
also
> > handles exact day instead of just 070106, 071005, 070104)
> > 20060701
> > 20050702
> > 20040703
> >
> > 20060702
> > 20050703
> > 20040704
> >
> > When I read the Work file I need to read 2 recs before writing the
> > print record to calculate the percentage change in amount. Example:
> > 20060701               10%
> > 20050702                7%
> > 20040703
> > Sales up 10% for 2006 over 2005, sales up 7% 2005 over 2004.
> >
> > Any ideas on the best way to accomplish this?
>
> In psuedo code:
> open files
> read first record into first work field.
> perform loop until end file.
> close files.
>
> loop.
> read next record into second work field.
> calculate percent change.
> move second work field to print-rec-date.
> move percent change to print-rec pct.
> write print-rec.
> move second-work field to first work-field.
> ------------------------------------------
>
> Now my logic may be faulty since I don't know how the input file
> is organized. But the principle is to create a pipeline which
> holds two records at a time. After you do the calculation and
> print the re****t line you ****ft the data and read another record.
>
> The other suggestion of laying all the data up in a big table may
> also be useful.
>
> Specify your input record layout and your re****t line layout.
> That may help us help you.
>
> BTW is the input file sequential or indexed-sequential?
> -- 
> John Culleton
> Able Indexers and Typesetters
 




 8 Posts in Topic:
READING 2 RECS before write to PRINT REC
jeff@[EMAIL PROTECTED]   2006-08-21 05:50:08 
Re: READING 2 RECS before write to PRINT REC
"billious" <  2006-08-21 22:42:56 
Re: READING 2 RECS before write to PRINT REC
John Culleton <john@[E  2006-08-21 12:30:23 
Re: READING 2 RECS before write to PRINT REC
jeff@[EMAIL PROTECTED]   2006-08-21 09:55:10 
Re: READING 2 RECS before write to PRINT REC
"billious" <  2006-08-22 04:04:12 
Re: READING 2 RECS before write to PRINT REC
jeff@[EMAIL PROTECTED]   2006-08-21 10:16:19 
Re: READING 2 RECS before write to PRINT REC
jeff@[EMAIL PROTECTED]   2006-08-22 04:58:03 
Re: READING 2 RECS before write to PRINT REC
jeff@[EMAIL PROTECTED]   2006-08-22 07:08:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Oct 15 12:18:25 CDT 2008.