Solved

Cobol question  regarding release statements

Posted on 2002-06-17
9
243 Views
Last Modified: 2010-04-17
I'm looking at an old program that our company uses.  I've never programmed in COBOL before so this is a very complicated project for me.  Anyway, the program creates a report using the report writer (as I understand).  I've been looking at some of the variables in the program and it seems like some of the variables receive values many times.  For instance, in the program a variable called sort-amount receives data from a data file field called arh-invoice-amount.  Then, the same exact variable receives another value in another procedure.  It doesn't look like sort-amount did anything with the first value it received.  The thing that I noticed is that there is a release statement before the start of the procedure in which the sort-amount receives the second value.   Does that release statement tell the program where to dump the value that sort-amount received?  Again, I'm really new to this language so please explain things thoroughly.

Please let me know if I need to clarify anything.

Thanks in advance,
boody
0
Comment
Question by:boody
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 54

Expert Comment

by:nico5038
ID: 7084397
Long time ago for me, but as far as I recall the sort in the reporter is done in two phases:
1) Pre-sort, reads all records into a temp file.
   The code can be used to "prepare" some fields or even combine different files.
2) After-sort, processes all sorted records from the temp (sort) file.

The release statement will trigger COBOL to start the sort of the temp file.

Does the code make more sense now ?

Nic;o)
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 100 total points
ID: 7100912
RELEASE is the same as WRITE except that the write is to the sort work files.

This is probably in a sort input procedure.  The normal sequence for a program using report write is Extract, Sort, and then generate the report using the records returned form the sort files.

The extract is almost always as sort input procedure.  The extracted data is sent to the sort work files with the release.  The report generation is generally a sort output procedure, though it could also be in line.  The sort procedure would normally get the data back from the sort work files with RETURN which is the same as READ exceptit reads the sort work files.

The output procedure will then populate the report record layouts, for of the formatting is defined in FD of the report file.

I hope that helps.  If you need more, it would be helpful to know what platform you are on, and what compiler you are using.

Cd&
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7101085
Hi Cd&,

Sure about the FD, wasn't that for the sort file a SD ?

Nic;o)
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7101124
SD is for sort files.  Report writer uses a regular FD but includes options like LINAGE and FOOTING.

The report is a regular spooled file, though is it could also go to disk.  Sort work files are generally shared pool areas on disk.

Cd&
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7109251
boody,

Where are we at with this?  has any of this helped?

Cd&
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7515212

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - Answered by: COBOLdinosaur
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7515353
:^)
0
 

Expert Comment

by:Jgould
ID: 7548202
Question has been closed as per recommendation

JGould-EE Moderator
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7548274
Thanks JG and Nico. :^)

Cd&
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question