<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8499164315143266409</id><updated>2012-02-16T21:00:04.293+05:30</updated><category term='cobol-language-overview'/><category term='cobol articles'/><category term='COBOL TUTORIAL'/><title type='text'>COBOL Minds</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-4400907242349305221</id><published>2009-12-19T14:59:00.002+05:30</published><updated>2009-08-19T15:14:36.466+05:30</updated><title type='text'>WELCOME to minds of COBOL ,</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(102, 102, 102);"&gt;Day by day ,I am getting buried into the vast lines of COBOL  coding and coding ..... ! &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 102, 102);"&gt;I could hardly gave a thought to start a new blog  for newbie COBOL minds&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 102, 102);"&gt; ( programmers ).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 102, 102);"&gt;Below given are the links can help you :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 102, 102);"&gt;&lt;span style="font-size:180%;"&gt;So, why late  ...&lt;/span&gt;  " &lt;span style="font-style: italic;font-size:130%;" &gt;GO&lt;/span&gt; "   &lt;span style="font-size:180%;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&gt;&gt;&gt;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;========================================================&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 153);font-size:180%;" &gt;Links  that Click :-&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:180%;"&gt;--------------------------&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a style="font-weight: bold;" href="http://cobolminds.blogspot.com/search/label/cobol%20articles"&gt;&lt;span&gt;COBOL ARTICLES&lt;/span&gt;&lt;/a&gt; &lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold;"&gt;&gt;&gt;&lt;/span&gt;&lt;/span&gt; ( collected for various "IT magzines" )&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;JOB SEARCH TIPS &lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;font-size:180%;" &gt;&gt;&gt;&lt;/span&gt;( &lt;span style="font-style: italic; font-weight: bold;"&gt;for a COBOL/Mainframe  guy&lt;/span&gt; )&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;COBOL COMPILERS &lt;span style="font-size:180%;"&gt;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Quick FAQs about COBOL &lt;/span&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;&gt;&gt; &lt;/span&gt;(&lt;span style="font-weight: bold; font-style: italic;"&gt;interview-based&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;COBOL QUESTIONS &amp;amp; ANSWERS &lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-size:180%;" &gt;&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;COBOL TUTORIALS (pdf's) &lt;span style="font-size:180%;"&gt;&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-4400907242349305221?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/4400907242349305221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/welcome-to-minds-of-cobol.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/4400907242349305221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/4400907242349305221'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/welcome-to-minds-of-cobol.html' title='WELCOME to minds of COBOL ,'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-1949730588752273674</id><published>2009-12-18T11:23:00.000+05:30</published><updated>2009-08-18T11:36:44.659+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='cobol-language-overview'/><title type='text'>The COBOL Language Overview :</title><content type='html'>&lt;span style="font-weight: bold;"&gt;What Is COBOL?&lt;/span&gt;&lt;br /&gt;COBOL is a standard language for business software, a job that it does well. It is&lt;br /&gt;heavily used in the mainframe world. COBOL has an undeserved reputation for inefficiency, and a deserved reputation for verbosity.&lt;br /&gt;Today, many COBOL applications are being moved from mainframes to UNIX boxes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Portability:-&lt;/span&gt;&lt;br /&gt;Deaf, dumb, blind COBOL programs can be very portable. Otherwise you can use external libraries to achieve 100% portability (catch: you may have to write these libraries&lt;br /&gt;yourself).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Pros and Cons:-&lt;/span&gt;&lt;br /&gt;Pros: easy to use and teach. An excellent language for mediocre developers, which&lt;br /&gt;     includes me at least two days of the week.&lt;br /&gt;Cons: Tends to encourage large, monolithic programs. Like unreadable C code, this is&lt;br /&gt;     a question of discipline.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-1949730588752273674?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/1949730588752273674/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/cobol-language-overview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/1949730588752273674'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/1949730588752273674'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/cobol-language-overview.html' title='The COBOL Language Overview :'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-163519571349676496</id><published>2009-09-14T10:55:00.001+05:30</published><updated>2009-09-14T10:55:22.716+05:30</updated><title type='text'>Eleven Great Ways to Reduce Stress</title><content type='html'>&lt;div class="gmail_quote"&gt;&lt;br&gt;&lt;font style="font-family: arial black,sans-serif;" size="4"&gt; Eleven Great Ways to Reduce Stress&lt;/font&gt;&lt;br&gt; By Dr S. Tamer&lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;font size="4"&gt;&lt;span style="font-family: arial black,sans-serif;"&gt;Stress &lt;/span&gt;&lt;/font&gt;is a big challenge in life nowadays.&lt;br&gt; The sources of stress are many and the helpful ways to reduce stress are&lt;br&gt; also plentiful.&lt;br&gt; Common symptoms of stress include skin problems, stomach ulcers, high blood&lt;br&gt; pressure, fatigue, insomnia and frustration.&lt;br&gt; &lt;br&gt; We don&amp;#39;t need to set a time to reduce stress, we need to incorporate some&lt;br&gt; strategies in our daily life routine to prevent stress and reduce its effect&lt;br&gt; on the body.&lt;br&gt; &lt;br&gt;&lt;b&gt;&lt;span style="font-family: comic sans ms,sans-serif;"&gt; Here are 11 simple steps we can easily take to reduce stress:&lt;/span&gt;&lt;/b&gt;&lt;br&gt; &lt;br&gt; &lt;b style="color: rgb(0, 0, 153);"&gt;1. Define your goals:&lt;/b&gt; We must define our life goals and begin to achieve&lt;br&gt; these goals; this action will support us against stress because we will feel&lt;br&gt; that we know what our life purpose is and why, and that we control our own&lt;br&gt; lives.&lt;br&gt; &lt;br&gt; &lt;b style="color: rgb(0, 0, 153);"&gt;2. Take control of your diet:&lt;/b&gt; we can use simple ways in our diet plans to&lt;br&gt; reduce stress by avoiding some stimulants such as coffee, alcohol, tea and&lt;br&gt; sugar and we can use chamomile tea as an alternative because of its calming&lt;br&gt; and relaxing effect.&lt;br&gt; We need to eat slowly in a calm environment to allow our digestive system to&lt;br&gt; work well.&lt;br&gt; We can use honey as an alternative to sugar but in small amounts (one or two&lt;br&gt; spoonfuls per day).&lt;br&gt; &lt;br&gt; &lt;b style="color: rgb(0, 0, 153);"&gt;3. Take hot baths regularly: &lt;/b&gt; After a very busy day or when we feel that we&lt;br&gt; need to relax (I do this three times a week).&lt;br&gt; You can take a hot bath by sitting in warm to hot water and the water level&lt;br&gt; should be above the waist, using lavender oil can also enhance this relaxing&lt;br&gt; experience.&lt;br&gt; &lt;br&gt; &lt;b style="color: rgb(0, 0, 153);"&gt;4. Aromatherapy:&lt;/b&gt; in the office you can use aromatherapy to relax and avoid&lt;br&gt; stress.&lt;br&gt; One of the best ways is to use lavender oil on a source of heat and take in&lt;br&gt; the scent; this is a great way to relax during the day when you need it the&lt;br&gt; most.&lt;br&gt; &lt;br&gt; &lt;b style="color: rgb(0, 0, 153);"&gt;5. Exercise:&lt;/b&gt; This is one of the important things you can do which will&lt;br&gt; reduce stress and bring happiness.&lt;br&gt; When we exercise, our brains release substances which bring feelings of&lt;br&gt; happiness and relaxation; we need engage in some exercise regularly such as&lt;br&gt; walking, dancing or swimming.&lt;br&gt; &lt;br&gt; &lt;b style="color: rgb(0, 0, 153);"&gt;6. Breathing techniques:&lt;/b&gt; Yoga, meditation and Tai Chi all use deep breathing&lt;br&gt; techniques.&lt;br&gt; To meditate, simply sit with closed eyes and concentrate on your breathing.&lt;br&gt; Breathing deeply regularly is great for health and from there, you can learn&lt;br&gt; various other breathing techniques to gain enhanced benefits.&lt;br&gt; &lt;br&gt; &lt;b style="color: rgb(0, 0, 153);"&gt;7. Relaxation techniques and self hypnotherapy:&lt;/b&gt; we can easily do this after&lt;br&gt; the hot bath to relax even more, simply sit or lie down in a comfortable&lt;br&gt; place with your eyes closed, imagine there is a spot light above your head&lt;br&gt; and concentrate on it, then concentrate on your body part by part and try to&lt;br&gt; relax the body and feel the relaxation deepening -- you can also use a self&lt;br&gt; hypnotherapy audio tape to help in this process.&lt;br&gt; &lt;br&gt; &lt;b&gt;8. Massage:&lt;/b&gt;  This is a great way to reduce stress, I do this when other ways&lt;br&gt; fail, I feel better after receiving a massage.&lt;br&gt; You can get a professional massage or you can simply ask your partner to&lt;br&gt; massage you.&lt;br&gt; &lt;br&gt; &lt;b style="color: rgb(204, 153, 51);"&gt;9. Spiritual healing:&lt;/b&gt; Prayers and the act of helping others are very&lt;br&gt; important components for happiness and stress reduction.&lt;br&gt; You will feel calmer and have a sense of inner peace.&lt;br&gt; &lt;b&gt;&lt;br&gt; 10. Talking through your problems:&lt;/b&gt; talking about your feelings acts as a&lt;br&gt; releasing mechanism and you will soon find that talking about your problems&lt;br&gt; with your partner or best friend may help the solution to the problem come&lt;br&gt; to light and will help to release blocked emotions.&lt;br&gt; &lt;b&gt;&lt;br&gt; 11. Multivitamins:&lt;/b&gt; I take a Vitamin B complex regularly to decrease stress&lt;br&gt; and this has been a great help in my stress reduction.&lt;br&gt; &lt;br&gt; I hope that you find these suggestions helpful, my hope in sharing this&lt;br&gt; information with you is that you can benefit from it.&lt;br&gt; Reading about this is not enough to reduce stress, you must take&lt;br&gt; action...!!!&lt;br&gt;&lt;a href="http://groups.yahoo.com/group/sweetcrazyboy/join" target="_blank"&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-163519571349676496?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/163519571349676496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/09/eleven-great-ways-to-reduce-stress.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/163519571349676496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/163519571349676496'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/09/eleven-great-ways-to-reduce-stress.html' title='Eleven Great Ways to Reduce Stress'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-2563573629537986604</id><published>2009-08-31T15:10:00.000+05:30</published><updated>2009-08-31T15:17:53.480+05:30</updated><title type='text'>FILE STATUS handling in COBOL</title><content type='html'>FILE STATUS (error handling)&lt;br&gt;===========================&lt;p&gt;A number of errors can occur that result from file input/output that&lt;br&gt;programmer may wish to be able to deal with in order to avoid&lt;br&gt;unexpected program termination.&lt;p&gt;&lt;br&gt;Run time errors can arise quite easily from a file not being available&lt;br&gt;to open, or if present the data is corrupted. Furthermore, what if&lt;br&gt;there is no more disk space available or not enough space has been&lt;br&gt;allocated to allow for addtition of new data. Other errors, such as&lt;br&gt;attempting to close a file that isn&amp;#39;t open, or to read a file opened&lt;br&gt;for output only, may well derive from logical errors (that is,&lt;br&gt;programming mistakes) but can be dealt with nonetheless when&lt;br&gt;debugging. These kinds of errors will normally result in termination&lt;br&gt;of the program run, whereas using File Status can allow the programmer&lt;br&gt;to deal with any such problems without the program run stopping and&lt;br&gt;returning to the operating system.&lt;p&gt;File Status Codes are made of two digits, the first indicates one one&lt;br&gt;of 5 classes:&lt;p&gt;0 ----&amp;gt; Input/output operation successful&lt;br&gt;1 ----&amp;gt; File &amp;quot;at end&amp;quot; condition&lt;br&gt;2 ----&amp;gt; Invalid key&lt;br&gt;3 ----&amp;gt; Permanent I/O error&lt;br&gt;4 ----&amp;gt; Logic error&lt;p&gt;The second digit refers to the particular case within the class. Here&lt;br&gt;are examples common to both Microfocus and Fujitsu compilers (although&lt;br&gt;there are more besides). I would check your compiler documentation.&lt;br&gt;----------------------------------------------------------------------------------------&lt;br&gt; Code                                 Meaning&lt;br&gt;----------------------------------------------------------------------------------------&lt;br&gt;  00  ---&amp;gt;       Input/output operation successful&lt;br&gt;  02  ---&amp;gt;       Duplicate record key found (READ ok)&lt;br&gt;  04  ---&amp;gt;       Length of record too large (READ ok)&lt;br&gt;  10  ---&amp;gt;       File AT END&lt;br&gt;  14  ---&amp;gt;       &amp;quot;The valid digits of a read relative record&lt;br&gt;                           number are greater than the size of the relative&lt;br&gt;                           key item of the file.&amp;quot;&lt;br&gt;  16  ---&amp;gt;      Program tries to read file already AT END&lt;br&gt;  22  ---&amp;gt;      Program attempts to write a record&lt;br&gt;                                    with a key that already exists&lt;br&gt;  23  ---&amp;gt;      Record not found&lt;br&gt;  24  ---&amp;gt;      Program attempts to write record to a disk that is full&lt;br&gt;  30  ---&amp;gt;      Input/output operation unsuccessful,&lt;br&gt;                                           no further information available&lt;br&gt;  34  ---&amp;gt;      Program attempts to write record to a disk that is full&lt;br&gt;  35  ---&amp;gt;      Program tries to open non-existant file&lt;br&gt;                                          for INPUT, I-O or EXTEND&lt;br&gt;  37  ---&amp;gt;      Program tries to open line sequential file in I-O mode&lt;br&gt;  41  ---&amp;gt;      Program tries to open file that is already open&lt;br&gt;  42  ---&amp;gt;      Program tries to close file that is not open&lt;br&gt;  43  ---&amp;gt;      Program tries to delete or rewrite a record&lt;br&gt;                                                       that has not been read&lt;br&gt;  44  ---&amp;gt;     Program tries to write or rewrite a record of incorrect length&lt;br&gt;  46  ---&amp;gt;      Program tries to read a record where the previous read or&lt;br&gt;                            START has failed or the AT END condition&lt;br&gt;has occurred&lt;br&gt;  47  ---&amp;gt;      Program tries to read a record from a file opened&lt;br&gt;                                                 in the incorrect mode&lt;br&gt;  48  ---&amp;gt;      Program tries to write a record from a file opened&lt;br&gt;                                                             in the&lt;br&gt;incorrect mode&lt;br&gt;  49  ---&amp;gt;      Program tries to delete or rewrite a record from a file opened&lt;br&gt;                                                                  in&lt;br&gt;the incorrect mode&lt;br&gt;-------------------------------------------------------------------------------------------&lt;br&gt;To use these codes you need to include the FILE STATUS clause in the&lt;br&gt;SELECT statement of the environment division:&lt;p&gt;SELECT TEST-FILE ASSIGN TO &amp;#39;TEST-DATA.DAT&amp;#39;&lt;br&gt;ORGANIZATION IS SEQUENTIAL&lt;br&gt;FILE STATUS IS W-STATUS.&lt;p&gt;Of course W-STATUS could any user name you like. It must however be&lt;br&gt;defined in working storage as PIC XX, i.e. as alpha numeric and not&lt;br&gt;numeric. So, if during a program run a certain input/output error&lt;br&gt;occurs, rather than the program terminate, the program will simply&lt;br&gt;produce an error status.&lt;p&gt;code:&lt;p&gt;*&lt;br&gt;Here a possible danger of too big a record being moved into W-RECORD&lt;br&gt;READ RECORD-IN INTO W-RECORD&lt;br&gt;IF W-STATUS = &amp;quot;04&amp;quot; THEN&lt;br&gt;DISPLAY &amp;quot;Over-sized record has been read&amp;quot;&lt;br&gt;SET REC-XS-FLAG TO TRUE&lt;br&gt;END-IF&lt;p&gt;&lt;br&gt;Another example might be, when reading from an indexed file:&lt;br&gt;READ IN-FILE&lt;br&gt;IF W-STATUS = &amp;quot;23&amp;quot; THEN&lt;br&gt;DISPLAY &amp;quot;Record not found&amp;quot;&lt;br&gt;ELSE PERFORM MAIN-PROCESS&lt;p&gt;&lt;br&gt;You could have easily have written:&lt;br&gt;READ IN-FILE&lt;br&gt;                      INVALID KEY&lt;br&gt;       DISPLAY &amp;quot;Record not found&amp;quot;&lt;br&gt;          NOT INVALID KEY PERFORM MAIN-PROCESS&lt;br&gt;END-READ&lt;p&gt;&lt;br&gt;So consider which is the best option and remember not to try and do both.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-2563573629537986604?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/2563573629537986604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/file-status-handling-in-cobol.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/2563573629537986604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/2563573629537986604'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/file-status-handling-in-cobol.html' title='FILE STATUS handling in COBOL'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-3805522079853522740</id><published>2009-08-29T12:50:00.001+05:30</published><updated>2009-08-29T12:50:12.719+05:30</updated><title type='text'>File handling in COBOL - II</title><content type='html'>==================&lt;br&gt;SORT and MERGE&lt;br&gt;==================&lt;br&gt;If you wished to take a file of unordered records and produce a new&lt;br&gt;file of these records sorted into ascending or descending order of a&lt;br&gt;field you would use SORT.&lt;p&gt;The League table program in the Sample code section uses this utility&lt;br&gt;to generate a league table from updated records from a data file,&lt;br&gt;sorted principally by descending points.&lt;p&gt;Consider this segment of code from this program:&lt;p&gt;&lt;br&gt;000050 ENVIRONMENT DIVISION.&lt;br&gt;000060 INPUT-OUTPUT SECTION.&lt;br&gt;000070 FILE-CONTROL.&lt;br&gt;000080 SELECT TEAM-REC-IN ASSIGN TO &amp;quot;INPUT.REC&amp;quot;&lt;br&gt;000090 ORGANIZATION IS SEQUENTIAL.&lt;br&gt;000100 SELECT WORK-FILE ASSIGN TO SORTWK01.&lt;br&gt;000110 SELECT SORT-OUT ASSIGN TO &amp;quot;SORTED.REC&amp;quot;&lt;br&gt;000120 ORGANIZATION IS SEQUENTIAL.&lt;br&gt;000130 SELECT PRINT-FILE ASSIGN TO &amp;quot;PRINTOUT.TXT&amp;quot;.&lt;br&gt;000140&lt;br&gt;000150 000160 DATA DIVISION.&lt;br&gt;000170 FILE SECTION.&lt;br&gt;000180 FD TEAM-REC-IN.&lt;br&gt;000190 01 TEAM-REC.&lt;br&gt;000200 03 TEAM-CODE PIC XXX.&lt;br&gt;000210 03 TEAM-NAME PIC X(20).&lt;br&gt;000220 03 PLAYED PIC 99.&lt;br&gt;000230 03 GOALS-FOR PIC 99.&lt;br&gt;000240 03 GOALS-AGST PIC 99.&lt;br&gt;000250 03 G-WON PIC 99.&lt;br&gt;000260 03 G-LOST PIC 99.&lt;br&gt;000270 03 G-DRAWN PIC 99.&lt;br&gt;000280 03 GOAL-DIFF PIC S99 SIGN LEADING SEPARATE.&lt;br&gt;000290 03 POINTS PIC 99.&lt;br&gt;000300 000310 SD WORK-FILE.&lt;br&gt;000320 01 WORK-REC.&lt;br&gt;000330 03 TEAM-CODE-KEY PIC XXX.&lt;br&gt;000340 03 PIC X(22).&lt;br&gt;000350 03 GF-KEY PIC 99.&lt;br&gt;000360 03 PIC X(8).&lt;br&gt;000370 03 GD-KEY PIC S99 SIGN LEADING SEPARATE.&lt;br&gt;000380 03 POINTS-KEY PIC 99.&lt;p&gt;&lt;br&gt;In addition to the FD for the TEAM-REC-IN (the main data file) there&lt;br&gt;is also a WORK-FILE that the computer uses for sorting. Here it is&lt;br&gt;assigned to SORTWK01, required for the Fujitsu COBOL compiler, but for&lt;br&gt;MicroFocus you might code ASSIGN TO DISK or even ASSIGN TO&lt;br&gt;&amp;quot;B:TEMPFILE&amp;quot;.&lt;p&gt;The WORK-FILE does not have a FD descriptor, but rather, has a sort&lt;br&gt;descriptor SD.&lt;p&gt;&lt;br&gt;003310 SORT-TABLE.&lt;br&gt;003320 SORT WORK-FILE&lt;br&gt;003330 ON DESCENDING KEY POINTS-KEY GD-KEY GF-KEY&lt;br&gt;003340 USING TEAM-REC-IN&lt;br&gt;003350 GIVING SORT-OUT.&lt;p&gt;The SORT-TABLE paragraph then sorts the data file TEAM-REC-IN as shown&lt;br&gt;above. Note that the SORT verb is followed by WORK-FILE and that&lt;br&gt;TEAM-REC-IN is refered to with USING...&lt;p&gt;Since it is common for two teams to have the same number of points&lt;br&gt;then, the DESCENDING KEY first attempts to sort by points (POINTS-KEY)&lt;br&gt;but if these match then they are than sorted by goal difference&lt;br&gt;(GD-KEY) and then by goals scored (GF-KEY). If these all match then&lt;br&gt;the teams will be placed as the appear from the data file (for&lt;br&gt;TEAM-REC-IN I placed them in alphabetical order).&lt;p&gt;SORT-OUT is the destination of the sorted data where the new league&lt;br&gt;table would appear.&lt;p&gt;Note, a file that is to be sorted if already open, must be closed&lt;br&gt;prior to sorting. THE SORT STATEMENT WILL AUTOMATICALLY OPEN THE&lt;br&gt;UNSORTED FILE WHEN EXECUTED.&lt;p&gt;===========&lt;br&gt;MERGE&lt;br&gt;===========&lt;br&gt;To merge two sorted files into a single sorted file, the MERGE&lt;br&gt;statement is used:&lt;p&gt;&lt;br&gt; MERGE WORK-FILE&lt;br&gt; ON ASCENDING KEY CUS-CODE-KEY&lt;br&gt; USING FILE-A&lt;br&gt; FILE-B&lt;br&gt; GIVING MERGED-FILE&lt;p&gt;You can merge more than 2 files if you wish. An SD would be required&lt;br&gt;as used with a SORT&lt;p&gt;&lt;br&gt;----------------------------------------------------------------------------------------------------------&lt;br&gt;=============================&lt;br&gt;INPUT and OUTPUT PROCEDURE&lt;br&gt;==============================&lt;p&gt;The SORT statement above sorted all the records in the file into a new file.&lt;p&gt;But if you wanted to produce a sorted file that only contained, for&lt;br&gt;example, product numbers which begin with a &amp;#39;1&amp;#39;, you would use an&lt;br&gt;INPUT PROCEDURE.&lt;p&gt;The record FD might be:&lt;p&gt;FD UNSORTED-FILE.&lt;br&gt;        01 UNSORTED-RECORD.&lt;br&gt;                 03 1ST-DIGIT-OF-CODE PIC 9.&lt;br&gt;                 03 PIC X(20).&lt;p&gt;&lt;br&gt;The description gives the minimum detail required. Now some procedure division:&lt;p&gt;PROCEDURE DIVISION.&lt;br&gt;SORT-SELECT.&lt;br&gt;               SORT WORK-FILE&lt;br&gt;                     ON DESCENDING KEY PRODUCT-NO&lt;br&gt;                     INPUT PROCEDURE SELECT-PROD-CODE&lt;br&gt;                     GIVING SORTED-CODES-FILE&lt;br&gt;               STOP RUN.&lt;p&gt;&lt;br&gt;The INPUT PROCEDURE clause acts like a PERFORM, indicating the logic&lt;br&gt;to go to a different paragraph (i.e. procedure).&lt;p&gt;So the paragraph SELECT-PROD-CODE might be like this:&lt;p&gt;SELECT-PROD-CODE.&lt;br&gt;                    OPEN INPUT UNSORTED-DATA-FILE&lt;br&gt;                    PERFORM UNTIL END-OF-FILE&lt;br&gt;                          READ UNSORTED-DATA-FILE&lt;br&gt;                                                           AT END MOVE&lt;br&gt;&amp;#39;Y&amp;#39; TO EOF-FLAG&lt;br&gt;                                                           NOT AT END&lt;br&gt;                               IF 1ST-DIGIT-OF-CODE = 1 THEN&lt;br&gt;                                  MOVE UNSORTED-RECORD TO WORK-REC&lt;br&gt;                                  RELEASE WORK-REC&lt;br&gt;                               END-IF&lt;br&gt;                         END-READ&lt;br&gt;                    END-PERFORM&lt;br&gt;                  CLOSE UNSORTED-DATA-FILE&lt;p&gt;&lt;br&gt;When the if condition is true, the record is moved to the work-file&lt;br&gt;(WORK-REC is the level 01 name) by the RELEASE verb, even though the&lt;br&gt;MOVE verb appears first (I dunno why..!). Unlike a simple SORT, you DO&lt;br&gt;have to OPEN the unsorted file prior to an input procedure.&lt;p&gt;OUTPUT PROCEDURE&lt;p&gt;&lt;br&gt;If you just want to print specific sorted fields you would use an&lt;br&gt;OUTPUT PROCEDURE. Based on the above example:&lt;p&gt;PROCEDURE DIVISION.&lt;br&gt;PRINT-SORT-REC.&lt;br&gt;                          SORT WORK-FILE&lt;br&gt;                                       ON DESCENDING KEY PRODUCT-NO&lt;br&gt;                                     USING UNSORTED-RECORD&lt;br&gt;                                  OUTPUT PROCEDURE PRINT-SELECT-PROD-CODE&lt;br&gt;                                   STOP RUN.&lt;p&gt;&lt;br&gt;The INPUT PROCEDURE clause acts like a PERFORM, indicating the logic&lt;br&gt;to go to a different paragraph (i.e. procedure).&lt;p&gt;So the paragraph SELECT-PROD-CODE might be like this:&lt;p&gt;SELECT-PROD-CODE.&lt;br&gt;                              OPEN OUTPUT PRINT-FILE&lt;br&gt;                             PERFORM UNTIL END-OF-FILE&lt;br&gt;                                               RETURN UNSORTED-DATA-FILE&lt;br&gt;                                                AT END MOVE &amp;#39;Y&amp;#39; TO EOF-FLAG&lt;br&gt;                                                           NOT AT END&lt;br&gt;                                                          {move fields&lt;br&gt;in SD sort group to print fields}...&lt;br&gt;                                                       WRITE PRINT-RECORD FROM&lt;br&gt;                                                                  {print group}&lt;br&gt;                                                 END-RETURN&lt;br&gt;                             END-PERFORM&lt;br&gt;                             CLOSE PRINT-FILE.&lt;p&gt;&lt;br&gt;Instead of READ you use RETURN and then WRITE the record&lt;br&gt; to the printer rather than RELEASE the record to a file.&lt;p&gt;You can combine INPUT and OUTPUT procedures into the same sort&lt;br&gt;statement by replacing both the USING and GIVING statements:&lt;p&gt;&lt;br&gt;           SORT WORK-FILE   ON DESCENDING KEY  PRODUCT-NO&lt;br&gt;                      INPUT PROCEDURE   SELECT-PROD-CODE&lt;br&gt;                   OUTPUT PROCEDURE   PRINT-SELECT-PROD-CODE&lt;br&gt;             STOP RUN.&lt;p&gt;&lt;br&gt;------------------------------------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-3805522079853522740?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/3805522079853522740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/file-handling-in-cobol-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/3805522079853522740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/3805522079853522740'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/file-handling-in-cobol-ii.html' title='File handling in COBOL - II'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-8470033781703606075</id><published>2009-08-26T17:04:00.001+05:30</published><updated>2009-08-26T17:04:32.434+05:30</updated><title type='text'>FILE Handling in COBOL</title><content type='html'>File Handling&lt;br&gt;===============&lt;p&gt;This section outlines how data can read from and written to files, how&lt;br&gt;records are organized within a file and how records can be manipulated&lt;br&gt;(e.g. sorting, merging).&lt;p&gt;&lt;br&gt;1)Reading and Writing&lt;br&gt;-----------------------------&lt;br&gt;In order to either read, alter or create a new file, we must first&lt;br&gt;open it (even if it doesn&amp;#39;t even exist yet). In doing so, a open mode&lt;br&gt;must be defined.&lt;p&gt;To simply read data from an existing file it would be opened in INPUT&lt;br&gt;mode. In this mode, the file is read-only and cannot be altered in any&lt;br&gt;way.&lt;br&gt;If writing to new file, i.e. creating one (or overwriting an existing&lt;br&gt;file so be careful) the new file would be opened in OUTPUT mode. You&lt;br&gt;cannot read data from a file opened in OUTPUT mode.&lt;br&gt;EXTEND mode allows for records to be added to the end of an existing file.&lt;br&gt;I-O mode is for input and output access to the file, such as when you&lt;br&gt;wish to update a record, or delete a record.&lt;p&gt;When a file is no longer required, the file needs to be closed again&lt;br&gt;(using CLOSE). You can open and close a file as often as you like&lt;br&gt;during a program run, although bear in mind that each time you open a&lt;br&gt;file the computer will read from the first record onwards (in INPUT&lt;br&gt;and I-O mode) or will overwrite in OUTPUT mode.&lt;p&gt;&lt;p&gt;OPEN {INPUT or OUTPUT or I-O or EXTEND} {filename-1}...&lt;br&gt;           {INPUT or OUTPUT or I-O or EXTEND} {filename-2}...&lt;p&gt;&lt;br&gt;e.g.&lt;p&gt;&lt;br&gt;     OPEN INPUT DATA-1-FILE DATA-2-FILE&lt;br&gt;          OUTPUT NEW-DATA-FILE&lt;br&gt;		&lt;br&gt;     CLOSE DATA-1-FILE DATA-2-FILE NEW-DATA-FILE&lt;p&gt;  READ&lt;br&gt;=============&lt;br&gt;The READ statement will read the data from a file, taking precisely&lt;br&gt;the data that is defined in the file descriptor (FD) in the data&lt;br&gt;division (file section) (see The Four Divisions section).&lt;br&gt;The format is:&lt;p&gt;&lt;br&gt;READ {FD filename}&lt;br&gt;      AT END {statements}&lt;br&gt;      NOT AT END {statements}&lt;br&gt;END-READ&lt;p&gt;&lt;p&gt;Since a file would likely contain more than one record, the READ&lt;br&gt;statement is often contained within a PERFORM loop:&lt;p&gt;&lt;br&gt;IDENTIFICATION DIVISION.&lt;br&gt;PROGRAM-ID. READ-EXAMPLE.&lt;br&gt;AUTHOR ZINGMATTER.&lt;br&gt;ENVIRONMENT DIVISION.&lt;br&gt;INPUT-OUTPUT SECTION.&lt;br&gt;FILE-CONTROL.&lt;br&gt;                  ASSIGN IN-FILE TO &amp;#39;A:CUSTOMER.DAT&amp;#39;&lt;br&gt;                  ORGANIZATION IS LINE SEQUENTIAL.&lt;br&gt;                  ASSIGN PRINT-FILE TO PRINTER.&lt;br&gt; DATA DIVISION.&lt;br&gt;FILE SECTION.&lt;br&gt;FD IN-FILE.&lt;br&gt;               01 CUSTOMER-DETAILS.&lt;br&gt;                    03 CUS-NAME PIC X(20).&lt;br&gt;                    03 CUS-NUM PIC 9(6).&lt;p&gt;FD PRINT-FILE.&lt;br&gt;01 PRINT-REC PIC X(60).&lt;p&gt;WORKING-STORAGE SECTION.&lt;br&gt;         01 EOF-FLAG PIC X.&lt;br&gt;                88 END-OF-IN-FILE VALUE &amp;#39;Y&amp;#39;.&lt;br&gt;         01 P-CUS-DETAILS&lt;br&gt;                03 PIC X(5) VALUE SPACES.&lt;br&gt;                03 P-NAME PIC X(25).&lt;br&gt;                03 P-NUM PIC Z(5)9.&lt;p&gt;PROCEDURE DIVISION.&lt;br&gt;MAIN-PARAGRAPH.&lt;br&gt;OPEN INPUT IN-FILE&lt;br&gt;***********************&amp;quot;Prime&amp;quot; read&lt;br&gt;READ IN-FILE&lt;br&gt;                  AT END MOVE &amp;#39;Y&amp;#39; TO EOF-FLAG&lt;br&gt;                  NOT AT END PERFORM PRINT-DETAILS&lt;br&gt;END-READ&lt;br&gt;***********Main reading loop&lt;br&gt;PERFORM UNTIL END-OF-IN-FILE&lt;br&gt;    READ IN-FILE&lt;br&gt;                 AT END MOVE &amp;#39;Y&amp;#39; TO EOF-FLAG&lt;br&gt;                 NOT AT END PERFORM PRINT-DETAILS&lt;br&gt;    END-READ&lt;br&gt;END-PERFORM&lt;br&gt;STOP RUN.&lt;p&gt;PRINT-DETAILS.&lt;br&gt;        MOVE CUS-NAME TO P-NAME&lt;br&gt;        MOVE CUS-NUM TO P-NUM&lt;br&gt;        WRITE PRINT-REC FROM P-CUS-DETAILS AFTER 1 LINE.&lt;p&gt;&lt;br&gt;* A record containing a customer name (CUS-NAME) and the customer&lt;br&gt;number (CUS-NUM) are read from a file customer.dat assign to IN-FILE.&lt;p&gt;* The file is opened for INPUT (i.e. read-only).&lt;p&gt;* The &amp;quot;prime read&amp;quot; refered to in the comment is the initial read of&lt;br&gt;IN-FILE that allows for the possibility that the file contains no&lt;br&gt;records.&lt;p&gt;* The AT END clause tests for the end of file condition. When true, a&lt;br&gt;series of statements can then be executed. Likewise, the NOT AT END&lt;br&gt;clause allows for a series of statements to be executed when this&lt;br&gt;condition is true. In the above example, when the file contains no&lt;br&gt;more records (i.e. is at the end of the file) &amp;#39;Y&amp;#39; is moved to&lt;br&gt;EOF-FLAG, thereby making the condition name condition (END-OF-IN-FILE)&lt;br&gt;true. When not at the end of the file, a record is read into memory&lt;br&gt;and the paragraph PRINT-DETAILS is executed.&lt;p&gt;* The statements between PERFORM UNTIL... and END-PERFORM are executed&lt;br&gt;until the END-OF-IN-FILE condition is true (when the AT END of the&lt;br&gt;read statement is true).&lt;p&gt;If you want to place data from a record into an item in&lt;br&gt;WORKING-STORAGE (in addition to the memory space already allocated to&lt;br&gt;the same data defined in the data division - so not much call for it),&lt;br&gt;then use READ ... INTO. i.e:&lt;p&gt;&lt;br&gt;    READ IN-FILE INTO W-RECORD-IN&lt;p&gt;&lt;br&gt;2) REWRITE, DELETE, and EXTEND&lt;br&gt;==============================&lt;p&gt;In order to ammend a record in a file, such as to update data (see&lt;br&gt;League Table Program in sample programs section), to delete a record&lt;br&gt;altogther, or to add a record to the end of a file, you can use&lt;br&gt;REWRITE, DELETE or EXTEND, respectively.&lt;p&gt;However, to use REWRITE or DELETE you must open the file using I-O&lt;br&gt;mode. Also, DELETE can only be used on files with RELATIVE or INDEXED&lt;br&gt;organization (see example below).&lt;p&gt;RELATIVE and INDEXED files are discussed in the following section&lt;p&gt;The format of the DELETE statement is:&lt;p&gt;DELETE filename&lt;br&gt;                      ON INVALID KEY&lt;br&gt;{statements}&lt;br&gt;                     NOT ON INVALID KEY&lt;br&gt;{statements}&lt;p&gt;END-DELETE&lt;p&gt;&lt;br&gt;ON INVALID KEY means the record was not found, so you might want to&lt;br&gt;display an error message&lt;p&gt;e.g. DISPLAY &amp;#39;RECORD NOT FOUND&amp;#39;&lt;p&gt;To REWRITE you can refer to the level 01 name to change the record&lt;br&gt;with the ammended field:&lt;p&gt;FD IN-FILE&lt;br&gt;01 RECORD-IN.&lt;br&gt; 03 IN-NAME PIC X(20).&lt;br&gt; 03 IN-ADDRESS PIC X(60).&lt;p&gt;PROCEDURE DIVISION.&lt;br&gt;MAIN-PARAGRAPH.&lt;br&gt; :&lt;p&gt; OPEN I-O IN-FILE&lt;br&gt; :&lt;p&gt; READ IN-FILE&lt;p&gt; IF IN-NAME = &amp;#39;BILLY NOMATES&amp;#39; THEN&lt;br&gt; MOVE &amp;#39;JIMMY MOREPALS&amp;#39; TO IN-NAME&lt;br&gt; REWRITE RECORD-IN&lt;br&gt; ELSE&lt;br&gt; DISPLAY IN-NAME&lt;br&gt; END-IF&lt;br&gt; :&lt;p&gt;To EXTEND you must open the file in EXTEND mode:&lt;p&gt; OPEN EXTEND IN-FILE&lt;br&gt; :&lt;p&gt; DISPLAY &amp;#39;Type in new name&amp;#39;&lt;br&gt; ACCEPT NEW-NAME&lt;br&gt;MOVE NEW-NAME TO IN-NAME&lt;br&gt; EXTEND IN-FILE&lt;p&gt; DISPLAY &amp;#39;Type in new address&amp;#39;&lt;br&gt; ACCEPT NEW-ADDRESS&lt;br&gt; MOVE NEW-ADDRESS TO IN-ADDRESS&lt;br&gt; EXTEND IN-FILE&lt;br&gt; :&lt;p&gt;Here is a sample program that deletes a record from an INDEXED file&lt;br&gt;using the DELETE statement, followed by deletion of a record that does&lt;br&gt;not use the DELETE statement but writes the whole file (less the&lt;br&gt;record to be deleted) to a temporary file. The program asks for a six&lt;br&gt;digit code that identifies the record to be removed from the file. If&lt;br&gt;you want to try this program then you&amp;#39;ll need to create a couple of&lt;br&gt;test files: TESTDATA1.DAT and TESTDATA2.TXT.&lt;p&gt;TESTDATA1.DAT needs to be an indexed file. To create this you&amp;#39;ll need&lt;br&gt;to compile and run the Create INDEXED file program and Read INDEXED&lt;br&gt;file program (both in the Sample Code section).&lt;p&gt;TESTDATA2.TXT should be LINE SEQUENTIAL and of the form:&lt;p&gt;CODE--SOME ENTRY OF 43 CHARACTERS&lt;br&gt;123456abc----------**********----------**********&lt;br&gt;:&lt;br&gt;:&lt;p&gt;&lt;br&gt;Sample program :-&lt;br&gt;-------------------&lt;br&gt;IDENTIFICATION DIVISION.&lt;br&gt;PROGRAM-ID. DELETION-EXAMPLE.&lt;br&gt;AUTHOR. TIM-R-P-BROWN.&lt;br&gt;* Program that deletes a record from a&lt;br&gt;000050* file where the specified record ID code is entered&lt;br&gt;000060* by the user. 2 differing methods are used.&lt;br&gt;000070&lt;br&gt;000080 ENVIRONMENT DIVISION.&lt;br&gt;000090&lt;br&gt;000100 INPUT-OUTPUT SECTION.&lt;br&gt;000110 FILE-CONTROL.&lt;br&gt;000120 000130 SELECT IN-FILE-1 ASSIGN TO &amp;#39;TESTDATA1.DAT&amp;#39;&lt;br&gt;000140 ORGANIZATION IS INDEXED&lt;br&gt;000150 ACCESS MODE IS DYNAMIC&lt;br&gt;000160 RECORD KEY IS RECORD-CODE-1.&lt;br&gt;000170 SELECT IN-FILE-2 ASSIGN TO &amp;#39;TESTDATA2.TXT&amp;#39;&lt;br&gt;000180 ORGANIZATION IS LINE SEQUENTIAL.&lt;br&gt;000190 SELECT TEMP-FILE ASSIGN TO &amp;#39;TEMP.TXT&amp;#39;&lt;br&gt;000200 ORGANIZATION IS LINE SEQUENTIAL.&lt;br&gt;000210 000220 DATA DIVISION.&lt;br&gt;000230 FILE SECTION.&lt;br&gt;000240 000250 FD IN-FILE-1.&lt;br&gt;000260 01 RECORD-1.&lt;br&gt;000270 03 RECORD-CODE-1 PIC X(6).&lt;br&gt;000280 03 RECORD-DETAILS-1 PIC X(43).&lt;br&gt;000290 000300 FD IN-FILE-2.&lt;br&gt;000310 01 RECORD-2.&lt;br&gt;000320 03 RECORD-CODE-2 PIC X(6).&lt;br&gt;000330 03 RECORD-DETAILS-2 PIC X(43).&lt;br&gt;000340 000350 FD TEMP-FILE.&lt;br&gt;000360 01 TEMP-RECORD.&lt;br&gt;000370 03 TEMP-CODE PIC X(6).&lt;br&gt;000380 03 TEMP-DETAILS PIC X(43).&lt;br&gt;000390 000400&lt;br&gt;000410 000420 WORKING-STORAGE SECTION.&lt;br&gt;000430 000440 01 END-OF-FILE-FLAG PIC X VALUE &amp;#39;N&amp;#39;.&lt;br&gt;000450 88 EOF VALUE &amp;#39;Y&amp;#39;.&lt;br&gt;000460 000470 01 REC-DELETE-FLAG PIC X VALUE &amp;#39;N&amp;#39;.&lt;br&gt;000480 88 RECORD-DELETED VALUE &amp;#39;Y&amp;#39;.&lt;br&gt;000490&lt;br&gt;000500 01 DEL-CODE PIC X(6) VALUE SPACES.&lt;br&gt;000510 000520&lt;br&gt;000530&lt;br&gt;000540 PROCEDURE DIVISION.&lt;br&gt;000550 000560 MAIN-PARAGRAPH.&lt;br&gt;000570 000580 PERFORM FIRST-METHOD&lt;br&gt;000590 MOVE &amp;#39;Y&amp;#39; TO END-OF-FILE-FLAG&lt;br&gt;000600 PERFORM SECOND-METHOD&lt;br&gt;000610 STOP RUN.&lt;br&gt;000620 000630***********************************************************&lt;br&gt;000640 000650 FIRST-METHOD.&lt;br&gt;000660* Paragraph that uses the DELETE to remove a record&lt;br&gt;000670 000680 DISPLAY &amp;#39;Enter 6 digit code of record to be deleted&amp;#39;&lt;br&gt;000690 ACCEPT RECORD-CODE-1&lt;br&gt;000700 OPEN I-O IN-FILE-1&lt;br&gt;000710 000720 000730 DELETE IN-FILE-1&lt;br&gt;000740 INVALID KEY DISPLAY &amp;#39;RECORD NOT FOUND&amp;#39;&lt;br&gt;000750&lt;br&gt;000760 END-DELETE&lt;br&gt;000770&lt;br&gt;000780&lt;br&gt;000790 CLOSE IN-FILE-1.&lt;br&gt;000800 000810***********************************************************&lt;br&gt;000820 000830 SECOND-METHOD.&lt;br&gt;000840* Paragraph that writes to a temporary file without&lt;br&gt;000850* including the record to be deleted&lt;br&gt;000860 000870 DISPLAY &amp;#39;Enter 6 digit code of record to be deleted&amp;#39;&lt;br&gt;000880 ACCEPT DEL-CODE&lt;br&gt;000890 OPEN INPUT IN-FILE-2&lt;br&gt;000900 OUTPUT TEMP-FILE&lt;br&gt;000910 000920 MOVE &amp;#39;N&amp;#39; TO REC-DELETE-FLAG&lt;br&gt;000930 MOVE &amp;#39;N&amp;#39; TO END-OF-FILE-FLAG&lt;br&gt;000940 000950*----first write all records (except the selected one) to&lt;br&gt;000960*----the temporary file&lt;br&gt;000970 PERFORM UNTIL EOF&lt;br&gt;000980 READ IN-FILE-2&lt;br&gt;000990 AT END SET EOF TO TRUE&lt;br&gt;001000 NOT AT END&lt;br&gt;001010 IF RECORD-CODE-2 = DEL-CODE THEN&lt;br&gt;001020 SET RECORD-DELETED TO TRUE&lt;br&gt;001030 ELSE&lt;br&gt;001040 WRITE TEMP-RECORD FROM RECORD-2&lt;br&gt;001050 END-IF&lt;br&gt;001060 END-READ&lt;br&gt;001070 END-PERFORM&lt;br&gt;001080 001090 001100 001110 IF NOT RECORD-DELETED THEN&lt;br&gt;001120 DISPLAY &amp;#39;Record not found&amp;#39;&lt;br&gt;001130 END-IF&lt;br&gt;001140 001150 CLOSE IN-FILE-2 TEMP-FILE&lt;br&gt;001160 001170 MOVE &amp;#39;N&amp;#39; TO END-OF-FILE-FLAG&lt;br&gt;001180 001190*----now read all records from temp-file to a new &amp;#39;TESTDATA-2.TXT&amp;#39;&lt;br&gt;001200*----This is virtually the same as just renaming the temporary file&lt;br&gt;001210*----when you think about it, just done the COBOL way!&lt;br&gt;001220 OPEN INPUT TEMP-FILE&lt;br&gt;001230 OUTPUT IN-FILE-2&lt;br&gt;001240*---------the original &amp;#39;TESTDATA-2.TXT&amp;#39; will be overwritten-----*&lt;br&gt;001250 001260 PERFORM UNTIL EOF&lt;br&gt;001270 READ TEMP-FILE&lt;br&gt;001280 AT END SET EOF TO TRUE&lt;br&gt;001290 NOT AT END&lt;br&gt;001300 WRITE RECORD-2 FROM TEMP-RECORD&lt;br&gt;001310 END-READ&lt;br&gt;001320 END-PERFORM&lt;br&gt;001330 001340 CLOSE TEMP-FILE IN-FILE-2.&lt;br&gt;001350 001360***********************************************************&lt;br&gt;001370***********************************************************&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-8470033781703606075?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/8470033781703606075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/file-handling-in-cobol.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/8470033781703606075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/8470033781703606075'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/file-handling-in-cobol.html' title='FILE Handling in COBOL'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-1510157676649677864</id><published>2009-08-21T14:11:00.002+05:30</published><updated>2009-08-26T16:10:34.666+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='COBOL TUTORIAL'/><title type='text'>Common COBOL verbs / Statements - II</title><content type='html'>=============&lt;br /&gt;# Arithmetic&lt;br /&gt;=============&lt;p&gt;To perform arithmetic calculations there are two ways of going about doing this:&lt;/p&gt;&lt;p&gt;using the ADD, SUBTRACT, MULITPLY, DIVIDE verbs, or using the COMPUTE&lt;br /&gt;verb as seen already. The formats for the first group are as follows:&lt;br /&gt;[square brackets indicate optional words]&lt;/p&gt;&lt;p&gt;&lt;br /&gt;ADD {identifier-1 or literal}... TO {identifier-2 or literal}...&lt;br /&gt;      [GIVING {identifier-3}]&lt;br /&gt;      [NOT] [ON SIZE ERROR {statements}]&lt;br /&gt;[END-ADD]&lt;/p&gt;&lt;p&gt;Examples:&lt;br /&gt;ADD NUM-A TO NUM-B GIVING NUM-TOTAL-1&lt;br /&gt;ADD NUM-A, 20 TO NUM-B GIVING NUM-TOTAL-2&lt;br /&gt;ADD 3 TO NUM-TOTAL-3&lt;/p&gt;&lt;p&gt;When the word GIVING is not used (as in the third example) the&lt;br /&gt;identifier that follows 'TO' is where the result of the addition. This&lt;br /&gt;also applies to SUBTRACT and MULTIPLY. ON SIZE ERROR is a conditional,&lt;br /&gt;whereby if the result of the calculation is larger than the PIC&lt;br /&gt;description (i.e. the result is truncated either at the leading end or&lt;br /&gt;the decimal places). On such an occasion a series of statements can be&lt;br /&gt;executed. The use of ON SIZE ERROR means that a scope terminator is&lt;br /&gt;required (END-ADD). The second example adds both NUM-A and 20 to&lt;br /&gt;NUM-B.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;SUBTRACT {identifier-1 or literal}... FROM {identifier-2 or literal}...&lt;br /&gt;      [GIVING {identifier-3}]&lt;br /&gt;      [NOT] [ON SIZE ERROR {statements}]&lt;br /&gt;[END-SUBTRACT]&lt;/p&gt;&lt;p&gt;Examples:&lt;br /&gt;SUBTRACT 200 FROM NUM-C GIVING NUM-D&lt;br /&gt;    ON SIZE ERROR DISPLAY 'NUM-D is out of range'&lt;br /&gt;END-SUBTRACT&lt;br /&gt;SUBTRACT NUM-F FROM 20       ** this won't work! **&lt;/p&gt;&lt;p&gt;The second example is illegal because, in the absence of a receiving&lt;br /&gt;identifier after GIVING, the result of the subtraction has nowhere to&lt;br /&gt;go (20 is a literal). The same would apply to ADD and MULTIPLY.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;MULTIPLY {identifier-1 or literal}... BY {identifier-2 or literal}...&lt;br /&gt;      [GIVING {identifier-3}][ROUNDED]&lt;br /&gt;      [NOT] [ON SIZE ERROR {statements}]&lt;br /&gt;[END-MULTIPLY]&lt;/p&gt;&lt;p&gt;Examples:&lt;br /&gt;MULTIPLY NUM-G BY 20 GIVING NUM-F&lt;br /&gt;MULTIPLY 20 BY NUM-G&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt; DIVIDE {identifier-1 or literal} BY {identifier-2 or literal}...&lt;br /&gt;      GIVING {identifier-3} [ROUNDED] [REMAINDER {identifier-4}]&lt;br /&gt;      [NOT] [ON SIZE ERROR {statements}]&lt;br /&gt;[END-DIVIDE]&lt;/p&gt;&lt;p&gt;Examples:&lt;br /&gt;DIVIDE NUM-H BY 3 GIVING NUM-I REMAINDER NUM-REMAIN&lt;br /&gt;DIVIDE NUM-Y BY 3 GIVING NUM-K ROUNDED&lt;/p&gt;&lt;p&gt;The DIVIDE statement differs from the previous 3 in that GIVING is&lt;br /&gt;required. Also, the remainder of the division (e.g. 7 divided by 3&lt;br /&gt;equals 3 remainder 1) can be stored in an identifier. The ROUNDED&lt;br /&gt;option, which is also available for the MULTIPLY statement, will round&lt;br /&gt;to the nearest significant decimal place, defined by the PIC clause.&lt;br /&gt;E.g.:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;000100 77 NUM-A PIC 99 VALUE 10.&lt;br /&gt;000200 77 NUM-B PIC 9V99.&lt;br /&gt;002000 DIVIDE NUM-A BY 3 GIVING NUM-B&lt;br /&gt;002010              ON SIZE-ERROR DISPLAY 'RESULT IS TRUNCATED'&lt;br /&gt;002020 END-DIVIDE&lt;br /&gt;002030&lt;br /&gt;002040 DIVIDE NUM-A BY 3 GIVING NUM-B ROUNDED&lt;br /&gt;002050           ON SIZE-ERROR DISPLAY 'RESULT IS TRUNCATED'&lt;br /&gt;002020 END-DIVIDE&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;The first DIVIDE statement will result in a size error (20 / 3 =&lt;br /&gt;6.66666..) as NUM-B will contain 6.66 but will have truncated the&lt;br /&gt;rest. This does not apply to the second DIVIDE statement since it has&lt;br /&gt;been rounded to fit the pic description 9V99, and so in this case&lt;br /&gt;NUM-B will contain 6.67.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;DIVIDE {identifier-1 or literal} INTO {identifier-2 or literal}...&lt;br /&gt;      GIVING {identifier-3} [ROUNDED] [REMAINDER {identifier-4}]&lt;br /&gt;      [NOT] [ON SIZE ERROR {statements}]&lt;br /&gt;[END-DIVIDE]&lt;/p&gt;&lt;p&gt;Examples:&lt;br /&gt;DIVIDE 3 INTO NUM-Y GIVING NUM-K ROUNDED&lt;br /&gt;This differs from the previous DIVIDE statement only in the order of&lt;br /&gt;numerator and denominator (both mean NUM-Y / 3).&lt;/p&gt;&lt;p&gt;&lt;br /&gt;COMPUTE&lt;/p&gt;&lt;p&gt;As previously seen in earlier sections, COMPUTE can be used to do&lt;br /&gt;arithmetic calculations. The format is:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;COMPUTE {identifier-1} [ROUNDED] = arithmetic expression&lt;br /&gt;    [NOT] [ON SIZE ERROR {statements}] [END-COMPUTE]&lt;/p&gt;&lt;p&gt;&lt;br /&gt;with the operations:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;+     add&lt;br /&gt;-     subtract&lt;br /&gt;*     multiply&lt;br /&gt;/     divide&lt;br /&gt;**    to the power of&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Note that brackets need to be used for complex calculations where&lt;br /&gt;signs have presidence over each other, for example: 2 + 3 * 2 equals 8&lt;br /&gt;(and not 10) since 3 * 2 is calculated before the addition&lt;br /&gt;-----------------------------------------------------------------------------------------&lt;/p&gt;&lt;p&gt;==========&lt;br /&gt;# Strings&lt;br /&gt;==========&lt;/p&gt;&lt;p&gt; STRING {identifier-1 or literal-1} DELIMITED BY {identifier-2 or&lt;br /&gt;literal-2 or SIZE}...&lt;br /&gt;INTO {identifier-3}&lt;br /&gt;ON OVERFLOW [statements]&lt;br /&gt;&amp;amp;NOT ON OVERFLOW [statements]&lt;br /&gt;END-STRING&lt;/p&gt;&lt;p&gt;&lt;br /&gt;STRING will move a series of strings into a destination string (from&lt;br /&gt;left to right without space filling). If the destination string is not&lt;br /&gt;large enough to hold all the source strings then this can be detected&lt;br /&gt;and acted on by the ON OVERFLOW condition. The DELIMITED word&lt;br /&gt;specifies the source string characters to be used:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;   01 W-DAY      PIC XXX VALUE 'MON'.&lt;/p&gt;&lt;p&gt;    01 W-MONTH    PIC XXX VALUE '5  '.&lt;/p&gt;&lt;p&gt;    01 W-YEAR     PIC XXXX VALUE '2000;'.&lt;/p&gt;&lt;p&gt;      :    STRING W-DAY DELIMITED BY SIZE&lt;/p&gt;&lt;p&gt;           '/' DELIMITED BY SIZE&lt;/p&gt;&lt;p&gt;           W-MONTH DELIMITED BY SPACES&lt;/p&gt;&lt;p&gt;           '/' DELIMITED BY SIZE&lt;/p&gt;&lt;p&gt;           W-YEAR DELIMITED BY ';'&lt;/p&gt;&lt;p&gt;        INTO DATE-STRING&lt;/p&gt;&lt;p&gt;    END-STRING&lt;/p&gt;&lt;p&gt;The item DATE-STRING will contain "MON/5/2000".&lt;br /&gt;===============&lt;br /&gt; UNSTRING&lt;br /&gt;===============&lt;/p&gt;&lt;p&gt; UNSTRING {identifier-1 or literal-1} DELIMITED BY {identifier-2 or&lt;br /&gt;literal-2 or SIZE}...&lt;br /&gt;      INTO {identifier-3 COUNT IN identifier-4}...&lt;br /&gt;    TALLYING IN {identifier-5}&lt;br /&gt;    ON OVERFLOW [statements]&lt;br /&gt;    NOT ON OVERFLOW [statements]&lt;br /&gt;END-UNSTRING&lt;/p&gt;&lt;p&gt;UNSTRING allows you to break up a string into small strings placed&lt;br /&gt;into new items:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;    01 W-LONG-STRING   PIC X(50) VALUE 'Name;Address;Post Code'.&lt;/p&gt;&lt;p&gt;    UNSTRING W-LONG-STRING DELIMITED BY ';'&lt;/p&gt;&lt;p&gt;          INTO W-NAME COUNT IN CHARS-NAME&lt;/p&gt;&lt;p&gt;               W-ADDRESS COUNT IN CHARS-ADDR&lt;/p&gt;&lt;p&gt;               W-POST-CODE COUNT IN CHARS-PCODE&lt;/p&gt;&lt;p&gt;          TALLYING IN NUM-STRINGS-OUT&lt;/p&gt;&lt;p&gt;    END-UNSTRING&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Here then string 'Name' will be placed into W-NAME, containing 4&lt;br /&gt;characters, thus CHARS-NAME will contain the value of 4. Likewise for&lt;br /&gt;W-ADDRESS ('Address') CHARS-ADDR (7) etc... Notice how the ; character&lt;br /&gt;has been lost. Any character, including spaces can be used as a&lt;br /&gt;delimiter. TALLYING IN will count the number of items that were filled&lt;br /&gt;by the UNSTRING operation, in this case NUM-STRINGS-OUT will contain&lt;br /&gt;the value 3. Lastly, the ON OVERFLOW detects when each target of the&lt;br /&gt;UNSTRING operation has been used but there remains unused characters&lt;br /&gt;in the source string, e.g. if W-LONG-STRING contained&lt;br /&gt;'Name;Address;Post Code;Country'.&lt;/p&gt;&lt;p&gt;=============&lt;br /&gt; INSPECT&lt;br /&gt;=============&lt;/p&gt;&lt;p&gt; INSPECT {identifier-1} REPLACING CHARACTERS BY {identifier-2 or literal-1}&lt;br /&gt;      {BEFORE or AFTER} [INITIAL {identifier-3 or literal-2}]&lt;br /&gt;      {ALL or LEADING or FIRST} {identifier-4 or literal-3}&lt;br /&gt;      BY {identifier-5 or literal-4} {BEFORE or AFTER} INITIAL&lt;br /&gt;{identifier-6 or literal-5}&lt;/p&gt;&lt;p&gt;&lt;br /&gt;This form of INSPECT allows you to change characters within a string&lt;br /&gt;using the various options above.&lt;/p&gt;&lt;p&gt; INSPECT {identifier-1} TALLYING {identifier-2}&lt;br /&gt;      {BEFORE or AFTER} [INITIAL {identifier-3 or literal-2}]&lt;br /&gt;      {ALL or LEADING or FIRST} {identifier-4 or literal-3}&lt;br /&gt;      BY {identifier-5 or literal-4} {BEFORE or AFTER} INITIAL&lt;br /&gt;{identifier-6 or literal-5}&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Here the source string is inspected and a tally of the number of&lt;br /&gt;characters defined (using the subsequent options) is held in&lt;br /&gt;{identifier-2}.&lt;/p&gt;&lt;p&gt;------------------------------------------------------------------------------------------------------&lt;br /&gt;=========&lt;br /&gt;# Write&lt;br /&gt;=========&lt;/p&gt;&lt;p&gt;&lt;br /&gt;To output data to the printer or to a file, the verb WRITE is used. It&lt;br /&gt;would be of the form:&lt;/p&gt;&lt;p&gt; WRITE {level 01 name of file/printer FD}&lt;/p&gt;&lt;p&gt;For example:&lt;/p&gt;&lt;p&gt;000100 ENVIRONMENT DIVISION.&lt;br /&gt;000200 INPUT-OUTPUT SECTION.&lt;br /&gt;000300 FILE-CONTROL.&lt;br /&gt;000400 ASSIGN PRINT-FILE TO PRINTER.&lt;br /&gt;000500 DATA DIVISION.&lt;br /&gt;000600 FILE SECTION.&lt;br /&gt;000700 FD PRINT-FILE.&lt;br /&gt;000800 01 P-DATA PIC X(80).&lt;br /&gt;: 000900 WORKING-STORAGE SECTION.&lt;br /&gt;001000 01 DATA-NUMBER PIC 9(6) VALUE 123456.&lt;br /&gt;001100 01 PRINT-NUMBER PIC X(6).&lt;br /&gt;: 010900*in procedure division&lt;br /&gt;011100 MOVE DATA-NUMBER TO PRINT-NUMBER&lt;br /&gt;011200 MOVE PRINT-NUMBER TO P-DATA&lt;br /&gt;011300 WRITE P-DATA&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;To simplify things the word FROM can be used to save always having to&lt;br /&gt;first MOVE the data (PRINT-NUMBER) into the printing item (P-DATA&lt;br /&gt;above). So, line 011200 and 011300 can simply be written as:&lt;/p&gt;&lt;p&gt;011100 WRITE P-DATA FROM PRINT-NUMBER&lt;/p&gt;&lt;p&gt;&lt;br /&gt;In addition to WRITE, the is also REWRITE and DELETE which are used to&lt;br /&gt;update records within files that have been opened in I-O mode (see the&lt;br /&gt;following section). When using DELETE you must first read the record&lt;br /&gt;that is to be deleted. Also, when deleting a record you refer to the&lt;br /&gt;FILE NAME rather than the record name:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;000300 FD IN-FILE.&lt;br /&gt;000400 01 CUST-RECORD.&lt;br /&gt;000500 03 C-NAME PIC X(20).&lt;br /&gt;000600 03 C-NUMBER PIC 9(6).&lt;br /&gt;001000* in procedure division.&lt;br /&gt;001100 READ IN-FILE.&lt;br /&gt;001200 NOT AT END.&lt;br /&gt;001300 IF C-NUMBER = 123456 THEN&lt;br /&gt;001400 DELETE IN-FILE&lt;br /&gt;001500 ELSE MOVE C-NUMBER TO W-DATA-STORE&lt;br /&gt;001600 END-IF&lt;br /&gt;001700 END-READ&lt;br /&gt;--------------------------------------------------------------------------------------------------------&lt;br /&gt;==================&lt;br /&gt;# Scope Terminators&lt;br /&gt;==================&lt;/p&gt;&lt;p&gt;&lt;br /&gt;In the section COBOL basics I mentioned the full stop (period). This&lt;br /&gt;is what can be described as a scope terminator. Many COBOL verbs have&lt;br /&gt;their own scope terminator, for example, END-IF, END-READ, END-PERFORM&lt;br /&gt;etc... The purpose of a scope terminator is to define when a verb's&lt;br /&gt;scope (i.e. associated logic) is finished.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;For example:&lt;/p&gt;&lt;p&gt;   READ IN-FILE&lt;br /&gt;    AT END MOVE 'Y' TO EOF FLAG&lt;br /&gt;    NOT AT END&lt;br /&gt;       IF REC-IN = 'Z' THEN&lt;br /&gt;          PERFORM PROCEDURE-X&lt;br /&gt;       END-IF&lt;br /&gt;  END-READ&lt;/p&gt;&lt;p&gt;&lt;br /&gt;In the above example END-READ defines the scope of the READ statement&lt;br /&gt;since there is a condition involved (AT END of the file, or NOT AT END&lt;br /&gt;of the file), while END-IF defines then end of the IF condition, i.e.&lt;br /&gt;END-READ and END-IF define their scope. Any code that follows the read&lt;br /&gt;statement will apply regardless of the READ condition (which is what&lt;br /&gt;you would want in the above example). Without END-READ the subsequent&lt;br /&gt;code would only be performed while NOT AT END is true: some nasty bugs&lt;br /&gt;could ensue! Things become even more scary if you forget to use END-IF&lt;br /&gt;or END-PERFORM (especially when looping). There's a good chance the&lt;br /&gt;compiler might pick up the error.&lt;/p&gt;&lt;p&gt;However, a period is also a scope terminator. You might also code:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;READ IN-FILE&lt;br /&gt;AT END MOVE 'Y' TO EOF FLAG&lt;br /&gt;NOT AT END&lt;br /&gt;PERFORM UNTIL REC-IN = 'A'&lt;br /&gt;IF REC-IN = 'Z' THEN&lt;br /&gt;PERFORM PROCEDURE-X.&lt;br /&gt;END-PERFORM&lt;/p&gt;&lt;p&gt;This would have the same effect as the first example (assuming the&lt;br /&gt;compiler doesn't complain). Some people do use periods in place of&lt;br /&gt;END-IF etc (note: I'm not sure you allowed to replace END-PERFORM&lt;br /&gt;however). Problems may arise when you forget to use a scope terminator&lt;br /&gt;somewhere and there's a period somewhere further down the code then&lt;br /&gt;the compiler might just get confused.&lt;/p&gt;&lt;p&gt;It is important to realise that the period will terminate all ongoing&lt;br /&gt;conditions. So in the above example, the period will act as both an&lt;br /&gt;END-IF, END-PERFORM and END-READ.&lt;/p&gt;&lt;p&gt;Look at this paragraph:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;000090*this works, using period scope terminators&lt;br /&gt;000100 PARAGRAPH-ABC.&lt;br /&gt;000200 MOVE 0 TO N&lt;br /&gt;000300 PERFORM UNTIL N &amp;gt; 10&lt;br /&gt;000400 COMPUTE N = N + 1&lt;br /&gt;000500 DISPLAY N.&lt;br /&gt;000600&lt;br /&gt;000700 PERFORM PROCEDURE-Y N TIMES&lt;br /&gt;000800 PERFORM UNTIL END-OF-FILE&lt;br /&gt;000900 READ IN-FILE&lt;br /&gt;001000 AT END MOVE 'Y' TO EOF-FLAG&lt;br /&gt;001100 NOT AT END&lt;br /&gt;001200 ADD VALUE-FROM-RECORD TO N GIVING X.&lt;br /&gt;001300 001400 END-PERFORM&lt;br /&gt;001500 DISPLAY X.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;In the first example, the code will display numbers 1 to 10. It will&lt;br /&gt;then perform PROCEDURE-Y 11 times. Finally, the numbers coming from&lt;br /&gt;the IN-FILE (VALUE-FROM-RECORD) will be added to 11 giving X, which is&lt;br /&gt;then displayed.&lt;/p&gt;&lt;p&gt;But what if we were to forget to put a period at the end of line 500?&lt;/p&gt;&lt;p&gt;000090*this has a syntax error&lt;br /&gt;000100 PARAGRAPH-ABC.&lt;br /&gt;000200 MOVE 0 TO N.&lt;br /&gt;000300 PERFORM UNTIL N &amp;gt; 10&lt;br /&gt;000400 COMPUTE N = N + 1&lt;br /&gt;000500 DISPLAY N&lt;br /&gt;000600 000700 PERFORM PROCEDURE-Y N TIMES.&lt;br /&gt;000800 PERFORM UNTIL END-OF-FILE&lt;br /&gt;000900 READ IN-FILE&lt;br /&gt;001000 AT END MOVE 'Y' TO EOF-FLAG&lt;br /&gt;001100 NOT AT END&lt;br /&gt;001200 ADD VALUE-FROM-RECORD TO N GIVING X.&lt;br /&gt;001300 001400 END-PERFORM&lt;br /&gt;001500 DISPLAY X.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Now, the period on line 700 will terminate the scope of the PERFORM&lt;br /&gt;statement on line 300. This means that PROCEDURE-Y gets performed&lt;br /&gt;1+2+3+4+5+6+7+8+9+10+11 times (that's 66 times!). Oh dear.&lt;/p&gt;&lt;p&gt;In fact, when I tried to test these code fragments by compiling [on&lt;br /&gt;the Fujitsu COBOL v3] it complained bitterly! The compiler was&lt;br /&gt;particularly bothered by the lack of END-PERFORMS.&lt;/p&gt;&lt;p&gt;I was taught to only use 2 periods in any paragraph: the first after&lt;br /&gt;the paragraph name, the second (and last) at the end of the paragraph.&lt;br /&gt;So always use the verb's own scope terminator. More typing but less&lt;br /&gt;headaches in my humble opinion. Here's what the above code would look&lt;br /&gt;like when following this advice:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;000090*using just 2 periods&lt;br /&gt;000100 PARAGRAPH-ABC.&lt;br /&gt;000200 MOVE 0 TO N&lt;br /&gt;000300 PERFORM UNTIL N &amp;gt; 10&lt;br /&gt;000400 COMPUTE N = N + 1&lt;br /&gt;000500 DISPLAY N&lt;br /&gt;000600 END-PERFORM&lt;br /&gt;000700 PERFORM PROCEDURE-Y N TIMES&lt;br /&gt;000800 PERFORM UNTIL END-OF-FILE&lt;br /&gt;000900 READ IN-FILE&lt;br /&gt;001000 AT END MOVE 'Y' TO EOF-FLAG&lt;br /&gt;001100 NOT AT END&lt;br /&gt;001200 ADD VALUE-FROM-RECORD TO N GIVING X&lt;br /&gt;001300 END-READ&lt;br /&gt;001400 END-PERFORM&lt;br /&gt;001500 DISPLAY X.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Many of the commands described in this section have already been used&lt;br /&gt;in earlier sections but here their description will be shown alongside&lt;br /&gt;related commands, clauses and verbs. It should be noted that a command&lt;br /&gt;probably is a verb, while a clause is a collection of COBOL words&lt;br /&gt;without a verb.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-1510157676649677864?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/1510157676649677864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/common-cobol-verbs-statements-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/1510157676649677864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/1510157676649677864'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/common-cobol-verbs-statements-ii.html' title='Common COBOL verbs / Statements - II'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-3423069826512952725</id><published>2009-08-21T10:28:00.002+05:30</published><updated>2009-08-26T16:11:47.709+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='COBOL TUTORIAL'/><title type='text'>Common COBOL verbs/ statements -- I</title><content type='html'>Many of the commands described in this section have already been used in earlier sections but here their description will be shown alongside related commands, clauses and verbs. It should be noted that a command probably is a verb, while a clause is a collection of COBOL words without a verb.&lt;br /&gt;&lt;br /&gt;=======================&lt;br /&gt;# ACCEPT and DISPLAY&lt;br /&gt;=======================&lt;br /&gt;&lt;br /&gt;To enter data via the console during a program run, use the ACCEPT verb, e.g:&lt;br /&gt;ACCEPT W-DATA-IN&lt;br /&gt;&lt;br /&gt;To display data on the console during a run use the DISPLAY verb, i.e:&lt;br /&gt;DISPLAY W-DATA-OUT&lt;br /&gt;&lt;br /&gt;To place text with the outputed data you would code:&lt;br /&gt;DISPLAY 'Inputed data is ' W-DATA-OUT&lt;br /&gt;&lt;br /&gt;=========&lt;br /&gt;# Move&lt;br /&gt;=========&lt;br /&gt;The format is:&lt;br /&gt;&lt;br /&gt;MOVE [literal-1 or identifier-1] TO [identifier-2] ...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The MOVE statement has already been extensively used in the examples in the Defining Data section. A couple of features have not been described yet: CORRESPONDING (abreviation CORR) and the qualification OF or IN. The elipsis (...) means more of the same, i.e. above [identifier-2] [identifier-3] [identifier-4]...and so on.&lt;br /&gt;&lt;br /&gt;To move a group of items from one field description to another:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;03 DATE-IN.&lt;br /&gt;     05 W-DAY PIC 99.&lt;br /&gt;     05 W-MONTH PIC 99.&lt;br /&gt;      05 W-YEAR PIC 99.&lt;br /&gt;&lt;br /&gt;03 DATE-OUT.&lt;br /&gt;       05 W-DAY PIC 99.&lt;br /&gt;        05 PIC X VALUE '/'.&lt;br /&gt;       05 W-MONTH PIC 99.&lt;br /&gt;       05 PIC X VALUE '/'.&lt;br /&gt;       05 W-YEAR PIC 99.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you were to code: MOVE DATE-IN TO DATE-OUT you would end up with the 6 characters of DATE-IN appearing in the first 6 positions of DATE-OUT, including over-written fillers. To get the contents of W-DAY of DATE-IN into W-DAY of DATE-OUT (and the same for the other two items) you could either move them individually, or you could simply code: MOVE CORRESPONDING DATE-IN TO DATE-OUT. To do this the items must have the same name spelling and must be of the same level (here they are both level 03). They don't have to be in the same level 01 group. &lt;br /&gt;&lt;br /&gt;Of course, this does present the programmer with a potential problem, this being that if elsewhere in the program you were to code, say, ADD 12 to W-MONTH, the compiler would report a syntax error since it W-MONTH appears twice in the data division and doesn't know which one you mean. To remedy this, you have to qualify the item, i.e. state which group W-MONTH you mean, i.e. :&lt;br /&gt;&lt;br /&gt;MOVE 12 TO W-MONTH IN DATE-OUT.&lt;br /&gt;&lt;br /&gt;You could use the word OF instead of IN here to the same effect.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Reference modification&lt;br /&gt;-----------------------------------&lt;br /&gt;&lt;br /&gt;To access specific characters within a string you can use a reference modifier.&lt;br /&gt;&lt;br /&gt;STRING-ITEM (startPosition:Length)&lt;br /&gt;&lt;br /&gt;The start position is the nth character of the STRING-ITEM. For MicroFocus compilers at least, the length can be omitted if you want all characters to the end of the string.   &lt;br /&gt;e.g.&lt;br /&gt;&lt;br /&gt; WORKING-STORAGE SECTION.&lt;br /&gt;       &lt;br /&gt;    01 STRING-1 PIC X(10) VALUE 'ABCDEFGHIJ'.&lt;br /&gt;    01 STRING-2 PIC X(10) VALUE SPACES.&lt;br /&gt;    01 STRING-3 PIC X(10) VALUE SPACES.&lt;br /&gt;    01 STRING-4 PIC X(10) VALUE SPACES.&lt;br /&gt;     01 STRING-5 PIC X(10) VALUE SPACES.&lt;br /&gt;    01 STRING-6 PIC X(10) VALUE SPACES.&lt;br /&gt;   &lt;br /&gt;: : in procedure division:&lt;br /&gt;&lt;br /&gt;         MOVE STRING-1(2:6) TO STRING-2&lt;br /&gt;         MOVE STRING-1(1:9) TO STRING-3&lt;br /&gt;          MOVE STRING-1(6) TO STRING-4&lt;br /&gt;         MOVE STRING-1(5:1) TO STRING-5&lt;br /&gt;         MOVE STRING-1(3:3) TO STRING-6&lt;br /&gt;&lt;br /&gt;Then:&lt;br /&gt;STRING-2 will contain characters 2 to 6, i.e. : "BCDEFG "&lt;br /&gt;STRING-3 will contain characters 1 to 9, i.e. : "ABCDEFGHI "&lt;br /&gt;STRING-4 will contain characters 6 to the end of STRING-1, i.e. : "FGHIJ "&lt;br /&gt;STRING-5 will contain character 5 only, i.e. : "E "&lt;br /&gt;STRING-6 will contain characters 3 to 5, i.e. : "CDE " &lt;br /&gt;&lt;br /&gt;===============&lt;br /&gt;# Perform&lt;br /&gt;===============&lt;br /&gt;&lt;br /&gt;The PERFORM verb is one of the most important in COBOL (alongside MOVE).&lt;br /&gt;&lt;br /&gt;PERFORM has already been encountered in the Four Divisions section, where it was used to call paragraphs from within a control paragraph. Of course, it doesn't have to be a control (or main) paragraph.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;000290 PROCEDURE DIVISION.&lt;br /&gt;000300 XYZ-PARAGRAPH.&lt;br /&gt;000310 PERFORM FIRST-PROCESS&lt;br /&gt;000320 PERFORM SECOND-PARAGRAPH&lt;br /&gt;000330 STOP RUN.&lt;br /&gt;&lt;br /&gt;002000 FIRST-PROCESS.&lt;br /&gt;002010 [statements]&lt;br /&gt;                  [last statement].&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the above code, the paragraph FIRST-PROCESS is executed. When the full stop at the end of this paragraph is encountered the logic will return to XYZ-PARAGRAPH at the next line, i.e. line 320. This is called an Out-of-Line PERFORM. &lt;br /&gt;&lt;br /&gt;The PERFORM verb can form the bases of a repetitive loop (or sub-routine) until a certin condition has been met.&lt;br /&gt;&lt;br /&gt;For Example:&lt;br /&gt;&lt;br /&gt;000290 PROCEDURE DIVISION.&lt;br /&gt;000300 XYZ-PARAGRAPH.&lt;br /&gt;000310 PERFORM COUNT-PROCESS UNTIL W-COUNTER &amp;gt; 10&lt;br /&gt;000320 STOP RUN.&lt;br /&gt;001000&lt;br /&gt;002000 COUNT-PROCESS.&lt;br /&gt;002010 COMPUTE W-COUNTER = W-COUNTER + 1&lt;br /&gt;002020 DISPLAY 'Number of loops is ' W-COUNTER.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the above code, COUNT-PROCESS is executed until the value of W-COUNT has reached 11.&lt;br /&gt;&lt;br /&gt;The format for an Out-of-Line PERFORM is:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;PERFORM [paragraph-name] UNTIL [condition]&lt;br /&gt;&lt;br /&gt;An In-Line PERFORM, rather than execute a paragraph (aka procedure), allows for the repeated execution of a series of commands. The format for an In-Line PERFORM is:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;PERFORM UNTIL&lt;br /&gt;{action}...&lt;br /&gt;END-PERFORM&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt; &lt;br /&gt;000290 PROCEDURE DIVISION.&lt;br /&gt;000300 XYZ-PARAGRAPH.&lt;br /&gt;000305 MOVE ZERO TO W-COUNTER&lt;br /&gt;000310 PERFORM UNTIL W-COUNTER &amp;gt; 10&lt;br /&gt;000320 COMPUTE W-COUNTER = W-COUNTER + 1&lt;br /&gt;000330 DISPLAY 'This is loop number: ' W-COUNTER&lt;br /&gt;000340 END-PERFORM&lt;br /&gt;000350 DISPLAY 'Counter is now equal to: ' W-COUNTER&lt;br /&gt;000360 STOP RUN.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;END-PERFORM defines the scope of the PERFORM loop, and is a Scope terminator. Other such scope terminators exist for other commands that will be described further on. The code above will loop 11 times (showning numbers 1 to 11). This is because when W-COUNTER is equal to 10, the condition (W-COUNTER) is still false. 1 is then added, and W-COUNTER is displayed as 11, and now when W-COUNTER is tested the condition will be true and the logic will then jump to the statement that immediately follows END-PERFORM.   &lt;br /&gt;&lt;br /&gt;This type of PEFORM tests the condition before the following statements are allowed to proceed. Using WITH TEST can be used to define when the test is done:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;000290 PROCEDURE DIVISION.&lt;br /&gt;000300 XYZ-PARAGRAPH.&lt;br /&gt;000305 MOVE ZERO TO W-COUNTER&lt;br /&gt;000310 PERFORM WITH TEST AFTER UNTIL W-COUNTER &amp;gt; 10&lt;br /&gt;000320 COMPUTE W-COUNTER = W-COUNTER + 1&lt;br /&gt;000330 DISPLAY 'This is loop number: ' W-COUNTER&lt;br /&gt;000340 END-PERFORM&lt;br /&gt;000350 DISPLAY 'Counter is now equal to: ' W-COUNTER&lt;br /&gt;000360 STOP RUN.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now the condition is tested after the commands within the PERFORM..END-PERFORM loop has be executed once. (WITH TEST BEFORE has same effect as initial example).   &lt;br /&gt;&lt;br /&gt;If you wanted to loop a desired number of times you could use TIMES&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;       PERFORM 5 TIMES&lt;br /&gt;   COMPUTE W-NUMBER = XYZ * 3&lt;br /&gt;       END-PERFORM&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The format is:&lt;br /&gt;&lt;br /&gt;          PERFORM {identifier or literal} TIMES&lt;br /&gt;                   {action}...&lt;br /&gt;           END-PERFORM&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To have a loop using an increment (such as a 'for..do' loop in Pascal or FOR in BASIC), the PERFORM VARYING statement is used.&lt;br /&gt;&lt;br /&gt;The Format is:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;PERFORM {paragraph-name if out-of-line} VARYING {identifier-1}&lt;br /&gt;FROM {identifier-2 or literal} BY {identifier-3 or literal}&lt;br /&gt;UNTIL {condition}&lt;br /&gt;END-PERFORM&lt;br /&gt;&lt;br /&gt;Look at the example given below:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;000290 PROCEDURE DIVISION.&lt;br /&gt;000300 XYZ-PARAGRAPH.&lt;br /&gt;000310 PERFORM VARYING W-COUNTER FROM 1 BY 2&lt;br /&gt;000320 UNTIL W-COUNTER &amp;gt; 10&lt;br /&gt;000330 DISPLAY 'This is loop number: ' W-COUNTER&lt;br /&gt;000340 END-PERFORM&lt;br /&gt;000350 DISPLAY 'Counter is now equal to: ' W-COUNTER&lt;br /&gt;000360 STOP RUN.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This code will display: &lt;br /&gt;&lt;br /&gt;  This is loop number: 1&lt;br /&gt;  This is loop number: 3&lt;br /&gt;  This is loop number: 5&lt;br /&gt;  This is loop number: 7&lt;br /&gt;  This is loop number: 9&lt;br /&gt;  Counter is now equal to: 11&lt;br /&gt;&lt;br /&gt;This because with each loop, W-COUNTER has increased from 1 by increments of 2. When W-COUNT was equal to 11 then the condition W-COUNTER &amp;gt; 10 is now true and so the loop is exited. If you wanted to count downwards you could code:&lt;br /&gt;&lt;br /&gt;PERFORM VARYING W-COUNTER FROM 20 BY -1&lt;br /&gt;         UNTIL W-COUNTER &amp;lt; ZERO.&lt;br /&gt;&lt;br /&gt;The last thing to mention is PERFORM..THRU. If a program had a series of paragraphs, just for the sake of argument, called PROCESS-1, PROCESS-2, PROCESS-3 and PROCESS-4, then if you wished to execute these paragraphs in the order that they are written you could code: PERFORM PROCESS-1 THRU PROCESS-4 with any out-of-line loops and conditions you might want. Seemingly, this is not good programming practise so is generally avoided.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;===============&lt;br /&gt;# If..Then..Else&lt;br /&gt;===============&lt;br /&gt;&lt;br /&gt;Another fundamental part of programming logic is the ability to offer a choice of what to do that depends on the conditions asked of.&lt;br /&gt;&lt;br /&gt;The format is:&lt;br /&gt;&lt;br /&gt;IF {identifier-1} {condition} {identifier-2 or literal} ...&lt;br /&gt;THEN {statements}&lt;br /&gt;[ELSE {statements}]&lt;br /&gt;END-IF&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;example:&lt;br /&gt;     IF X = Y THEN&lt;br /&gt;        MOVE 1 TO Y-COUNTER&lt;br /&gt;     ELSE&lt;br /&gt;        MOVE 1 TO X-COUNTER&lt;br /&gt;      END-IF&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ELSE is used if an alternative statement is to be executed if the first condition is false. If there was only to be action if X = Y then the ELSE would be ommitted.&lt;br /&gt;&lt;br /&gt;The END-IF terminates the IF statement. All that lies between IF and END-IF will depend on the conditions being tested.&lt;br /&gt;&lt;br /&gt;Multiple conditions can be tested, i.e. IF (X = Y) AND (Y &amp;lt; 100) THEN ..&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------------------------------------------&lt;br /&gt;===========&lt;br /&gt;# Conditions&lt;br /&gt;===========&lt;br /&gt;&lt;br /&gt;There are four types of conditions that could be tested either in a PERFORM, IF..THEN, or EVALUATE (see next section), these being:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; 1. Class conditions&lt;br /&gt; 2. Relational conditions&lt;br /&gt; 3. Sign conditions&lt;br /&gt; 4. Condition-name conditions&lt;br /&gt;&lt;br /&gt;Class conditions test where an item is NUMERIC, ALPHABETIC, ALPHABETIC-LOWER, or ALPHABETIC-HIGHER (as in lower or upper case).&lt;br /&gt;&lt;br /&gt;Relational conditions allow comparisons, i.e: GREATER THAN, LESS THAN, EQUAL TO or their sign equivalent:  " &amp;gt; ", " &amp;lt; ", " = ", respectively.&lt;br /&gt;&lt;br /&gt;Sign conditions test whether an item IS POSITIVE, IS NEGATIVE, or IS NOT ZERO. (note 'IS' is optional)&lt;br /&gt;&lt;br /&gt;Condition-name conditions are as described in the section, where a named condition is defined in the data division using a level 88 description.&lt;br /&gt;&lt;br /&gt;Conditions can be combined using AND, OR, AND NOT, OR NOT, and brackets. The most common combinations would probably be GREATER THAN OR EQUAL TO and LESS THAN OR EQUAL TO, which can simply be written &amp;gt;= and &amp;lt;= respectively. Also, NOT EQUAL TO would be &amp;lt;&amp;gt; although I find the Fujitsu compiler rejects '&amp;lt;&amp;gt;' so I just use 'NOT = ' instead.&lt;br /&gt;&lt;br /&gt;More complex combination's can be achieved with the use of brackets. eg.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  IF ( X &amp;gt; Y ) AND ( ( Y + 10 &amp;lt; Z ) OR ( X - 10 &amp;gt; Z ) ) THEN ...&lt;br /&gt;&lt;br /&gt;Remember:&lt;br /&gt; [true] AND [false] = FALSE&lt;br /&gt; [true] AND [true]  = TRUE&lt;br /&gt;  [true] OR [false]  = TRUE&lt;br /&gt; [true] OR [true]   = TRUE&lt;br /&gt;        NOT [true]  = FALSE&lt;br /&gt;        NOT [false] = TRUE&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Alpha-numeric comparisons can also be made that relate to their ASCII character value, so 'A' &amp;lt; 'Z' etc...&lt;br /&gt;------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;=========&lt;br /&gt;# Evaluate&lt;br /&gt;=========&lt;br /&gt;&lt;br /&gt;If there are a large number of conditional alternatives, then using a large number of nested IF statements can be messy:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        IF A = 1 THEN PERFORM PARA-1&lt;br /&gt;             ELSE&lt;br /&gt;                   IF A = 2 THEN PERFORM PARA-2&lt;br /&gt;                      ELSE&lt;br /&gt;                          IF A = 3 THEN PERFORM PARA-3&lt;br /&gt;                                ELSE&lt;br /&gt;                                       IF A = 4 THEN PERFORM PARA-4&lt;br /&gt;                                       END-IF&lt;br /&gt;                           END-IF&lt;br /&gt;                      END-IF&lt;br /&gt;          END-IF&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The above example only tested four possible values for 'A'. Suppose there were ten or twenty? This is where the EVALUATE statement is of great use. The format is:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: right;"&gt;&lt;b&gt;Source Link&lt;/b&gt; : &lt;a href="http://cobolminds.blogspot.com"&gt;www.cobolminds.blogspot.com&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-3423069826512952725?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/3423069826512952725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/common-cobol-verbs-statements-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/3423069826512952725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/3423069826512952725'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/common-cobol-verbs-statements-i.html' title='Common COBOL verbs/ statements -- I'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-3996739629365741611</id><published>2009-08-21T10:16:00.002+05:30</published><updated>2009-08-26T16:12:11.357+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='COBOL TUTORIAL'/><title type='text'>TABLE Handling in cobol</title><content type='html'>Also known as an array in other languages like &amp;#39;C&amp;#39;, a table is a group&lt;br&gt;of data associated with a single item name.&lt;p&gt;To identify pieces data (elements) within that table the item is given&lt;br&gt;a subscript number which follows the name.&lt;p&gt;  W-NAME (elements)      Subscript&lt;br&gt;-----------------------------------------------------&lt;br&gt;        Smith                      1&lt;br&gt;        Jones                     2&lt;br&gt;      MacDoon                  3&lt;br&gt;       Walker                     4&lt;br&gt;      O&amp;#39;Leary                     5&lt;br&gt;----------------------------------------------------&lt;br&gt;So, DISPLAY W-NAME (2) will give &amp;quot;Jones&amp;quot;.&lt;p&gt;A 2-dimensional table uses two subscripts:&lt;br&gt;So element (2, 4) will contain &amp;quot;1.1&amp;quot;.&lt;p&gt;To define the W-NAME (1-dimensional) table in the data division:&lt;p&gt;     01 W-NAME  PIC X(10) OCCURS 5 TIMES.&lt;p&gt;&lt;br&gt;The word TIMES is optional. Also, the PIC clause can also be written&lt;br&gt;after the OCCURS ... clause.&lt;p&gt;To define the SALES-TABLE (2-dimensional) table, just add another&lt;br&gt;level to the group. Hence:&lt;p&gt;Tables&lt;p&gt;01 SALES-TABLE.&lt;br&gt;03 BRANCH-NO OCCURS 4.&lt;br&gt;05 MONTHLY-SALES OCCURS 4 PIC 9V9.&lt;p&gt;Notice how only the top level 05 contains the PIC clause. Level 01&lt;br&gt;describes a whole table made up of 4 items (level 03) containing 4&lt;br&gt;elements (level 05).&lt;p&gt;Table can be multi-dimensional, but always the last level will be the&lt;br&gt;identifier name that is associated with the subscripts and will have&lt;br&gt;the PIC clause.&lt;p&gt;For the use of tables, see the League Table Program in the Sample Code section.&lt;p&gt;Finally, don&amp;#39;t try to refer to a table element that is of a greater&lt;br&gt;value than that defined in the data division, i.e. W-NAME (6) will&lt;br&gt;cause a runtime error and terminate the program. It should be obvious&lt;br&gt;that a subscript should be a numeric literal or an identifier that is&lt;br&gt;numeric.&lt;p&gt;The use of identifiers as subscripts is where tables are of most use,&lt;br&gt;i.e. MONTHLY-SALES (INPUT-BRANCH, INPUT-MONTH).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-3996739629365741611?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/3996739629365741611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/table-handling-in-cobol.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/3996739629365741611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/3996739629365741611'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/table-handling-in-cobol.html' title='TABLE Handling in cobol'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-6828684532206234245</id><published>2009-08-20T16:02:00.001+05:30</published><updated>2009-08-26T16:12:27.341+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='COBOL TUTORIAL'/><title type='text'>Accept and Display DATA in COBOL</title><content type='html'>Much of how that data will look, such as in a report, is defined in&lt;br&gt;the data division.&lt;p&gt;The following code is taken from a full program given in the Sample&lt;br&gt;code section should illustrate how a printed report is defined in the&lt;br&gt;data division. If writing to a file it would be virtually identical&lt;br&gt;(see Sample code section for an example of this).&lt;p&gt;If you wished to print a report in the form of a table then you would&lt;br&gt;first have to assign an identifier name to the printer in the&lt;br&gt;environment division using the select clause.&lt;br&gt;Printing and Writing Data&lt;p&gt;000110    ENVIRONMENT DIVISION.&lt;br&gt;000120    INPUT-OUTPUT SECTION.&lt;br&gt;000130    FILE-CONTROL.&lt;br&gt;000140&lt;br&gt;000210                  SELECT PRINT-FILE ASSIGN TO PRINTER.&lt;br&gt;000220&lt;br&gt;000230&lt;br&gt;000240    DATA DIVISION.&lt;br&gt;000250    FILE SECTION.&lt;br&gt;000580    FD PRINT-FILE.&lt;br&gt;000590    01 REPORT-OUT PIC X(80).&lt;br&gt;000630    WORKING-STORAGE SECTION.&lt;br&gt;000640&lt;br&gt;001040      01 PRINT-HEADERS.&lt;br&gt;001050          03 P-TITLE.&lt;br&gt;001060              05 P-TITLE-TXT PIC X(49) VALUE&lt;br&gt;001070                        &amp;#39; Batch Control Program - Error Report. Page:&amp;#39;.&lt;br&gt;001080               05 P-PAGE-NO PIC Z9 VALUE ZERO.&lt;br&gt;001090           03 COL-HEAD-1 PIC X(31)&lt;br&gt;001100                           VALUE &amp;#39; PART CUST/ DATE QUANT&amp;#39;.&lt;br&gt;001110           03 COL-HEAD-2 PIC X(24)&lt;br&gt;001120                           VALUE &amp;#39; NO SUP NO SUP/REC&amp;#39;.&lt;br&gt;001130&lt;br&gt;001140      01 PRINT-LINE.&lt;br&gt;001150            03 P-PART-NO PIC X(8).&lt;br&gt;001160            03 PIC X VALUE SPACE.&lt;br&gt;001170            03 P-CUS-SUP-NO PIC X(6).&lt;br&gt;001180            03 PIC XX VALUE SPACES.&lt;br&gt;001190            03 P-DATE-S-D. 001200 05 P-DATE-1 PIC XX.&lt;br&gt;001210                      05 PIC X VALUE &amp;#39;/&amp;#39;.&lt;br&gt;001220                      05 P-DATE-2 PIC XX.&lt;br&gt;001230                      05 PIC X VALUE &amp;#39;/&amp;#39;.&lt;br&gt;001240                      05 P-DATE-3 PIC XX.&lt;br&gt;001250             03 PIC X VALUE SPACE.&lt;br&gt;001260             03 P-QUANT PIC Z(4)9.&lt;br&gt;001270&lt;br&gt;001280         01 P-FOOTER.&lt;br&gt;001290                03 TOT-REC-TXT PIC X(21)&lt;br&gt;001300                              VALUE &amp;#39;Total record number: &amp;#39;.&lt;br&gt;001310                03 P-REC-COUNT PIC ZZ9 VALUE ZERO.&lt;br&gt;001320&lt;br&gt;001330           01 P-BATCH-REC.&lt;br&gt;001340                03 BAT-TITLE PIC X(38)&lt;br&gt;001350                         VALUE &amp;#39; HASH TOTALS IN BATCH CONTROL RECORD&amp;#39;.&lt;br&gt;001360                  03 BATCH-SOURCE PIC X(29) VALUE SPACES&lt;br&gt;001370                  03 P-BAT-CUS-SUPP.&lt;br&gt;001380                              05 BAT-CUS-SUP PIC X(25)&lt;br&gt;001390                                        VALUE &amp;#39; CUSTOMER/SUPPLIER NOS: &amp;#39;.&lt;br&gt;001400                              05 BAT-C-S-N-TOT PIC Z(7)9.&lt;br&gt;001410                   03 P-BAT-DATE.&lt;br&gt;001420                           05 BAT-DATE PIC X(9)&lt;br&gt;001430                                         VALUE &amp;#39; DATES: &amp;#39;.&lt;br&gt;001440                           05 BAT-D-S-D-TOT PIC Z(7)9.&lt;br&gt;001450                    03 P-BAT-QUANT.&lt;br&gt;001460                            05 BAT-QUANT PIC X(14)&lt;br&gt;001470                                                    VALUE &amp;#39; QUANTITIES: &amp;#39;.&lt;br&gt;001480                             05 BAT-Q-TOT PIC Z(7)9.&lt;br&gt;001490                      03 P-BAT-PART.&lt;br&gt;001500                               05 BAT-PART PIC X(12)&lt;br&gt;001510                                                  VALUE &amp;#39; PART NOS: &amp;#39;.&lt;br&gt;001520                                 05 BAT-P-N-TOT PIC Z(7)9.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-6828684532206234245?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/6828684532206234245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/accept-and-display-data-in-cobol.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/6828684532206234245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/6828684532206234245'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/accept-and-display-data-in-cobol.html' title='Accept and Display DATA in COBOL'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-8165137518388398664</id><published>2009-08-20T15:57:00.002+05:30</published><updated>2009-08-26T16:12:42.047+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='COBOL TUTORIAL'/><title type='text'>DIVISIONS in COBOL</title><content type='html'>The following are the Four Divisions of COBOL :&lt;p&gt;COBOL program code is divided into four basic division:&lt;br&gt;IDENTIFICATION, ENVIRONMENT, DATA, and PROCEDURE divisions. The&lt;br&gt;identification division is required, but in theory the others are not&lt;br&gt;absolute (although you won&amp;#39;t have much of a program without any&lt;br&gt;procedures or data!).&lt;p&gt;=======================&lt;br&gt;The IDENTIFICATION DIVISION&lt;br&gt;=======================&lt;p&gt;The identification division tells the computer the name of the program&lt;br&gt;and supplies other documentation concerning the program&amp;#39;s author, when&lt;br&gt;it was written, when it was compiled, who it is intended for...etc. In&lt;br&gt;fact, only the program name is required by the compiler.&lt;p&gt;Syntax:-&lt;p&gt;000100 IDENTIFICATION DIVISION.&lt;br&gt;000110 PROGRAM-ID. EXAMPLE-1-PROG.&lt;br&gt;000120 AUTHOR.  ZINGMATTER.&lt;br&gt;000130 INSTALLATION. XYZ GROUP.&lt;br&gt;000140 DATE-WRITTEN. 17/5/00.&lt;br&gt;000150 DATE-COMPILED.&lt;br&gt;000160 SECURITY. LOCAL GROUP.&lt;p&gt;Note:&lt;p&gt;* The use of full stops is important. Throughout these pages, note&lt;br&gt;where they are positioned&lt;p&gt;* The first words (PROGRAM-ID, AUTHOR etc..) are written in area A,&lt;br&gt;the details are in&lt;br&gt;   area B&lt;p&gt;* The DATE-COMPILED detail is written automatically by the compiler&lt;p&gt;&lt;br&gt;=======================&lt;br&gt;The Environment Division&lt;br&gt;=======================&lt;br&gt;Syntax :-&lt;br&gt;     000260 ENVIRONMENT DIVISION.&lt;br&gt;     000270 CONFIGURATION SECTION.&lt;br&gt;     000280 SOURCE-COMPUTER.   IBM PC.&lt;br&gt;     000290 OBJECT-COMPUTER.   IBM PC.&lt;br&gt;     000300 INPUT-OUTPUT SECTION.&lt;p&gt;     000310 FILE-CONTROL.&lt;br&gt;     000320    SELECT INPUT-FILE ASSIGN TO &amp;#39;input.dat&amp;#39;&lt;br&gt;     000330      ORGANIZATION IS LINE SEQUENTIAL.&lt;br&gt;     000340    SELECT PRINT-FILE ASSIGN TO PRINTER.&lt;p&gt;Notes :-&lt;br&gt; *  You probably wouldn&amp;#39;t need to bother with the configuration section.&lt;br&gt; * The DIVISION and SECTION words are written into area A but the SELECT&lt;br&gt;     clause should be in area B.&lt;br&gt; * The full stop doesn&amp;#39;t appear in the SELECT clause until after the&lt;br&gt;ORGANIZATION&lt;br&gt;    has been specified.&lt;br&gt; * INPUT-FILE and PRINT-FILE are user-defined names that are used in&lt;br&gt;the program&lt;br&gt;    to refer to &amp;#39;input.dat&amp;#39; and the printer, respectively. If the&lt;br&gt;input.dat file was on a different disk drive, within a directory&lt;br&gt;structure, then you could write:&lt;br&gt;   ...ASSIGN TO &amp;#39;D:datafiles/data/input.dat&amp;#39;.&lt;br&gt; * Line 000330 describes the structure or form of the data written in&lt;br&gt;&amp;#39;input.dat&amp;#39; file. In this case, each record is on a new line in the&lt;br&gt;file (see&lt;br&gt;  * File Handling section for details). The printer also is assigned&lt;br&gt;but the organization doesn&amp;#39;t have to be secified.&lt;br&gt;  * For the SELECT clause, if no organization is defined the computer&lt;br&gt;defaults to SEQUENTIAL organization (i.e. each record appears in a&lt;br&gt;long string with no line breaks.&lt;p&gt;&lt;br&gt;=======================&lt;br&gt;The Data Division&lt;br&gt;=======================&lt;p&gt;The data division is where memory space in the computer is allocated&lt;br&gt;to data and identifiers that are to be used by the program.&lt;p&gt;Two important sections of this division are the FILE SECTION and the&lt;br&gt;WORKING-STORAGE SECTION. The file section is used to define the&lt;br&gt;structure, size and type of the data that will be read from or written&lt;br&gt;to a file.&lt;p&gt;Suppose the &amp;#39;input.dat&amp;#39; file (described above) contains a series of&lt;br&gt;records about a companies customers, giving details of name, address,&lt;br&gt;and customer number. If you were to open &amp;#39;input.dat&amp;#39; with a text&lt;br&gt;editor you would see each record on a new line like this:&lt;p&gt;       Joe Bloggs     20Shelly Road         Bigtown        023320&lt;br&gt;       John Dow       15Keats Avenue       Nowheresville042101&lt;br&gt;       Jock MacDoon05Elliot Drive            Midwich       100230&lt;p&gt; etc...&lt;p&gt;&lt;br&gt;The different pieces of data need to be defined so that the program&lt;br&gt;can read a record at a time, placing each piece of information into&lt;br&gt;the right area of memory (which will be labelled by an identifier).&lt;p&gt;The file section for this may look like this:&lt;p&gt;000400 DATA DIVISION.&lt;br&gt;000410 FILE SECTION.&lt;br&gt;000420&lt;br&gt;000430 FD INPUT-FILE.&lt;br&gt;000440 01 CUSTOMER-DATA.&lt;br&gt;000450 03 NAME PIC X(12).&lt;br&gt;000460 03 ADDRESS.&lt;br&gt;000470 05 HOUSE-NUMBER PIC 99.&lt;br&gt;000480 05 STREET PIC X(19).&lt;br&gt;000490 05 CITY PIC X(13).&lt;br&gt;000500 03 CUST-NUMBER PIC 9(6).&lt;p&gt;&lt;br&gt;Notes:&lt;p&gt;* &amp;#39;FD&amp;#39; stands for File Descriptor, and names the file, INPUT-FILE&lt;br&gt;(assigned in the environment division), and describes the exact&lt;br&gt;structure of the data in each record. All records in this file MUST be&lt;br&gt;of exactly the same structure.&lt;p&gt; * &amp;#39;01 CUSTOMER-DATA&amp;#39; is the group name and refers to all of the&lt;br&gt;single record that is read into the computer memory from the file. The&lt;br&gt;higher numbers (levels), 03.. and 05.. will contain the indivual&lt;br&gt;fields of the record.&lt;p&gt;  * Both FD and 01 are written in area A while higher levels are in area B.&lt;br&gt;   * Level 01 is sub-grouped into level 03 fields. Notice that one of&lt;br&gt;the level 03 sub-groups is itself sub-grouped into level 05. The&lt;br&gt;sub-grouping could continue upwards as required to 07, 09 etc.. These&lt;br&gt;numbers (except level 01) could as easily be 02, 03, 04 ...or any&lt;br&gt;increasing number scale. There are some numbers (i.e. 66, 77 and 88)&lt;br&gt;which actually have other uses but these will be discussed in the&lt;br&gt;Defining Data section.&lt;p&gt;  * The PIC (short for PICTURE) clause indicates the size and type of&lt;br&gt;data that that field contains. For example, in line 000450, the data&lt;br&gt;name (identifier) NAME has been defined as holding 12 characters of&lt;br&gt;alphnumeric data. It could have been written as PIC XXXXXXXXXXXX be&lt;br&gt;that&amp;#39;s a pain. &amp;#39;X&amp;#39; means alphnumeric and can contain any ASCII&lt;br&gt;character. However, even if it contained &amp;#39;2&amp;#39; you could not do any&lt;br&gt;calculations on this as the information is stored as the ASCII code&lt;br&gt;for the character &amp;#39;2&amp;#39;, rather than the actual number 2. Line 000470&lt;br&gt;defines HOUSE-NUMBER as PIC 9(2), which can hold a 2-digit number.&lt;p&gt;You can do calculations with this since &amp;#39;9&amp;#39; is used to denote a numeric field.&lt;p&gt;&lt;br&gt; * Notice how the group names (CUSTOMER-DATA and ADDRESS) do not have&lt;br&gt;PIC descriptions. This is because the higher level field descriptions&lt;br&gt;when added together will be the size of the group name, i.e.&lt;br&gt;CUSTOMER-NUMBER will hold 46 characters which turns out to be the size&lt;br&gt;of each record (spaces are included). You can refer to these group&lt;br&gt;names but when doing so all data will be treated as alphanumeric and&lt;br&gt;cannot be used for calculations, even if all of the higher group items&lt;br&gt;are numeric.&lt;p&gt;&lt;br&gt;The WORKING-STORAGE SECTION of the data division is for defining data&lt;br&gt;that is to be stored in temporary memory, i.e. during program&lt;br&gt;run-time. Effectively, this is where, for example, an identifier is&lt;br&gt;defined that will hold the result of a calculation.&lt;p&gt;000500 DATA DIVISION.&lt;br&gt;000510 WORKING-STORAGE SECTION.&lt;br&gt;000520&lt;br&gt;000530 01 RECORD-COUNTER PIC 9(5).&lt;p&gt;&lt;p&gt;  Also see the &amp;#39;Hello World program. In that case the string to be&lt;br&gt;displayed on the screen is actually defined in working-storage using&lt;br&gt;the VALUE clause (01 TEXT-OUT PIC X(12) VALUE &amp;#39;Hello World!&amp;#39;). The&lt;br&gt;same can be done for numeric data e.g.:&lt;p&gt;&lt;br&gt;000800 01 TOTALS-IN.&lt;br&gt;000810 03 1ST-NO PIC 99 VALUE ZERO.&lt;br&gt;000820 03 2ND-NO PIC 999 VALUE 100.&lt;p&gt;&lt;br&gt;The equivalent to filling an item such as 1ST-NO (above) with zeroes,&lt;br&gt;is filling an alphanumeric (PIC X) item with spaces e.g. 01 MESSAGE&lt;br&gt;PIC X(12) VALUE SPACES.&lt;p&gt;&lt;br&gt;=======================&lt;br&gt;The Procedure Division&lt;br&gt;=======================&lt;br&gt;COBOL is a modular language, in that a program is usually broken up&lt;br&gt;into units described as paragraphs.&lt;p&gt;&lt;br&gt;000900 PROCEDURE DIVISION.&lt;br&gt;000910 CONTROL-PARAGRAPH.&lt;br&gt;000920 PERFORM READ-DATA-FILE&lt;br&gt;000930 PERFORM CALULATE-PRICES&lt;br&gt;000940 PERFORM PRINT-PRICE-REPORT&lt;br&gt;000950 STOP RUN.&lt;p&gt;The PERFORM statement is used to &amp;#39;call&amp;#39; other paragraphs to do each&lt;br&gt;task. These paragraphs would appear in the same coding and are part of&lt;br&gt;the same program. In the above example, the program would consist of&lt;br&gt;four paragraphs: the CONTROL-PARAGRAPH and the three called from&lt;br&gt;within it. All of the paragraph names are user-defined. Even if a&lt;br&gt;program only has one paragraph, it must still have a name. The &amp;#39;Hello&lt;br&gt;World&amp;#39; program has a paragraph name MAIN-PARAGRAPH. Regarding&lt;br&gt;punctuation, as a rule there should only be two full stops in any&lt;br&gt;paragraph; one after the paragraph name and the other at the end of&lt;br&gt;the paragraph.&lt;p&gt;Sub-programs&lt;br&gt;==========&lt;br&gt;A program may also refer to a different program, called a sub-program.&lt;br&gt;A sub-program is an entirely different program from the calling&lt;br&gt;program, with its own divisions etc... with the exception that it does&lt;br&gt;not end with STOP RUN (which would return you to the operating&lt;br&gt;system), but with EXIT PROGRAM. The sub-program is a module, rather&lt;br&gt;than a subroutine which is what a paragraph could be described as. The&lt;br&gt;verb CALL is used to activate the sub-program:&lt;p&gt;&lt;br&gt;000800 DATA DIVISION.&lt;br&gt;000810 WORKING-STORAGE SECTION.&lt;br&gt;000820 01 W-DATE-IN PIC 9(6).&lt;br&gt;000850 LINKAGE SECTION.&lt;br&gt;000860 01 L-DATE-IN.&lt;br&gt;000870 03 DAY PIC 99.&lt;br&gt;000880 03 MONTH PIC 99.&lt;br&gt;000890 03 YEAR PIC 99.&lt;br&gt;000900 PROCEDURE DIVISION.&lt;br&gt;000910 CONTROL-PARAGRAPH.&lt;br&gt;000920 PERFORM READ-FILE&lt;br&gt;000930 CALL &amp;quot;VALIDATE-DATE&amp;quot; USING L-DATE-IN&lt;br&gt;001950 STOP RUN.&lt;br&gt;003000 IDENTIFICATION DIVISION.&lt;br&gt;003010 PROGRAM-ID. VALIDATE-DATE.&lt;br&gt;003020 ...........&lt;br&gt;............etc.....&lt;br&gt;003500 PRODECURE DIVISION USING L-DATE-IN.&lt;br&gt;004000 EXIT PROGRAM.&lt;p&gt;&lt;br&gt;In the above code, a sub-program is called, named VALIDATE-DATE&lt;p&gt;In order to use data from the calling program in the sub-program the&lt;br&gt;calling program uses a section in the data division called the LINKAGE&lt;br&gt;SECTION. The item W-DATE-IN in the calling program occupies the same&lt;br&gt;memory address as the sub-program&amp;#39;s item L-DATE-IN, so the number&lt;br&gt;placed in W-DATE-IN item using the VALUE clause is also in L-DATE-IN.&lt;br&gt;Note: you cannot use VALUE in the linkage section.&lt;p&gt;The procedure division of the sub-program requiring the use of linkage&lt;br&gt;section defined data must say so by: PROCEDURE DIVISION USING&lt;br&gt;...[linkage section items to be used] also refered to by the CALL ...&lt;br&gt;USING. See lines 000930 and 3500 above.&lt;p&gt;In the above example, what is being called (&amp;quot;VALIDATE-DATE&amp;quot;) is a&lt;br&gt;literal. This means that you could use an identifier instead, allowing&lt;br&gt;you a choice between sub-programs depending on what the literal had&lt;br&gt;been previously defined as. For example, if a record was of type &amp;quot;A&amp;quot;&lt;br&gt;then you may want to process that record using sub-program&lt;br&gt;PROCESS-A-REC, but if a type &amp;quot;B&amp;quot; record the use PROCESS-B-REC.&lt;br&gt;  The logic might be as follows:&lt;p&gt;&lt;p&gt;0003000 IF RECORD-TYPE = &amp;quot;A&amp;quot; THEN&lt;br&gt;0003010 MOVE &amp;quot;PROCESS-A-REC&amp;quot; TO SUB-PROG&lt;br&gt;0003020 ELSE MOVE &amp;quot;PROCESS-B-REC&amp;quot; TO SUB-PROG&lt;br&gt;0003030 CALL SUB-PROG USING L-REC-DATA&lt;p&gt;&lt;br&gt;Although I haven&amp;#39;t described the various commands of the procedure&lt;br&gt;division the above code is fairly clear...if a marker called&lt;br&gt;RECORD-TYPE has been set as &amp;quot;A&amp;quot; then place (i.e. MOVE) the string&lt;br&gt;&amp;quot;PROCESS-A-REC&amp;quot; into the area of memory labelled as SUB-PROG (so now&lt;br&gt;SUB-PROG contains this string). Otherwise (i.e. ELSE) it is assumed&lt;br&gt;that the only other type there is can be &amp;quot;B&amp;quot; type and so&lt;br&gt;&amp;quot;PROCESS-B-REC&amp;quot; is MOVEd into SUB-PROG. Depending on what the item&lt;br&gt;SUB-PROG contains the desired sub-program will be called.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-8165137518388398664?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/8165137518388398664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/divisions-in-cobol.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/8165137518388398664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/8165137518388398664'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/divisions-in-cobol.html' title='DIVISIONS in COBOL'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-6290677009141173518</id><published>2009-08-20T14:52:00.002+05:30</published><updated>2009-08-26T16:12:54.910+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='COBOL TUTORIAL'/><title type='text'>BASICS of COBOL</title><content type='html'>The below given three important categories required :-&lt;br&gt;BASICS :-&lt;p&gt;1) Coding Areas&lt;br&gt;2) Syntax&lt;br&gt;3) The Hello World Program&lt;p&gt;-----------------&lt;br&gt;Coding Areas&lt;br&gt;-----------------&lt;p&gt;If you look at the COBOL coding in later sections (e.g. League Table&lt;br&gt;program in the Sample code section) the specific positions of coding&lt;br&gt;elements are important for the compiler to understand. Essentially,&lt;br&gt;the first 6 spaces are ignored by the compiler and are usually used by&lt;br&gt;the programmer for line numbers. These numbers arenot the same as&lt;br&gt;those in BASIC where the line number is used as part of the logic&lt;br&gt;(e.g. GOTO 280, sending the logic to line 280).&lt;p&gt;The seventh position is called the continuation area. Only certain&lt;br&gt;characters ever appear here, these being:&lt;br&gt;* (asterisk), / (solidus or forward slash), or - (hyphen).&lt;br&gt;The asterisk is used to precede a comment, i.e. all that follows is&lt;br&gt;ignored by the compiler. The solidus is used to indicate a page break&lt;br&gt;when printing coding from the compiler, but it too can be used as&lt;br&gt;comment since the rest of the line is ignored by the compiler. The&lt;br&gt;hyphen is used as a continuation marker, i.e. when a quoted literal&lt;br&gt;needs to be extended over to the next line. It is not for continuing a&lt;br&gt;statement onto the next line (this is unnecessary*) and also cannot be&lt;br&gt;used to continue a COBOL word. (*You can write any COBOL statement&lt;br&gt;over as many lines as you like, so long as you stay in the correct&lt;br&gt;coding region and don&amp;#39;t split strings.)&lt;p&gt;Sample :-&lt;br&gt;----------&lt;br&gt;     000200*Here is a comment.&lt;br&gt;     000210/A new line for printing and a comment.&lt;br&gt;     000220&lt;br&gt;       :&lt;br&gt;     000340       DISPLAY &amp;#39;This might be a very long string that&lt;br&gt;     000350-    &amp;#39;needs to be continued onto the next line&amp;#39;&lt;p&gt;&lt;p&gt;&lt;br&gt;Positions 8 to 11 and 12 to 72 are called area A and area B,&lt;br&gt;respectively. These are used in specific instances that will be&lt;br&gt;detailed in later sections.&lt;p&gt;&lt;br&gt;Summary&lt;br&gt;Positions           Description&lt;br&gt;------------------------------------&lt;p&gt;   1 to 6    ----&amp;gt;   line code&lt;p&gt;        7     -----&amp;gt;  continuation area&lt;p&gt;  8 to 11   -----&amp;gt;  area  A&lt;p&gt; 12 to 72  ------&amp;gt;  area B&lt;br&gt;-------------------------------------------&lt;p&gt;&lt;br&gt;---------------&lt;br&gt;2) Syntax&lt;br&gt;--------------&lt;p&gt;Identifier names&lt;br&gt;================&lt;br&gt;User-defined names must conform to the following rules:&lt;p&gt;    * Must only consist of alphabetic and numeric characters and/or hyphens&lt;br&gt;    * The name must contain at least one alphabetic character&lt;br&gt;    * Must be no more than 30 characters&lt;br&gt;    * When using hyphens, they must not appear at the beginning or end&lt;br&gt;of the name&lt;p&gt;Some examples of legal names:&lt;p&gt;A123&lt;br&gt;RecordCount-1&lt;br&gt;WAGE-IN&lt;br&gt;Tot-2-out&lt;p&gt;Like all COBOL code, the compiler will not distinguish between upper&lt;br&gt;and lower case letters (except within quotes).&lt;p&gt;Lastly, COBOL has a large list of reserved words that cannot be used&lt;br&gt;as identifier names. A list of COBOL reserved words is given&lt;br&gt;elsewhere.&lt;p&gt;Punctuation&lt;br&gt;=============&lt;br&gt;The full stop (period) is the most important punctuation mark used,&lt;br&gt;and its use will be detailed later (see Scope terminators). Generally,&lt;br&gt;every line of the IDENTIFICATION, ENVIRONMENT, and DATA DIVISION end&lt;br&gt;in a period.&lt;p&gt;Quotation marks, either single or double, are used to surround quoted&lt;br&gt;literals (and when calling a sub-program). However, don&amp;#226;t mix them&lt;br&gt;when surrounding the literal, e.g.&lt;p&gt;&amp;quot; This is bad &amp;#226;&lt;p&gt;&amp;quot; but this is ok &amp;quot;&lt;p&gt;Commas and semi-colons are also used to separate lists of identifiers,&lt;br&gt;e.g.&lt;br&gt;         MOVE 2 TO DATA-ITEM-1, DATA-ITEM-2, DATA-ITEM-3&lt;br&gt;A space must follow the comma/semi-colon. They are optional however,&lt;br&gt;and a space would suffice, but it does add to clarity.&lt;p&gt;&lt;br&gt;Spelling&lt;br&gt;=========&lt;br&gt;Since COBOL was developed in the USA, the spelling of words is&lt;br&gt;American, e.g. INITIALIZE or ORGANIZATION (using Z rather than S).&lt;br&gt;Brits be warned!&lt;p&gt;In many cases, abbreviations and alternative spellings are available&lt;br&gt;(see reserved word list), e.g. ZERO ZEROS ZEROES all mean the same&lt;br&gt;thing. Likewise, LINE and LINES, PICTURE and PIC, THROUGH and THRU.&lt;p&gt;----------------------&lt;br&gt;Sample  Program&lt;br&gt;----------------------&lt;p&gt;As is traditional for all introductory lessons for a programming&lt;br&gt;language, here&amp;#39;s a &amp;#39;Hello World&amp;#39; program:&lt;p&gt;&lt;br&gt;================== The &amp;#39;Hello World&amp;#39; Program ==============================&lt;p&gt;&lt;br&gt;000010 IDENTIFICATION DIVISION.&lt;br&gt;000020 PROGRAM-ID. HELLO-WORLD-PROG.&lt;br&gt;000030 AUTHOR. TIMOTHY R P BROWN.&lt;br&gt;000040*The standard Hello world program&lt;br&gt;000050 000060 ENVIRONMENT DIVISION.&lt;br&gt;000070 000080 DATA DIVISION&lt;br&gt;000090 WORKING-STORAGE SECTION.&lt;br&gt;000100 01 TEXT-OUT PIC X(12) VALUE &amp;#39;Hello World!&amp;#39;.&lt;br&gt;000110 000120 PROCEDURE DIVISION.&lt;br&gt;000130 MAIN-PARAGRAPH.&lt;br&gt;000140 DISPLAY TEXT-OUT&lt;br&gt;000150 STOP RUN.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-6290677009141173518?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/6290677009141173518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/basics-of-cobol.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/6290677009141173518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/6290677009141173518'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/basics-of-cobol.html' title='BASICS of COBOL'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-5763496610805525840</id><published>2009-08-20T14:43:00.002+05:30</published><updated>2009-08-26T16:13:25.727+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='COBOL TUTORIAL'/><title type='text'>INTRODUCTION to COBOL</title><content type='html'>COBOL is a third-generation programming language, and one of the&lt;br&gt;oldest programming languages still in active use. Its name is an&lt;br&gt;acronym, for Common Business Oriented Language, defining its primary&lt;br&gt;domain in business, finance, and administrative systems for companies&lt;br&gt;and governments.&lt;p&gt;The COBOL 2002 standard includes support for object-oriented&lt;br&gt;programming and other modern language features.&lt;p&gt;COBOL programs are in use globally in governmental and military&lt;br&gt;agencies, in commercial enterprises, and on operating systems such as&lt;br&gt;IBM&amp;#39;s z/OS, Microsoft&amp;#39;s Windows, and the Unix/Linux families. In the&lt;br&gt;late 1990s, the Gartner Group, a data-processing industry research&lt;br&gt;organization, estimated that of the 300 billion lines of computer code&lt;br&gt;that existed, eighty percent — or 240 billion lines — were COBOL. They&lt;br&gt;also reported that more than half of all new mission-critical&lt;br&gt;applications were still being created using COBOL — an estimated&lt;br&gt;5,000,000,000 net new lines of COBOL code annually.&lt;p&gt;Near the end of the twentieth century the year 2000 problem was the&lt;br&gt;focus of significant COBOL programming effort, sometimes by the same&lt;br&gt;programmers who had designed the systems decades before. The&lt;br&gt;particular level of effort required for COBOL code has been attributed&lt;br&gt;both to the large amount of business-oriented COBOL, as COBOL is by&lt;br&gt;design a business language and business applications use dates&lt;br&gt;heavily, and to constructs of the COBOL language such as the PICTURE&lt;br&gt;clause, which can be used to define fixed-length numeric fields,&lt;br&gt;including two-digit fields for years.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-5763496610805525840?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/5763496610805525840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/introduction-to-cobol.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/5763496610805525840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/5763496610805525840'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/introduction-to-cobol.html' title='INTRODUCTION to COBOL'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-7273723520407552779</id><published>2009-08-18T11:32:00.001+05:30</published><updated>2009-08-18T11:34:14.362+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='cobol articles'/><title type='text'>COBOL programmers are still in the game</title><content type='html'>&lt;div style="text-align: center; font-weight: bold; color: rgb(255, 102, 0);"&gt;COBOL programmers back in the game&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: right;"&gt;                              compiled from  the post by ITworld&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;You're wrong if you think COBOL programmers are doomed to go the way of the Edsel. Despite predictions to the contrary, the world kept revolving around its axis after Y2K. Yet, the job market for COBOL programmers suddenly plunged -- and so did their salaries. However, this decline has since been stemmed thanks to the Internet's transition into a sprawling shopping mall selling everything from toothbrushes to tractors.&lt;br /&gt;&lt;br /&gt;In the late 1990s, organizations fired up Y2K remediation projects and sought COBOL programmers to immunize legacy (database management systems running on mainframes or minicomputers) business applications against Y2K-related problems. Today, companies are finding that they need help integrating these legacy systems with new applications.&lt;br /&gt;&lt;br /&gt;A couple of years ago Bill Lockhart, 63, a veteran COBOL programmer from Los Altos, Calif., was hard pressed to find a company that would take advantage of his more than 30 years of experience. His experience as a COBOL programmer dates to 1966 when he worked as a systems programmer. More recently, as a database specialist, he worked on several assignments for IBM writing in COBOL, PL/I, REXX, and assembly language.&lt;br /&gt;&lt;br /&gt;"The tables have turned," chuckles Lockhart. "IT industries need my COBOL skills to get going on the Web."&lt;br /&gt;&lt;br /&gt;Most of the world's business data, approximately 75 to 85 percent, is written in COBOL," adds Bill Payson, president and CEO of Senior Techs, an Internet-based job bank for experienced IT professionals in Campbell, Calif. "That translates to some hundreds of billions of lines of code."&lt;br /&gt;&lt;br /&gt;COBOL is used in some manner by almost all Fortune 500 companies. Many of these companies have a large pool of COBOL-based applications that are primary business systems. E-business requires these systems to be integrated and connected to the outside world.&lt;br /&gt;&lt;br /&gt;"With the future of all commerce linked to the Internet, companies with massive databases know that success depends on the ability to move data in and out of the Internet," Payson explains.&lt;br /&gt;&lt;br /&gt;Paul Halpern, director of traditional development solutions at Merant, a Web-enabling training company in Mountain View, Calif., maintains that, "If all the COBOL programs stopped working, the US economy would collapse." And he points out: "Nine out of ten of the top Internet brokers use COBOL with CICS [Customer Information Control Systems]. Chances are that when you use an ATM card you are starting a COBOL/CICS process. An IBM report published last year indicates 30 billion COBOL/CICS transactions are executed worldwide each day, more than the total number of Web pages hit each day."&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-7273723520407552779?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/7273723520407552779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/cobol-programmers-are-still-in-game.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/7273723520407552779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/7273723520407552779'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/cobol-programmers-are-still-in-game.html' title='COBOL programmers are still in the game'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8499164315143266409.post-9001473306840077380</id><published>2009-08-18T11:29:00.002+05:30</published><updated>2009-08-18T11:32:17.642+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='cobol articles'/><title type='text'>COBOL skills future in DEMAND</title><content type='html'>COBOL skills needed in the future&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;An article -- By Matt Stansberry, News Editor&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To paraphrase German philosopher Friedrich Nietzsche, COBOL is dead. Or at least that's what some people in the IT world believe. It's a legacy language with relatively little new development taking place.&lt;br /&gt;&lt;br /&gt;But the growth of the mainframe of late, combined with the staggering amount of COBOL running currently, has some experts are questioning whether the 800-pound gorilla is really dead. So Rockville, Md.-based Micro Focus International Ltd. decided to poke it with a stick to find out.&lt;br /&gt;&lt;br /&gt;According to preliminary results of Micro Focus' survey of 750 mainframers in the U.S. and Canada, 41% name COBOL as a principal programming language by an approximate 25% margin over Java, the next most popular language. Preliminary results also find 52% of mainframe applications are still written in COBOL. ((Content component not found.))&lt;br /&gt;&lt;br /&gt;The survey also found the median age of the COBOL programmer is 45-49, leading to the belief that there will be a growing knowledge shortage of COBOL programmers in the next decade.&lt;br /&gt;&lt;br /&gt;Which raises the question: If your son or daughter were enrolled in a computer science program, would you encourage him or her to take classes in COBOL?&lt;br /&gt;&lt;br /&gt;As it happens, Mark Lillycrop, CEO of U.K.-based Arcati Research and Publishing, has a nephew that is a first-year computer science student, and he has been encouraging him to pursue mainframe skills.&lt;br /&gt;&lt;br /&gt;"COBOL is like an invisible giant. There's reported to be 180 billion-200 billion lines of code out there, processing 75% of commercial business. Few companies are keen to throw away the hundreds or thousands of man-years that have been invested in mature, high-performance COBOL code. Instead, they are integrating and building bridges between COBOL, .NET and J2EE [Java 2 Platform, Enterprise Edition], using service-oriented architectures to preserve the strengths of the legacy code while benefiting from Web-oriented development tools," Lillycrop said.&lt;br /&gt;&lt;br /&gt;Ron Kizior, assistant professor Loyola University Chicago School of Business, ISOM area, worked on the Micro Focus survey. According to Kizior, the aspect that surprised him the most was the small number of mainframe shops that had gone to the Web. He'd expected up to 40%, but the numbers showed only 10%.&lt;br /&gt;&lt;br /&gt;Despite that small number, Lillycrop and Kizior said the ability to integrate COBOL with Web-oriented development tools would be the skill to have in the future.&lt;br /&gt;&lt;br /&gt;"It's not enough to know COBOL; the real winners are those who understand how to integrate with newer technologies. Some of the more enlightened universities are trying to get to grips with this emerging requirement, and are bringing the necessary mainframe components back onto the syllabus," Lillycrop said. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Loyola University Chicago is offering workshops on COBOL integration with .NET this summer, according to Kizior. He said it's harder to convince university administrators to consider COBOL than it is to persuade students.&lt;br /&gt;&lt;br /&gt;"COBOL gives you a better understanding of what programming is. It's like taking the classics. It gives you a well-rounded background," Kizior said.&lt;br /&gt;&lt;br /&gt;COBOL will be at the center of the enterprise for many years to come, with a huge ongoing support requirement. According to Lillycrop, when the current population of 50-something COBOL specialists finally retire, people with the right combination of skills will be able to name their price.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8499164315143266409-9001473306840077380?l=cobolminds.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cobolminds.blogspot.com/feeds/9001473306840077380/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cobolminds.blogspot.com/2009/08/cobol-skills-future-in-demand.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/9001473306840077380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8499164315143266409/posts/default/9001473306840077380'/><link rel='alternate' type='text/html' href='http://cobolminds.blogspot.com/2009/08/cobol-skills-future-in-demand.html' title='COBOL skills future in DEMAND'/><author><name>admin-r</name><uri>http://www.blogger.com/profile/03057974273660695629</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
