<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:gd="http://schemas.google.com/g/2005" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DUMNSHY9eip7ImA9Wx5TFUQ.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903</id><updated>2010-07-31T23:01:39.862+05:30</updated><title>MAINFRAMES TUTORIAL, JCL TUTORIAL, VSAM TUTORIAL, COBOL TUTORIAL, DB2 TUTORIAL, CICS</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://www.mainframes360.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://www.mainframes360.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>77</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics" /><feedburner:info uri="mainframestutorialjcltutorialvsamtutorialcoboltutorialdb2tutorialcics" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;A0AFQXc7cCp7ImA9Wx5TEEw.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-3399012700133370553</id><published>2010-07-25T06:31:00.001+05:30</published><updated>2010-07-25T06:31:50.908+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-25T06:31:50.908+05:30</app:edited><title>CA-7 Commands</title><content type="html">&lt;br /&gt;  &lt;table border="1" cellspacing="0" cellpadding="0" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What is CA-7 Scheduler? Where did CA-7 come from?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;Think of jobs as, Flights taking off from an Airport. On a busy airport, when the clock strikes 09:00 AM, all jobs that were scheduled to depart at 09:00 AM take-off. CA-7 Scheduler manages and oversees all of this.            &lt;br /&gt;            &lt;br /&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;In the Production Environment(where things are running live), you don’t type SUB on a &lt;u&gt;Production Job&lt;/u&gt; and give it to the Mainframe Computer for Processing. &lt;u&gt;Production Jobs&lt;/u&gt; are generally scheduled – they auto-start at a given time. The &lt;u&gt;CA-7 Scheduler&lt;/u&gt; on Mainframes maintains a periodic &lt;u&gt;Time-table&lt;/u&gt;, a database or chart of which jobs run when?             &lt;br /&gt;            &lt;br /&gt;A company had made CA-7 in the United States for their own internal use, under the name SASS. You would still see programs like SASSBSTR and SASS Messages today. Universal Computing Company(UCC) bought the product SASS and renamed it UCC-7. In 1987, Computer Associates(CA) bought UCC, and it was their policy to name all their products with CA Prefix, so UCC-7 became CA-7. &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What is the CA-7 Queueing System?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;CA-7 has different staging areas called Queues, where jobs could be. The CA-7 Queues are the (1) &lt;u&gt;Request Queue&lt;/u&gt; (2) &lt;u&gt;Ready Queue&lt;/u&gt; and (3) &lt;u&gt;Active Queue&lt;/u&gt;. These queues are like traffic signals on a road. First the job has got to wait in the &lt;u&gt;Request Queue&lt;/u&gt;(Red Signal). Next, the job has to wait in the &lt;u&gt;Ready Queue&lt;/u&gt;(Orange Signal) – this means the job is almost ready to run. When the job is currently running, we say its in the &lt;u&gt;Active Queue&lt;/u&gt;(Green Signal).             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/TEuM0kjGnvI/AAAAAAAAC9g/O7FgyrEZ5fY/s1600-h/Image21917.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Image219[1]" border="0" alt="Image219[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/TEuM2me7luI/AAAAAAAAC9k/Q9m9DlsKMOU/Image2191_thumb5.png?imgmax=800" width="775" height="478" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;/font&gt;(1) The Database holds the &lt;u&gt;Timetable&lt;/u&gt; of when the jobs run. CA-7 periodically scans the database(timetable) for which jobs are likely to run in the next few minutes.             &lt;br /&gt;            &lt;br /&gt;(2) When the clock strikes 09:00 HRS, the Job A enters into the &lt;u&gt;Request Queue&lt;/u&gt;. The JCL of the Job is picked up from the JCL Library and added to the Trailer of the CA-7 Request. Each Job in the &lt;u&gt;Request Queue&lt;/u&gt;, waits for certain requirements to met.             &lt;br /&gt;            &lt;br /&gt;(3) When all conditions and requirements are met, the job progresses ahead to the &lt;u&gt;WLB&lt;/u&gt;(Workload Balancing).             &lt;br /&gt;            &lt;br /&gt;(4) When there are enough initiators to pick up the Job from the Queue, the job is sent to the JES2. While a job is on &lt;u&gt;WLB&lt;/u&gt; or &lt;u&gt;JES2&lt;/u&gt;, its shown on the             &lt;br /&gt;&lt;u&gt;Ready Queue&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;(5) An SMF Type 20 or 30 record(job initialization) is received by CA-7, and the job is moved to the Active Queue, and will start execution in an address space.             &lt;br /&gt;            &lt;br /&gt;(6) The job will remain on the Active Queue, until an SMF Type 5 or 30(job completion) is received by CA-7. On receipt of the job completion, if the job is successful, the &lt;u&gt;Prior Run Queue&lt;/u&gt;(PRRN) Queue will be updated with the details of the execution. This serves as a last run-time record for the job. However, if the job fails, it will be returned to the &lt;u&gt;Request Queue&lt;/u&gt;(REQ).&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How a job enters into the Request(REQ) Queue?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;There are 3 ways, a job can enter into the &lt;u&gt;Request Queue&lt;/u&gt;[REQ]. A job can be Scheduled, triggered or demanded out.             &lt;br /&gt;            &lt;br /&gt;(1) &lt;u&gt;Scheduled&lt;/u&gt;(SSCN) – Jobs can be scheduled to run at a fixed time – for example, Reporting job runs every month-end at 08:00 PM, Load jobs run every-day at 05:00 AM and so on.             &lt;br /&gt;            &lt;br /&gt;(2) &lt;u&gt;Triggered&lt;/u&gt;(AUTO) – A parent job X, when it runs to successful completion, can TRIGGER another child job Y. A &lt;u&gt;TRIGGER&lt;/u&gt; automatically brings Job Y into the REQ Queue.             &lt;br /&gt;            &lt;br /&gt;(3) &lt;u&gt;Demanded&lt;/u&gt;(DEMD) – A Job X can programmatically &lt;u&gt;Demand out&lt;/u&gt; another Job Y. For example,             &lt;br /&gt;Job X has the following code :             &lt;br /&gt;            &lt;br /&gt;If &lt;u&gt;Input File&lt;/u&gt; contains &lt;u&gt;DATA              &lt;br /&gt;&lt;/u&gt;&amp;#160;&amp;#160; Demand Job Y             &lt;br /&gt;Else             &lt;br /&gt;&amp;#160;&amp;#160; Continue             &lt;br /&gt;End-if             &lt;br /&gt;            &lt;br /&gt;Here, Job Y is brought into the &lt;u&gt;Request Queue&lt;/u&gt;[REQ], only if the Input-file has data records. If the Input file is empty; if there’s no data to process, the job is not demanded out. So, in this fashion, you can exercise more control, over how the job kicks off.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How to know Job’s information in CA-7?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;You type the command &lt;strong&gt;LJOB,JOB&lt;/strong&gt;=jobname,&lt;strong&gt;LIST=ALL&lt;/strong&gt; to find all the information about a job. Look at how I’ve found all the information about my job GEMPAIAS on CA-7.             &lt;br /&gt;            &lt;br /&gt;            &lt;div style="padding-bottom: 0px; margin: 0px auto; padding-left: 0px; width: 425px; padding-right: 0px; display: block; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:c56709c6-6e6e-491f-8e01-8add1a392d60" class="wlWriterEditableSmartContent"&gt;&lt;div id="b0abeb0b-9b88-4e81-9cc0-b882da1a6980" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=Pob83o3x9CY" target="_new"&gt;&lt;img src="http://lh4.ggpht.com/_sQvdFWqMlMg/TEuM31R1lJI/AAAAAAAAC9o/9hzRxFG6IzM/video4e967c49c006%5B10%5D.jpg?imgmax=800" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('b0abeb0b-9b88-4e81-9cc0-b882da1a6980'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/Pob83o3x9CY&amp;amp;hl=en\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/Pob83o3x9CY&amp;amp;hl=en\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;            &lt;br /&gt;This shows all the information about my job GEMPAIAS – which jobs does it trigger, which are the successor jobs, what are the steps in this job etc.             &lt;br /&gt;            &lt;br /&gt;To know, if a job is &lt;u&gt;Scheduled&lt;/u&gt;, or &lt;u&gt;Triggered&lt;/u&gt; or &lt;u&gt;Demanded&lt;/u&gt; out, the CA-7 Commands are             &lt;br /&gt;&lt;u&gt;Scheduled&lt;/u&gt; – &lt;strong&gt;LSCHD,JOB=&lt;/strong&gt;jobname&lt;strong&gt;,LIST=CALS&lt;/strong&gt;             &lt;br /&gt;&lt;u&gt;Triggered&lt;/u&gt; – &lt;strong&gt;LJOB,JOB=&lt;/strong&gt;jobname,&lt;strong&gt;LIST=TRIG &lt;/strong&gt;            &lt;br /&gt;&lt;u&gt;Demanded&lt;/u&gt; – Unfortunately, there’s no direct way no this, as Demand Information is not stored in CA-7, but in JCL. However, if the Job is demanded out into the REQ Queue, it shows up as DEMD in the Entry Mode column. Sometimes, you can use &lt;strong&gt;LJOB,JOB=&lt;/strong&gt;jobname,&lt;strong&gt;LIST=PROS&lt;/strong&gt; option of the LJOB Command to find out information about the Demanding job. &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. How to know, if a job is scheduled?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;The quick way to know if a Job is &lt;u&gt;Scheduled&lt;/u&gt;, is to use the &lt;u&gt;List Schedule&lt;/u&gt;[LSCHD] Command, with &lt;strong&gt;LIST=CALS&lt;/strong&gt;(Calendar) option. This opens up a Calendar view, and tells us, what time and on what calendar days of the year, your job is going to run.             &lt;br /&gt;            &lt;br /&gt;In the clipping below, my job GMSBDRQ1 runs on all week-days, Monday-to-Friday at 23:00 hrs.             &lt;br /&gt;&lt;/font&gt;          &lt;br /&gt;          &lt;div style="padding-bottom: 0px; padding-left: 0px; width: 425px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:e84a840e-e61f-4472-9e31-6cea6bfd32b7" class="wlWriterEditableSmartContent"&gt;&lt;div id="5a640405-d385-4a5d-bc03-56b74d0b8466" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=9s0mkDZTqbY" target="_new"&gt;&lt;img src="http://lh6.ggpht.com/_sQvdFWqMlMg/TEuM4y2zdGI/AAAAAAAAC9s/3VfiuvIkdNQ/videoe5d311be9ad2%5B10%5D.jpg?imgmax=800" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('5a640405-d385-4a5d-bc03-56b74d0b8466'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/9s0mkDZTqbY&amp;amp;hl=en\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/9s0mkDZTqbY&amp;amp;hl=en\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. How to know, if a job is triggered?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;A &lt;u&gt;job X&lt;/u&gt; can be brought in the &lt;u&gt;REQ(Request) Queue&lt;/u&gt;, when it is &lt;u&gt;triggered&lt;/u&gt; by             &lt;br /&gt;&lt;u&gt;Job Y&lt;/u&gt;. How do you know, the Triggering Job or Parent Job. You can code &lt;u&gt;LIST=TRIG&lt;/u&gt;(Triggers) option on the &lt;u&gt;LJOB Command&lt;/u&gt;, to find out the             &lt;br /&gt;&lt;u&gt;triggering job&lt;/u&gt;. In the below clipping, my job &lt;u&gt;XRPDGLPS&lt;/u&gt; is triggered by the parent job &lt;u&gt;GMSBDRQ1&lt;/u&gt;. When &lt;u&gt;GMSBDRQ1&lt;/u&gt; completes, my job &lt;u&gt;XRPDGLPS&lt;/u&gt; would be brought into the REQ(Request) Queue.             &lt;br /&gt;            &lt;br /&gt;            &lt;div style="padding-bottom: 0px; margin: 0px auto; padding-left: 0px; width: 425px; padding-right: 0px; display: block; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:91d62b9a-e968-49f0-bd0a-45e543afc6d6" class="wlWriterEditableSmartContent"&gt;&lt;div id="8c325ffb-6e3f-46ec-8654-6a000a29c908" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=o_RB0LQH5wM" target="_new"&gt;&lt;img src="http://lh3.ggpht.com/_sQvdFWqMlMg/TEuM58cQRbI/AAAAAAAAC9w/wELpDMOe-Bk/video88c4db231b8e%5B10%5D.jpg?imgmax=800" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('8c325ffb-6e3f-46ec-8654-6a000a29c908'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/o_RB0LQH5wM&amp;amp;hl=en\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/o_RB0LQH5wM&amp;amp;hl=en\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;         &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. How to know if a Job is Demanded out?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;A job can be programmatically demanded out by another job, based on given condition. If the condition is true, the job is demanded out into the REQ(Request) Queue. If the condition is false, the job is not demanded out. Generally, information about the Demanding job is not stored in CA-7. Sometimes, the &lt;u&gt;LIST=PROSE&lt;/u&gt; option of the LJOB command, may give details about the Demanding job. In the below clipping, my job &lt;u&gt;GEMIATAL&lt;/u&gt; job is demanded out by &lt;u&gt;GMLIASXA&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;            &lt;div style="padding-bottom: 0px; margin: 0px auto; padding-left: 0px; width: 425px; padding-right: 0px; display: block; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:97e21aca-6eb6-423b-aaa5-e7c2ae1ed638" class="wlWriterEditableSmartContent"&gt;&lt;div id="1e06ac04-156f-4d64-9a85-5cd57fb9895d" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=WwVaakaXSHI" target="_new"&gt;&lt;img src="http://lh4.ggpht.com/_sQvdFWqMlMg/TEuM7BRkRkI/AAAAAAAAC94/vvWHE8IsqvY/videod7e2cad23490%5B10%5D.jpg?imgmax=800" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('1e06ac04-156f-4d64-9a85-5cd57fb9895d'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/WwVaakaXSHI&amp;amp;hl=en\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/WwVaakaXSHI&amp;amp;hl=en\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;         &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How long does a job wait in REQ Queue, before it enters RDY Queue?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;A job has to wait in the CA-7 REQ(Request) Queue, until all of the &lt;u&gt;requirements&lt;/u&gt; it has are satisfied. &lt;u&gt;Requirements&lt;/u&gt; are like additional promises, which must be fulfilled, before a job is allowed to run. &lt;u&gt;Requirements&lt;/u&gt; could be anything like, Completion of another job, Arrival(creation) of a file(Dataset), Submit Time, User Hold or a Negative Dependency. Its only when all the &lt;u&gt;Requirements&lt;/u&gt;, of a job are &lt;u&gt;fulfilled&lt;/u&gt; or posted, the job is brought to the &lt;u&gt;Ready Queue(RDY)&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;Check out this example. A Job X triggers Job Y. Job X completes everyday at 08:00 AM. Job Y has 2 requirements – R1 and R2. Job R1 completes at 07:00 AM and Job R2 completes at 09:00 AM. The question is, when does Job Y kick-off? I would say, when Job X completes at 08:00 AM, it triggers Job Y, so it brought to the &lt;u&gt;Request Queue&lt;/u&gt; at 08:00 AM. The requirement R1 of Job Y is satisfied, but it will wait in &lt;u&gt;Request Queue&lt;/u&gt;[REQ], till R2 is satisfied. When R2 completes at 09:00 AM, both the requirements are satisfied, and Job Y will be brought to the &lt;u&gt;Ready Queue&lt;/u&gt;[RDY].&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. What are predecessors and successors of a Job?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;Think of a relay-race with three participants – Arnold, Danny and Carol. The three participants are scheduled to start running, but spaced apart in intervals of 15 minutes each. Arnold is scheduled to start running when the timer is 00:00 hrs. Danny is scheduled to start running when the time is 00:15 Hrs. Carol is scheduled to start running, when the time is 00:30 Hrs.            &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;Requirement of Danny&lt;/u&gt; – Danny is allowed to start running, only after Arnold completes the race, and passes on the baton to him.             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;Dependent Carol&lt;/u&gt; – Danny owes a favour to Carol, he has a commitment towards her. He must complete the race and pass on the baton to her, before she can start off.             &lt;br /&gt;            &lt;br /&gt;Arnold –&amp;gt; Danny –&amp;gt; Carol             &lt;br /&gt;            &lt;br /&gt;Danny’s &lt;u&gt;predecessor&lt;/u&gt; is Arnold. Danny’s &lt;u&gt;successor(dependent)&lt;/u&gt; is Carol.             &lt;br /&gt;            &lt;br /&gt;You can use the &lt;u&gt;LIST=RQMT&lt;/u&gt; option on &lt;u&gt;LJOB&lt;/u&gt; Command, to find out the &lt;u&gt;requirements&lt;/u&gt; or &lt;u&gt;predecessors&lt;/u&gt; of a job. You use the &lt;u&gt;LIST=DEPJ&lt;/u&gt; option on the LJOB Command, to find the &lt;u&gt;successors&lt;/u&gt; of a job.             &lt;br /&gt;            &lt;br /&gt;            &lt;div style="padding-bottom: 0px; margin: 0px auto; padding-left: 0px; width: 425px; padding-right: 0px; display: block; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:b47f4506-bedd-4b79-93bf-f3b0b9601693" class="wlWriterEditableSmartContent"&gt;&lt;div id="56a9959a-cee9-4e86-b503-a665730f7bff" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=8iSabLtEGZM" target="_new"&gt;&lt;img src="http://lh6.ggpht.com/_sQvdFWqMlMg/TEuM8DUufNI/AAAAAAAAC98/Pe0o46e71i0/video48501a8674ef%5B10%5D.jpg?imgmax=800" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('56a9959a-cee9-4e86-b503-a665730f7bff'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/8iSabLtEGZM&amp;amp;hl=en\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/8iSabLtEGZM&amp;amp;hl=en\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;           &lt;font size="3" face="Courier New"&gt;             &lt;br /&gt;In the above video clipping, my job &lt;u&gt;GEMTOPR3&lt;/u&gt; has the &lt;u&gt;requirement&lt;/u&gt;               &lt;br /&gt;(pred job) &lt;u&gt;AXMYTOPV&lt;/u&gt;. When GEMTOPR3 enters into CA-7 REQ(Request) Queue, its gonna wait for the Requirement &lt;u&gt;AXMYTOPV&lt;/u&gt; to be satisfied. Only, when the requirements are met, my job GEMTOPR3 can enter into RDY(Ready) Queue. &lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;Moreover, the jobs &lt;u&gt;GEMCNSTL&lt;/u&gt;, &lt;u&gt;GMCNTODL&lt;/u&gt; and &lt;u&gt;QRPDR3PA&lt;/u&gt; are the successors of &lt;u&gt;GEMTOPR3&lt;/u&gt;. This implies that the jobs GEMCNSTL, GEMCNTODL and QRPDR3PA have my job &lt;u&gt;GEMTOPR3&lt;/u&gt; as a &lt;u&gt;requirement&lt;/u&gt;.&lt;/font&gt;                 &lt;br /&gt;&lt;/font&gt;              &lt;br /&gt;&lt;u&gt;Predecessor&lt;/u&gt; job-names may be preceded by a slash(/) to indicate&amp;#160; &lt;br /&gt;&lt;u&gt;Negative dependency&lt;/u&gt;. A &lt;u&gt;conditional Dependency&lt;/u&gt; is indicated by prefixing the &lt;u&gt;predecessor&lt;/u&gt; job-name with a question-mark(?). If a job A is conditionally dependent on Job B, then Job A will have dependency(requirement) on Job B, only if Job B is in the REQ(Request) Queue, RDY(Ready) Queue or ACT(Active) Queue. The &lt;u&gt;dependency&lt;/u&gt; is conditionally applied, provided the &lt;u&gt;pred-job&lt;/u&gt; is in               &lt;br /&gt;&lt;u&gt;CA-7 Queue&lt;/u&gt;. &lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What is Lead Time? What are Look-back issues?&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;&lt;u&gt;Lead Time&lt;/u&gt; is the &lt;u&gt;period&lt;/u&gt;(in hours)[time-window], that a job looks back in time, to check if all its &lt;u&gt;requirements&lt;/u&gt;(promises) are fulfilled. See the below example. Here, my job &lt;u&gt;GEMPAIAS&lt;/u&gt; has a requirement on &lt;u&gt;PZCPDWKY&lt;/u&gt;, with a &lt;u&gt;Lead Time&lt;/u&gt; of 5 hours.               &lt;br /&gt;              &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;JOB=GEMPAIAS LIST=RQMT&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;NAME ID MEMBER -NAME- -ID -ID- DSNBR DSNBR STP DDS RUNS DATE/TIME &lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;JOB=&lt;font color="#0000ff"&gt;PZCPDWKY&lt;/font&gt;&amp;#160; SCHID=000 VRSN=10176/1131 &lt;font color="#0000ff"&gt;LEADTM=05&lt;/font&gt;                   &lt;br /&gt;&lt;/strong&gt;JOB=/GEMPAIMG SCHID=000 VRSN=98258/0010 LEADTM=99                 &lt;br /&gt;JOB=/GEMCNS6L SCHID=000 VRSN=95334/0012 LEADTM=99                 &lt;br /&gt;                &lt;br /&gt;Suppose, my job &lt;u&gt;GEMPAIAS&lt;/u&gt; is a scheduled job, it is scanned out everyday, and enters the REQ(Request) Queue at 07:00 AM in the mornings. Now, the GEM* Job is going to check for its requirement of Pee-zee(PZ*) job. Has the Pee-Zee(PZ*) Job completed in the last 5 hours? Thus, the GEM* Job searches for its requirement Pee-Zee(PZ*) job’s completion in the time-window of 02:00 AM to 07:00 AM. If the Pee-Zee(PZ*) Job would have completed in the time-frame[02:00-07:00 AM], the requirement is satisfied.                 &lt;br /&gt;                &lt;br /&gt;However, if the Pee-Zee(PZ*) Job completes, say at 00:00 Hrs, this doesn’t fall in the time-window 02:00-07:00 AM, so the requirement shall not be satisfied. The GEM* Job merely keeps waiting in REQ(Request) Queue(even though the PZ* Job ran, but ran at 00:00 Hrs). This is a classic example of a &lt;u&gt;Look-back Issue&lt;/u&gt;.                 &lt;br /&gt;                &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;Very often, there is too large a time-gap that elapses between a predecessor job A's completion, and its dependent B's starting out. When B is brought into the REQ(Request) Queue, if A's completion doesn’t fall in the Look-back(Lead-time) window, B keeps waiting in the REQ Queue. These are called &lt;u&gt;Look-back Issues&lt;/u&gt;. &lt;u&gt;CA-7 Look-back issues&lt;/u&gt; generally happen in the &lt;u&gt;Production Environment&lt;/u&gt;, generally due to delays in Batch Cycle, holidays etc.&lt;/font&gt;               &lt;br /&gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;               &lt;br /&gt;&lt;u&gt;Lead-Time&lt;/u&gt; could take several values.                 &lt;br /&gt;                &lt;br /&gt;00 – No special consideration for the amount of time elapsed, between the pred-job and dependent job's runs.                 &lt;br /&gt;99 – The requirement is never to be considered as already satisfied, when the job enters the Queue.                 &lt;br /&gt;nn – Since, the last run of the job, each predecessor job must have run within the last nn hours. Values for nn may be from 1 to 98.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3"&gt;&lt;strong&gt;&lt;font face="Courier New"&gt;Q. What is a Negative Dependency?&lt;/font&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;Sometimes, you wish - I hope these two jobs don't collide, don't run at the &lt;u&gt;same time&lt;/u&gt;. If a Job P has a Negative Dependency N, Job P and Job N can't run together(mutually exclusive). So there are 2 possibilities -               &lt;br /&gt;              &lt;br /&gt;1. &lt;strong&gt;Job P&lt;/strong&gt; can run, if &lt;strong&gt;Job N&lt;/strong&gt; has &lt;u&gt;not&lt;/u&gt; started.               &lt;br /&gt;2. &lt;strong&gt;Job P&lt;/strong&gt; can run, if &lt;strong&gt;Job N&lt;/strong&gt; has completed.               &lt;br /&gt;              &lt;br /&gt;In the snapshot below, my job &lt;u&gt;GEMTOPR3&lt;/u&gt; has a &lt;u&gt;negative-dependency&lt;/u&gt; on &lt;u&gt;XRPDR3PA&lt;/u&gt;.               &lt;br /&gt;              &lt;br /&gt;&lt;strong&gt;GEMTOPR3&lt;/strong&gt; 000 GEMTOPR3 GEMIDB&amp;#160;&amp;#160; 005 SY2&amp;#160; 007743 *NONE* 002 000 1326 10194/2315&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; --------------------------- SUCCESSOR JOBS ----------------------------&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; JOB=GEMCNSTL SCHID=000&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; JOB=GMCNTODL SCHID=000&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; JOB=QRPDR3PA SCHID=000&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; JOB=/XRPDR3PA SCHID=000&amp;#160;&amp;#160;&amp;#160; (Negative dependency)&lt;/font&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;             &lt;br /&gt;Generally, &lt;u&gt;Negative Dependencies&lt;/u&gt; are used in the Production Environment, to prevent contention problems. Say, for example, if two jobs access the same               &lt;br /&gt;&lt;u&gt;DB2 Table&lt;/u&gt;, it’s a good idea, to have a negative dependency created amongst them.&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What are the advanced CA-7 Commands?&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;You can type CA-7 advanced &lt;u&gt;Forecast commands&lt;/u&gt;, to find out the hierarchy of jobs in the &lt;u&gt;forward order&lt;/u&gt;, or &lt;u&gt;reverse-order&lt;/u&gt;. &lt;u&gt;FSTRUC&lt;/u&gt; Command gives the complete list of triggered jobs, at all levels, top-to-bottom. &lt;u&gt;FRJOB&lt;/u&gt; gives the complete list of triggered jobs, at all levels in the reverse order, bottom-up fashion. Look, how I’ve found the complete hierarchy of jobs triggered by my job &lt;u&gt;GEMCAL00&lt;/u&gt;.&lt;/font&gt;&lt;/p&gt;          &lt;div style="padding-bottom: 0px; margin: 0px auto; padding-left: 0px; width: 425px; padding-right: 0px; display: block; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:2637f980-b493-463a-9421-b1aeac8b414b" class="wlWriterEditableSmartContent"&gt;&lt;div id="54b6cf8b-c102-490e-a13f-a5a96847b8e4" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=F8MpOxpc4Q4" target="_new"&gt;&lt;img src="http://lh4.ggpht.com/_sQvdFWqMlMg/TEuM9JK4-5I/AAAAAAAAC-A/mSZm1TF_ah0/video5ad22904ac05%5B6%5D.jpg?imgmax=800" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('54b6cf8b-c102-490e-a13f-a5a96847b8e4'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/F8MpOxpc4Q4&amp;amp;hl=en\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/F8MpOxpc4Q4&amp;amp;hl=en\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;This is how it works. &lt;u&gt;GEMCAL00&lt;/u&gt; triggers &lt;u&gt;GEMCAPHDR&lt;/u&gt;(Header job). &lt;u&gt;GEMCAPHDR&lt;/u&gt; on the other hand triggers &lt;u&gt;GEMCARAL&lt;/u&gt; and &lt;u&gt;GEMCAR1L&lt;/u&gt;. The AL triggers a complete stream or wave of my jobs – GEMCARBL, which triggers the *CL, triggering *EL and so on. &lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What is Job Monitoring? How to check if a job has completed?&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;When a Mainframe Job completes successfully, it goes to the Log-Area[LRLOG]. The log-area stores tracking-information – the log of the completed job of the past 5 days. The CA-7 &lt;u&gt;LRLOG&lt;/u&gt; Command is used to retrieve from the logs, information about the previous runs of a job. I have scribbled below, how you can code several different options on the LRLOG Paragraph.              &lt;br /&gt;              &lt;br /&gt;&lt;strong&gt;LRLOG,JOB=&lt;/strong&gt;job-name,&lt;strong&gt;DATE=*&lt;/strong&gt;              &lt;br /&gt;Log of the job, for the past 5 days.              &lt;br /&gt;              &lt;br /&gt;&lt;strong&gt;LRLOG,JOB=&lt;/strong&gt;job-name&lt;strong&gt;,DATE=10200               &lt;br /&gt;&lt;/strong&gt;Log of the job, for the run on 2010-07-19(Julian Date 197 day of the year 2010).              &lt;br /&gt;              &lt;br /&gt;When a job abends at a particular step, you may &lt;u&gt;re-start&lt;/u&gt; the job from the next successive step, you may &lt;u&gt;force-complete&lt;/u&gt; the job, or you may &lt;u&gt;cancel&lt;/u&gt; the job. &lt;u&gt;Force completing&lt;/u&gt; a job, force-fully marks the job as complete(even if the job has not run entirely successfully). All triggered down-stream jobs are brought into the CA-7 Queue.              &lt;br /&gt;              &lt;br /&gt;&lt;u&gt;Cancelling&lt;/u&gt; the job off, is like &lt;u&gt;stopping&lt;/u&gt; the job altogether. With this the entire &lt;u&gt;job-cycle&lt;/u&gt; &lt;u&gt;downstream&lt;/u&gt; will be held up/hung.              &lt;br /&gt;&lt;strong&gt;               &lt;br /&gt;LRLOG,ST=RSTR,SPAN=24                &lt;br /&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;This command tells, which jobs abended and were restarted in last 24 hours.             &lt;br /&gt;              &lt;br /&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;LRLOG,ST=FORCE,SPAN=24&lt;/strong&gt;&lt;/font&gt;             &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;This command tells, which jobs abended and were force-completed in last 24 hours.             &lt;br /&gt;              &lt;br /&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;LRLOG,ST=CANCEL,SPAN=24&lt;/strong&gt;&lt;/font&gt;             &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;This command tells, which jobs abended and were cancelled off in last 24 hours.             &lt;br /&gt;              &lt;br /&gt;&lt;strong&gt;LPRRN,JOB=&lt;/strong&gt;job-name              &lt;br /&gt;This command is used find out information about the Last job-run.&lt;/font&gt;&lt;/p&gt;          &lt;div style="padding-bottom: 0px; margin: 0px auto; padding-left: 0px; width: 425px; padding-right: 0px; display: block; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:c9724d6c-1ba5-4e5c-b894-503465960b83" class="wlWriterEditableSmartContent"&gt;&lt;div id="8e6a5db7-a878-416e-822c-61f5ce94a6f9" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=HdlniX0oJm0" target="_new"&gt;&lt;img src="http://lh3.ggpht.com/_sQvdFWqMlMg/TEuM-0ZsT9I/AAAAAAAAC-E/vEcjLfUbgcQ/video1db145d72488%5B3%5D.jpg?imgmax=800" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('8e6a5db7-a878-416e-822c-61f5ce94a6f9'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/HdlniX0oJm0&amp;amp;hl=en\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/HdlniX0oJm0&amp;amp;hl=en\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-3399012700133370553?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Ybr2NW0B-LJdcvWPoVVg9HXgPaY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ybr2NW0B-LJdcvWPoVVg9HXgPaY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Ybr2NW0B-LJdcvWPoVVg9HXgPaY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ybr2NW0B-LJdcvWPoVVg9HXgPaY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/kyvfFC8rX98" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/3399012700133370553?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/3399012700133370553?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/kyvfFC8rX98/ca-7-commands.html" title="CA-7 Commands" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><feedburner:origLink>http://www.mainframes360.com/2010/07/ca-7-commands.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUADRnk4cCp7ImA9WxFbGEw.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-8181841363957751229</id><published>2010-07-11T07:32:00.001+05:30</published><updated>2010-07-11T07:32:57.738+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-11T07:32:57.738+05:30</app:edited><title>COBOL-DB2 Program - Introduction</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="0" width="806"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="804"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. What are DB2 Storage Areas?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="804"&gt;&lt;font size="3" face="Courier New"&gt;When you write COBOL Programs, that read data records from Files, and store Output results to a File, you must declare &lt;u&gt;Input&lt;/u&gt; and &lt;u&gt;Output Storage Areas&lt;/u&gt; for the files in the &lt;u&gt;COBOL Program&lt;/u&gt;.             &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/TDkl2Lt0mnI/AAAAAAAAC7M/HOtgH3-iReA/s1600-h/Image20416.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image204[1]" border="0" alt="Image204[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/TDkl3UYsFZI/AAAAAAAAC7U/no0m2NEyGcE/Image2041_thumb4.png?imgmax=800" width="755" height="714" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;             &lt;br /&gt;COBOL has a strict rule – first Declare, then use. Look at the picture above. Firstly whenever, you access data from Files in COBOL, you need to &lt;u&gt;declare(announce)&lt;/u&gt; the &lt;u&gt;file-names&lt;/u&gt; in COBOL. Moreover, you also declare &lt;u&gt;COBOL Storage Areas&lt;/u&gt; for sending data to and receiving data from files. The &lt;u&gt;Input Storage Area&lt;/u&gt; is the place in the COBOL Program, where the data arrives and get stored, from a File, out here for the INPUT-FILE it is EMPLOYEE-INPUT-RECORD. When you do a READ INPUT-FILE, the input record QUASAR 1000 20-10-06 is read from the file, and received and stored in EMPLOYEE-INPUT-RECORD Storage Area. Similarly, the &lt;u&gt;Output Storage Area&lt;/u&gt; is the place in the COBOL Program, from where the data departs and is output to the File, here for the OUTPUT-FILE it is EMPLOYEE-OUTPUT-RECORD. So, when you do a WRITE EMPLOYEE-OUTPUT-RECORD, whatever’s stored in EMPLOYEE-OUTPUT-RECORD is written to the file.               &lt;br /&gt;              &lt;br /&gt;In the same fashion, when you access data from &lt;u&gt;DB2 Tables&lt;/u&gt; in a &lt;u&gt;COBOL Program&lt;/u&gt;, you need to first &lt;u&gt;DECLARE(announce)&lt;/u&gt; the TABLE in the COBOL Program. Suppose there’s an EMPLOYEE DB2 Table, that you want to access in the COBOL Program. The EMPLOYEE DB2 Table looks like this -               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/TDkl4bF2uLI/AAAAAAAAC7Y/HMFGZ6WlSaU/s1600-h/Image20615.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image206[1]" border="0" alt="Image206[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/TDkl57jgk0I/AAAAAAAAC7c/CChh0m9PNQI/Image2061_thumb3.png?imgmax=800" width="778" height="217" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;Before using EMPLOYEE Table, you must DECLARE the SQL EMPLOYEE TABLE at the top of the COBOL Program in the DATA DIVISION. You can DECLARE EMPLOYEE TABLE as shown in the picture below -               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/TDkl7DxsFGI/AAAAAAAAC7g/DPP09wXu77I/s1600-h/Image20517.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image205[1]" border="0" alt="Image205[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/TDkl8nYCFII/AAAAAAAAC7k/3-6SqWVkGCs/Image2051_thumb5.png?imgmax=800" width="779" height="273" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;The DECLARE EMPLOYEE TABLE in the COBOL Program makes a statement – hey pal, this COBOL Program uses the EMPLOYEE table, which is broken into EMPID, ENAME, SALARY and JDATE SQL-Fields(columns). Since, this is SQL, and not COBOL Statements, you embed them – put them inside a EXEC SQL and END-EXEC Block.                  &lt;br /&gt;                  &lt;br /&gt;When you fetch data from these SQL Fields(columns) into the COBOL, there is should also be corresponding COBOL Variables to receive and hold the fetched data. For every &lt;u&gt;SQL-Field&lt;/u&gt;, you must declare a corresponding &lt;u&gt;COBOL Variable(Storage Area)&lt;/u&gt;.&amp;#160;&amp;#160; &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/TDkl9ilNgxI/AAAAAAAAC7o/yHsPJ-M9N-o/s1600-h/Image21215.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image212[1]" border="0" alt="Image212[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/TDkl_j5E5SI/AAAAAAAAC7s/U2FbgzL6N6A/Image2121_thumb3.png?imgmax=800" width="784" height="356" /&gt;&lt;/a&gt;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;                  &lt;br /&gt;EMPLOYEE-ID is the &lt;u&gt;receiving COBOL Variable&lt;/u&gt; which will hold the values fetched from the SQL Field EMPID. The SQL Type INTEGER(4 Bytes) translates to                   &lt;br /&gt;S9(09) COMP(4 Bytes) in COBOL. EMPLOYEE-NAME is the &lt;u&gt;receiving COBOL Variable&lt;/u&gt;, that shall hold the values fetched from the SQL Field ENAME. The SQL Type CHAR(n) translates in COBOL as PIC X(n), where n is the size. EMPLOYEE-NAME is the &lt;u&gt;receiving COBOL variable&lt;/u&gt; that shall, store the data fetched from SQL Field SALARY. For the SQL Type DECIMAL(7,2), 7 is the total width, 2 is the digits after the decimal point. Therefore, digits before the decimal point would be                   &lt;br /&gt;7-2=5. Thus, in COBOL it translates to PIC 9(05)V99 COMP-3. EMPLOYEE-JDATE is the &lt;u&gt;receiving COBOL Variable&lt;/u&gt;, for the values retrieved from JDATE SQL Field. Generally, DATE in SQL becomes a PIC X(10) in COBOL, TIME is a PIC X(08), and TIMESTAMP is a PIC X(26).                   &lt;br /&gt;                  &lt;br /&gt;Specifying the table-name, SQL Fields and the corresponding COBOL Variables at the top of the COBOL Program is called &lt;u&gt;Declaration&lt;/u&gt;. You can write DB2 Declaration manually, the way I’ve written, or you can &lt;u&gt;auto-generate&lt;/u&gt; it. The tool that auto-generates &lt;u&gt;Declarations&lt;/u&gt;, so that you can avoid the manual labour of writing it at the top of the COBOL Program, is called &lt;u&gt;Declaration Generator Tool(DCLGEN Tool)&lt;/u&gt;. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="807"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How do you use DCLGEN tool, to auto-generate Declarations?&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="807"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;The &lt;u&gt;Declarations Generator(DCLGEN)&lt;/u&gt; tool can be found inside the DB2I(DB2 Interactive) Menu 2.                   &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/TDkmA3YnbvI/AAAAAAAAC7w/l7yB-maTO9A/s1600-h/Image20835.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image208[3]" border="0" alt="Image208[3]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/TDkmCnBXBvI/AAAAAAAAC70/ZsgBrThjP9k/Image2083_thumb3.png?imgmax=800" width="779" height="403" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;                  &lt;br /&gt;I have typed the Table-name EMPLOYEE. I have also keyed in the output file(should be a member of a pds/library), in which the auto-generated DB2 Declarations are stored by the DCLGEN Tool. After hitting ENTER, you should get a message, EXECUTION COMPLETE.                   &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/TDkmDtuhSqI/AAAAAAAAC74/OGQXHet3FPA/s1600-h/Image20915.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image209[1]" border="0" alt="Image209[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/TDkmE1vQ8VI/AAAAAAAAC78/ZZs7QQpR_6k/Image2091_thumb3.png?imgmax=800" width="781" height="192" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;This is how the DB2 Declarations auto-generated in the AGY0157.DEMO.DCLGEN(EMPLOYEE) file look like -                          &lt;br /&gt;                          &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/TDkmGEt_x5I/AAAAAAAAC8A/-0MS8uGzweo/s1600-h/Image21015.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image210[1]" border="0" alt="Image210[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/TDkmHzZPK_I/AAAAAAAAC8E/ioHnUEjB1KU/Image2101_thumb3.png?imgmax=800" width="780" height="354" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="807"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How to use Cursors to retrieve data from DB2 Tables in COBOL?&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="807"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;When you fetch Data from DB2 Tables in COBOL, you cannot directly fetch all the rows from the table in one shot, in one go. Once you execute the query, the results of the Query are fetched from the DB2 Table, and are brought into another &lt;u&gt;temporary&lt;/u&gt;, &lt;u&gt;rough-work&lt;/u&gt; area – called &lt;u&gt;Cursor Area&lt;/u&gt;. The &lt;u&gt;Cursor Area&lt;/u&gt; is like a rough scratch-pad area. A marker(pointer) is set to point to the beginning/1st row in Cursor area. Now, when you fetch the data from the cursor, it reads the data-row, to which the marker(pointer) is currently set. After each FETCH, the marker(pointer) is incremented(set) to the next row. This way you FETCH data from the &lt;u&gt;cursor area&lt;/u&gt;, &lt;u&gt;row-by-row&lt;/u&gt;, until you’ve read all the rows, and reached the end of the Cursor Area.                           &lt;br /&gt;                          &lt;br /&gt;In this fashion in COBOL-DB2 Programs, whenever the result of a SQL Query is multiple-rows, you must use cursors to fetch the data results row-by-row one at a time.                           &lt;br /&gt;                          &lt;br /&gt;There are 4 steps to use a Cursor. First, you must DECLARE the Cursor Query. DECLARE C1 CURSOR merely tells, what query to run. Second, you OPEN the cursor. When you OPEN the cursor, the &lt;u&gt;cursor Query&lt;/u&gt; is executed, and rows are fetched from the DB2 Table into the &lt;u&gt;Cursor Area&lt;/u&gt;. Third, you FETCH data from the Cursor area into the COBOL Program row-by-row, until you reach the End of the Cursor. Fourth and last, you CLOSE the Cursor.                           &lt;br /&gt;                          &lt;br /&gt;Whenever you perform any SQL Operation, like an OPEN cursor, FETCH data from the cursor, or a CLOSE cursor, the &lt;u&gt;DB2 System&lt;/u&gt; returns back a 3-digit status-code to indicate the Success or Failure of the SQL operation. This &lt;u&gt;3-digit status-code&lt;/u&gt; is stored in a &lt;u&gt;Communication Area&lt;/u&gt; &lt;u&gt;shared&lt;/u&gt; between &lt;u&gt;DB2&lt;/u&gt; and your &lt;u&gt;COBOL Program&lt;/u&gt;. This &lt;u&gt;Shared&lt;/u&gt; &lt;u&gt;communication-area&lt;/u&gt; is called &lt;u&gt;SQLCA&lt;/u&gt;. The SQLCA is a 01-level variable(storage-area) in COBOL, that is broken down into two parts – &lt;u&gt;SQLCODE&lt;/u&gt; and &lt;u&gt;SQLSTATE&lt;/u&gt;. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="807"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Could you show me a COBOL Program to read data-rows from a DB2 Table?&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="807"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;First, you need to declare the Cursor Query. DECLARE C1 CURSOR FOR is the statement used to declare a cursor. I am going to declare a cursor, which can retrieve Employee-id, name, salary and joining-date from the Employee-table.                         &lt;br /&gt;                          &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/TDkmIwb2N1I/AAAAAAAAC8I/hNeuuFhhNA0/s1600-h/Image213%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image213[1]" border="0" alt="Image213[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/TDkmKb6d33I/AAAAAAAAC8M/yvYFUKC-V_o/Image213%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="789" height="234" /&gt;&lt;/a&gt;                          &lt;br /&gt;                          &lt;br /&gt;You also need to supply the &lt;u&gt;SQLCA&lt;/u&gt; &lt;u&gt;COBOL Variable&lt;/u&gt;, that shall hold the results of the OPEN, FETCH and CLOSE Cursor operations. You want to be sure, that OPEN, FETCH and CLOSE Cursor operations go clean, without any errors, so you need &lt;u&gt;SQLCA&lt;/u&gt; to check on that. You generally type an INCLUDE SQLCA entry.                          &lt;br /&gt;                          &lt;br /&gt;Now, you begin type executable COBOL Instructions in the PROCEDURE DIVISION. Essentially, the task of fetching data-rows from the DB2 Table can be divided into 3-paragraphs 1. OPENing the Cursor 2. FETCHing data from the Cursor row-by-row and 3. CLOSEing Cursor. I have typed the MAIN Paragraph in the PROCEDURE DIVISION like this -                           &lt;br /&gt;                          &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/TDkmLcPmRFI/AAAAAAAAC8Q/uG98tl3y5EM/s1600-h/Image214%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image214[1]" border="0" alt="Image214[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/TDkmMjerwiI/AAAAAAAAC8U/UaFUiCS5CuE/Image214%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="781" height="176" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;                          &lt;br /&gt;Line 37 performs the Open paragraph, to open the cursor.                           &lt;br /&gt;                          &lt;br /&gt;When you do a &lt;u&gt;FETCH&lt;/u&gt; in SQL, it returns(retrieves) back the row, the cursor is &lt;u&gt;currently pointing&lt;/u&gt; to. Every-time you &lt;u&gt;FETCH&lt;/u&gt;, the &lt;u&gt;current-row&lt;/u&gt; is returned, and the cursor is &lt;u&gt;incremented&lt;/u&gt;(set to the next row). A SQLCODE=+0 signals a successful FETCH. &lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;This sequential row-after-row process of FETCH’ing, continues on and on.&lt;/font&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;But, how do you know, how many rows you want to fetch – 5, 10, 15, how many to be precise. You don’t!                          &lt;br /&gt;                          &lt;br /&gt;The situation where the &lt;u&gt;cursor&lt;/u&gt; points to the &lt;u&gt;Last row&lt;/u&gt;, and there is &lt;u&gt;no more data&lt;/u&gt; to get, is detected using the special SQLCODE=+100. A SQLCODE=+100 is the special, &lt;u&gt;exceptional condition&lt;/u&gt;, where the cursor points to the last row, and there are no more data-rows to FETCH. You should do as many FETCH’s until, you hit SQLCODE=+100.&amp;#160; &lt;br /&gt;                          &lt;br /&gt;Line 38 in the PROCEDURE DIVISION, performs FETCH paragraph to get one row at a time, repeatedly until SQLCODE is set to +100.                          &lt;br /&gt;                          &lt;br /&gt;Line 39 performs the Close, to close the cursor.                          &lt;br /&gt;                          &lt;br /&gt;To Open a Cursor(and execute the Cursor query), in SQL you type OPEN cursor-name. I have coded 100-OPEN Paragraph below, which executes the SQL instruction, OPEN EMP_CSR on Line 44. When you OPEN EMP_CSR, it means                          &lt;br /&gt;                          &lt;br /&gt;SELECT EMPID,ENAME,SALARY,JDATE                          &lt;br /&gt;FROM EMPLOYEE                          &lt;br /&gt;                          &lt;br /&gt;query will run. The results will be stored in a SQL Area – EMP_CSR. The contents pf the Cursor Area EMP_CSR are                           &lt;br /&gt;                          &lt;br /&gt;--&amp;gt; 1&amp;#160;&amp;#160;&amp;#160; RAM&amp;#160;&amp;#160;&amp;#160; 1000&amp;#160;&amp;#160;&amp;#160; 2010-06-09                          &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; 2&amp;#160;&amp;#160;&amp;#160; RAJ&amp;#160;&amp;#160;&amp;#160; 2000&amp;#160;&amp;#160;&amp;#160; 2005-01-03                          &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; 3&amp;#160;&amp;#160;&amp;#160; RAKESH 3000&amp;#160;&amp;#160;&amp;#160; 2005-02-27                          &lt;br /&gt;                          &lt;br /&gt;A marker or a pointer is set to the first row in the Cursor-Area. This pointer position, tells what’s the next row to be read?                          &lt;br /&gt;                          &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/TDkmNvpc8qI/AAAAAAAAC8Y/tz5EQ7fuRj4/s1600-h/Image215%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image215[1]" border="0" alt="Image215[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/TDkmPFU9YoI/AAAAAAAAC8c/MmXXvQNDrLI/Image215%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="790" height="155" /&gt;&lt;/a&gt;                           &lt;br /&gt;                          &lt;br /&gt;To fetch(receive) &lt;u&gt;data-rows&lt;/u&gt; from the &lt;u&gt;SQL Cursor-area&lt;/u&gt; into the &lt;u&gt;COBOL Program&lt;/u&gt;, in SQL you type                          &lt;br /&gt;                           &lt;br /&gt;FETCH cursor-area-name                          &lt;br /&gt;INTO&amp;#160; COBOL-variables                          &lt;br /&gt;                          &lt;br /&gt;The 200-FETCH Paragraph from Lines 48-56 fetches 1 single row from the Cursor Area EMP_CSR. So, this reads the row [1&amp;#160;&amp;#160; RAM&amp;#160;&amp;#160;&amp;#160; 1000&amp;#160;&amp;#160;&amp;#160; 2010-06-09]. But, when this data arrives in the COBOL Program, where is it stored? So you also supply a list of COBOL Variables corresponding to each SQL Data-value received. In the picture below, EMPLOYEE-ID COBOL Variable will receive the value 1, EMPLOYEE-NAME COBOL Variable will receive the value RAM,&amp;#160; EMPLOYEE-SALARY COBOL Variable will receive the value 1000, and EMPLOYEE-JDATE COBOL Variable will receive the value 2010-06-09. FETCH cursor-area-name is a SQL Instruction. When you want to use COBOL Variables(non-SQL Variables) like EMPLOYEE-ID, EMPLOYEE-NAME etc. in a SQL Instruction, you prefix them with a :(Colon). I have DISPLAYed the recently fetched EMPLOYEE-INPUT-RECORD. After the FETCH Operation is completed successfully, the SQLCODE is set to +0. The pointer is incremented and set to the next row in the cursor area.                          &lt;br /&gt;                          &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; 1&amp;#160;&amp;#160;&amp;#160; RAM&amp;#160;&amp;#160;&amp;#160; 1000&amp;#160;&amp;#160;&amp;#160; 2010-06-09                                         &lt;br /&gt;--&amp;gt; 2&amp;#160;&amp;#160;&amp;#160; RAJ&amp;#160;&amp;#160;&amp;#160; 2000&amp;#160;&amp;#160;&amp;#160; 2005-01-03                                          &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; 3&amp;#160;&amp;#160;&amp;#160; RAKESH 3000&amp;#160;&amp;#160;&amp;#160; 2005-02-27&lt;/font&gt;                                         &lt;br /&gt;                                        &lt;br /&gt;The 200-FETCH Paragraph is performed over and over again, till you’ve read the last row, until SQLCODE=+100. The 2nd FETCH will store 2 in EMPLOYEE-ID, RAJ in EMPLOYEE-NAME, 2000 in EMPLOYEE-SALARY and 2005-01-03 in EMPLOYEE-JDATE. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;                          &lt;br /&gt;                          &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/TDkmQXSmcOI/AAAAAAAAC8g/_9iKWoVoy3w/s1600-h/Image216%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image216[1]" border="0" alt="Image216[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/TDkmRfIRiHI/AAAAAAAAC8k/4r3sV03UEr8/Image216%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="789" height="250" /&gt;&lt;/a&gt;                           &lt;br /&gt;                          &lt;br /&gt;After you’re done with retrieving/working with all the data rows in the cursor-area, you must CLOSE the Cursor-area. To close the &lt;u&gt;SQL Cursor-area&lt;/u&gt;, in SQL you type -                          &lt;br /&gt;                          &lt;br /&gt;CLOSE cursor-area-name                          &lt;br /&gt;                          &lt;br /&gt;The 300-CLOSE Paragraph on Lines 59-63 executes the CLOSE EMP_CSR SQL Instruction to close the cursor.                          &lt;br /&gt;                          &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/TDkmSXvNgrI/AAAAAAAAC8o/kVfB6sjr4wA/s1600-h/Image217%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image217[1]" border="0" alt="Image217[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/TDkmTjlSD6I/AAAAAAAAC8s/407m3tTMhl8/Image217%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="787" height="154" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-8181841363957751229?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/5CAQDhw31Imt4FSBa8KMSMRARw8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5CAQDhw31Imt4FSBa8KMSMRARw8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/5CAQDhw31Imt4FSBa8KMSMRARw8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5CAQDhw31Imt4FSBa8KMSMRARw8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/d0ydF0Qh7Ds" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/8181841363957751229?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/8181841363957751229?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/d0ydF0Qh7Ds/cobol-db2-program-introduction.html" title="COBOL-DB2 Program - Introduction" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><feedburner:origLink>http://www.mainframes360.com/2010/07/cobol-db2-program-introduction.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEANSHk4cCp7ImA9WxFUFE0.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-2420531244650677382</id><published>2010-06-24T23:36:00.001+05:30</published><updated>2010-06-24T23:36:39.738+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-24T23:36:39.738+05:30</app:edited><title>Pseudo-conversational Programs and DFHCOMMAREA</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="0" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Is there a trade-off between Conversational and Pseudo-conversational Programs?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;COBOL Programs that run in Online mode on CICS Software could be Conversational or Pseudo-Conversational. How the COBOL Programmer has written and designed the COBOL Program, determines if its &lt;u&gt;Conversational&lt;/u&gt; or &lt;u&gt;Pseudo-conversational&lt;/u&gt;. Conversational Programs are more resource-hungry and costly in terms of Mainframe computer time as opposed to Pseudo-conversational Programs.             &lt;br /&gt;            &lt;br /&gt;Let’s say that you wanna book a Railway-Ticket to Varanasi. When you type the Transaction TBOOK on the Terminal, you get the &lt;u&gt;MAIN MENU Input Screen&lt;/u&gt;. Now, you can either type options 1, 2 or 3 to book, cancel or view your ticket respectively. During the time you decide which option to choose, and stare at the screen, the COBOL Program is still alive, it is only in a Paused or Halted State, it is still living in the CICS region. The COBOL Program keeps on waiting, expecting User Input. The moment, you type Option '1' and hit ENTER, the COBOL Program resumes, receives the Input Data from &lt;u&gt;MAIN MENU Screen&lt;/u&gt;, process the data, and sends the &lt;u&gt;BOOK MENU Output Screen&lt;/u&gt;, and pauses, hits the breaks, and waits for you to type Input. But, it is live and Loaded into CICS Region, it has not stopped running. As the user fills in the Passenger details and train no., in the meanwhile the COBOL Program is still waiting. Once, you’ve filled in your Travel Plan details, and hit ENTER, the COBOL Program resumes, &lt;font size="3" face="Courier New"&gt;receives the Input Data from &lt;u&gt;BOOK MENU Screen&lt;/u&gt;, processes the data, books(reserves)/marks the seat for you in the train compartment, and display the Output &lt;u&gt;CONFIRMATION TICKET Screen&lt;/u&gt; to you.               &lt;br /&gt;              &lt;br /&gt;&lt;/font&gt;The gist of the concept, is that right from when you type TBOOK and invoke the Booking Transaction, till the time you type EXIT(or press PF3 Key on MAIN MENU Screen), the &lt;u&gt;COBOL Program&lt;/u&gt; keeps on running, it is alive and loaded into CICS Region, for the entire &lt;u&gt;Length&lt;/u&gt; of the &lt;u&gt;User Session&lt;/u&gt;. Even when the User is staring at the &lt;u&gt;CICS GUI Screen&lt;/u&gt;, thinking what input to type next, the COBOL Program is still alive and kicking, &lt;u&gt;running&lt;/u&gt;, but waiting for your &lt;u&gt;Input&lt;/u&gt;. The COBOL Program doesn’t get &lt;u&gt;killed&lt;/u&gt;, &lt;u&gt;terminated&lt;/u&gt; till your Interaction(Session) is complete.             &lt;br /&gt;            &lt;br /&gt;This is called a &lt;u&gt;Conversationaal Program&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/TCOehAdlVxI/AAAAAAAAC2U/dKfcHEBhxgQ/s1600-h/Image19216.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image192[1]" border="0" alt="Image192[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/TCOei2ioPxI/AAAAAAAAC2Y/uc4bbfa7h8A/Image1921_thumb4.png?imgmax=800" width="518" height="715" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;During the time-frame, when one &lt;u&gt;CICS Output Screen&lt;/u&gt; is displayed on terminal, and the User is staring at the screen, thinking what Input Data Values to fill up, and then hits ENTER, the COBOL Program is alive and is kept in CICS Memory(Region), waiting for User Input. This sounds good and rosy-rosy, when it’s just a couple of users who want to Book tickets. &lt;u&gt;Conversational Programs&lt;/u&gt; are good, when there’s just &lt;u&gt;one user&lt;/u&gt; who needs &lt;u&gt;service&lt;/u&gt;.               &lt;br /&gt;              &lt;br /&gt;Keeping the COBOL Program loaded into Memory, while the user is looking at the screen deciding what to type -&amp;#160; the COBOL program just sits idle on the CPU, is a sheer wastage of Mainframe Computer Time, especially when there are hundreds and thousands of People around the country who want to book tickets and need to be serviced concurrently. This is where, &lt;u&gt;Pseudo-conversational&lt;/u&gt; Programs come into picture.&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How do Pseudo-conversational Programs work?&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;In Pseudo-Conversational Programs, every time you type Input data on a CICS Screen, and hit ENTER, the COBOL Program starts from the PROCEDURE DIVISION, validates and processes your data, and displays the next Output Screen. After displaying the Output Screen, the COBOL Program gets killed, terminated – doesn’t remain active, it is off-loaded from the CICS Region.              &lt;br /&gt;              &lt;br /&gt;Thus, unlike conversational programs, Pseudo-conversational programs do not remain paused, or keep waiting in the CICS Region, listening for User Input. Instead, when you type Input and hit ENTER(Press any of the Attention Identifier AID Keys), the COBOL Program re-starts all over again from the top at the &lt;u&gt;PROCEDURE DIVISION&lt;/u&gt;. Once the processing is complete, and the Output screen is displayed to you, to COBOL Program stops running and is killed.               &lt;br /&gt;              &lt;br /&gt;Given below is how Pseudo-conversational Programs compare with their Conversational Counterparts.               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/TCOejpuQ7GI/AAAAAAAAC2c/ObjvU4g3flU/s1600-h/Image19516.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Image195[1]" border="0" alt="Image195[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/TCOellpaWpI/AAAAAAAAC2g/UmJKfyx6t6g/Image1951_thumb4.png?imgmax=800" width="505" height="658" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What is DFHCOMMAREA? Why is it a Linkage Section Storage Area?&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;When the user types Input text Data on the &lt;u&gt;CICS GUI Input Screen&lt;/u&gt; – say he presses Option 1 on the &lt;u&gt;MAIN MENU Screen&lt;/u&gt;, and hits ENTER, the COBOL Program starts from the top at the PROCEDURE DIVISION, processes the data, and sends the next CICS Output Screen say &lt;u&gt;BOOK MENU Screen&lt;/u&gt;, and gets killed(terminated). This is called one Invocation of the &lt;u&gt;COBOL Online Program&lt;/u&gt;.              &lt;br /&gt;              &lt;br /&gt;The User stares at the &lt;u&gt;BOOK MENU screen&lt;/u&gt;, decides what Input to type, and then after filling in the passenger details on the &lt;u&gt;BOOK MENU Input Screen&lt;/u&gt;, hits ENTER. The COBOL Online Program restarts all over again from the PROCEDURE DIVISION, processes the Passenger Details and reserves a ticket, and sends the next CICS Output Screen say &lt;u&gt;CONFIRMATION TICKET Screen&lt;/u&gt;, and gets killed. This is the second invocation of the &lt;u&gt;COBOL Online Program&lt;/u&gt;.              &lt;br /&gt;              &lt;br /&gt;Every time, the COBOL Program starts from the PROCEDURE DIVISION, receives data from the Input Screen, processes the data, and sends the next output screen, and finally stops running. The Start-Receive Input-Process-Send Output-Stop cycle keeps repeating till you are done with your task. Each time you type data and hit ENTER, you invoke or run the COBOL Program to process your inputs.              &lt;br /&gt;              &lt;br /&gt;Sometimes, you need to save(remember) data between two successive runs, or invocations of the COBOL Online Program. Such data cannot be stored in Working Storage Areas of the COBOL Program. Working Storage Areas are created when the COBOL Program starts, and deleted when the COBOL Program stops. Working Storage Areas are rough-work areas(scratch-pad) of the COBOL Program, that live only as long as the COBOL Program runs.              &lt;br /&gt;              &lt;br /&gt;The requirement however, is to store(save) data across multiple invocations(runs) of the COBOL Online Program. When you want to store(save) data which is globally accessible across several runs a COBOL Program, you use Linkage Section Storage Areas.              &lt;br /&gt;              &lt;br /&gt;Given below is a simple picture that depicts how Linkage Section Storage areas differ from Working section storage areas. You’ve got a simple Storage Area A containing the value 0. You write a COBOL Program to ADD +1 TO A.              &lt;br /&gt;              &lt;br /&gt;Case 1: If A were to be a Storage Area in the WORKING-STORAGE SECTION.              &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/TCOenJFv-EI/AAAAAAAAC2k/4ZwGSIJpFYk/s1600-h/Image196%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image196[1]" border="0" alt="Image196[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/TCOeohGrz2I/AAAAAAAAC2o/y5LWVGzz8LA/Image196%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="765" height="316" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;Each time the COBOL Program starts WS-A Storage Area is created with value 0, and the COBOL Program adds +1 to WS-A, so WS-A becomes 1. After the COBOL Program stops, WS-A is deleted. So, this doesn’t offer you &lt;u&gt;memory of the past&lt;/u&gt; feature, with working storage areas you don’t remember, what was stored in WS-A previously, the last time the COBOL Program ran.              &lt;br /&gt;              &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;Case 2: If A were to be a Storage Area in the LINKAGE SECTION.&lt;/font&gt;                 &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/TCOepYXhaxI/AAAAAAAAC2s/R7-iFiwBxMA/s1600-h/Image197%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image197[1]" border="0" alt="Image197[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/TCOeq9zKYrI/AAAAAAAAC2w/6_ORdH0IFLM/Image197%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="777" height="304" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;Here WS-A Storage which&amp;#160; is globally accessible and shared across the 1st run, 2nd run and the 3rd run of the COBOL. WS-A is a Linkage section Area, so this Storage area is independent of the COBOL Program. It helps to remember data of the past, pass data from one invocation(run) to the next successive invocation(run).                &lt;br /&gt;                &lt;br /&gt;&lt;u&gt;DFHCOMMAREA&lt;/u&gt; is a Linkage Section Storage Area that helps to store(save) data, pass data around from one invocation(run) to another invocation of a COBOL Online Program in CICS. Thus, Linkage-section storage area &lt;u&gt;DFHCOMMAREA&lt;/u&gt; plays an important role to remember and retain data between two successive invocations. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-2420531244650677382?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vv_iww_BSoLzxiAQCqayXGPzUS8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vv_iww_BSoLzxiAQCqayXGPzUS8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/vv_iww_BSoLzxiAQCqayXGPzUS8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vv_iww_BSoLzxiAQCqayXGPzUS8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/0uM08QI3xnQ" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/2420531244650677382?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/2420531244650677382?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/0uM08QI3xnQ/pseudo-conversational-programs-and.html" title="Pseudo-conversational Programs and DFHCOMMAREA" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><feedburner:origLink>http://www.mainframes360.com/2010/06/pseudo-conversational-programs-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0IERXw4cCp7ImA9WxFVFkw.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-6559378230500374948</id><published>2010-06-15T22:01:00.001+05:30</published><updated>2010-06-15T22:01:44.238+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-15T22:01:44.238+05:30</app:edited><title>Introduction to CICS</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="0" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. I have been wondering, how does Online Mode of Processing work as opposed to Batch Mode?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;COBOL Programs generally process Data in &lt;u&gt;Batch Mode&lt;/u&gt;(Offline Mode). In Batch mode - you must tell all the Inputs, Outputs at the very beginning, right at outset, even before the Program actually starts. On the buzzer, once you hit SUB(Submit) and give your job(task) to the Mainframe Computer for processing, there’s no turning back. The Mainframe Computer processes your data, according to its own convenience. It can take a long time for the program to generate outputs – you don’t have any clue. During this time, there is no interaction between the COBOL Program and the user. &lt;font size="3" face="Courier New"&gt;There is no manual intervention from the time, the COBOL Program begins to run, until it completes. &lt;/font&gt;            &lt;br /&gt;            &lt;br /&gt;Once the COBOL Program completes, it alerts you – notifies you, of the results. In other words, the COBOL Program is run Offline – it wouldn’t provide immediate outputs/results to the Inputs, you supply. So, in Batch mode, don’t expect a COBOL Program to give you &lt;u&gt;immediate&lt;/u&gt; &lt;u&gt;outputs/results&lt;/u&gt; to your &lt;u&gt;Inputs&lt;/u&gt;, on the spur of the moment, on the go.&amp;#160; &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/TBeq1XfUKwI/AAAAAAAAC0w/N5dXTIEfsBM/s1600-h/Image18814.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image188[1]" border="0" alt="Image188[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/TBeq2cciVxI/AAAAAAAAC00/hMdhKPyQMbU/Image1881_thumb2.png?imgmax=800" width="433" height="112" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;Contrast this, with running a COBOL Program in &lt;u&gt;Online Mode&lt;/u&gt;. In &lt;u&gt;Online&lt;/u&gt;(Interactive) &lt;u&gt;mode&lt;/u&gt;, you give some input, the COBOL Program processes your Data Input, produces some output, then you type some more input, that the COBOL Program processes and you get some more output. This Input, Process, Output cycle continues, until you arrive at the final solution. In Online mode, the Program give immediate(quick) response or output, to the Inputs you supply, on the go, on the spur of the moment. You don’t have to wait too long in &lt;u&gt;Online&lt;/u&gt;, unlike &lt;u&gt;Batch Mode&lt;/u&gt;(Offline).             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/TBeq3bmdOkI/AAAAAAAAC04/R-8fj5Xuc1M/s1600-h/Image18926.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Image189[2]" border="0" alt="Image189[2]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/TBeq5ESV17I/AAAAAAAAC08/09d6xr6UVwo/Image1892_thumb4.png?imgmax=800" width="292" height="701" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Can you run a COBOL Program in an Online, Interactive Manner on a Mainframe Computer? What is CICS Software?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;u&gt;CICS Software&lt;/u&gt; can be used to run COBOL Programs in an Online Interactive manner, on a Mainframe Computer. &lt;u&gt;CICS&lt;/u&gt; stands for &lt;u&gt;Customer Information Control System&lt;/u&gt;. &lt;u&gt;CICS Software&lt;/u&gt; is a giant, robust &lt;u&gt;Transaction Server&lt;/u&gt;. Let’s think about Flight Reservations. Zillions of people around the globe, who want to travel send their requests for Booking Tickets. It is &lt;u&gt;CICS Software&lt;/u&gt; that handles, manages these requests, passes them on, and gets them processed using the correct COBOL Program, immediately, on-the-fly, and sends the Output Response back to the &lt;u&gt;Client&lt;/u&gt;. &lt;u&gt;CICS Software&lt;/u&gt; is robust server, that can humungous volumes, huge loads of Transactions at a time. &lt;u&gt;IMS-DC&lt;/u&gt; and &lt;u&gt;TPF&lt;/u&gt; are examples of some other Transaction Monitors on IBM Mainframes.            &lt;br /&gt;            &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;u&gt;Role of CICS Software&lt;/u&gt; : Bear in mind, that when you run a COBOL Program in online-mode, it runs under the supervision of &lt;u&gt;CICS Software&lt;/u&gt;. So, a COBOL Program in &lt;u&gt;Online Mode&lt;/u&gt;, directly doesn’t run on its own, stand-alone. It is the &lt;u&gt;CICS Software&lt;/u&gt; that handles all the activities on behalf of the COBOL Program.&lt;/font&gt;&lt;/font&gt;            &lt;br /&gt;&amp;#160; &lt;br /&gt;&lt;u&gt;Where does the COBOL Program come into picture&lt;/u&gt; : The entire &lt;u&gt;Data Processing Logic&lt;/u&gt;(Business Rules) is written in the COBOL Program. &lt;u&gt;CICS Server&lt;/u&gt; is just an intermediary, which delegates and passes on requests of folks to the &lt;u&gt;COBOL Program&lt;/u&gt; for Processing. The actual data-processing is done by the &lt;u&gt;COBOL Program&lt;/u&gt;. &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. What are Transactions? How do you run COBOL Programs in CICS? What are CICS Tables?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;In Windows, you double-click a Program, to start it in the &lt;u&gt;Online-Mode&lt;/u&gt;. However, in CICS, a user cannot directly start a Program. Instead, you define a &lt;u&gt;Transaction&lt;/u&gt;, which in turn will run the &lt;u&gt;COBOL Program&lt;/u&gt; in Online Mode. Every transaction has a &lt;u&gt;4-byte&lt;/u&gt; Unique identification number called &lt;u&gt;Transaction ID&lt;/u&gt;. You wanna to run &lt;u&gt;COBOL Programs&lt;/u&gt; in &lt;u&gt;Online mode&lt;/u&gt; on CICS, &lt;u&gt;transactions&lt;/u&gt; are the &lt;u&gt;way&lt;/u&gt;.            &lt;br /&gt;            &lt;br /&gt;How do you run a COBOL Program on CICS? On a &lt;u&gt;CICS Terminal&lt;/u&gt;(like a Web-browser), when you type the &lt;u&gt;Transaction-ID&lt;/u&gt;, and hit ENTER, the COBOL Program is loaded, immediately started in the online-mode. This is called &lt;u&gt;invoking&lt;/u&gt; the Transaction. &lt;font size="3" face="Courier New"&gt;For example, if the COBOL-online Program is &lt;u&gt;BOOKTKT&lt;/u&gt;, and the Transaction-ID is &lt;u&gt;TBOOK&lt;/u&gt;, when you type &lt;u&gt;TBOOK&lt;/u&gt;, and hit ENTER, &lt;u&gt;CICS Software&lt;/u&gt; will find the the COBOL Program &lt;u&gt;BOOKTKT&lt;/u&gt; on the Disk, and Load into the &lt;u&gt;CICS Region&lt;/u&gt; and execute it in Online Mode.&lt;/font&gt; Similar to TSO, CICS Software serves many users simultaneously. CICS is a very robust Transaction Monitor (keeps listening for transactions) – it can handle trillions of transactions at a time.            &lt;br /&gt;            &lt;br /&gt;When you invoke a transaction, by typing say &lt;u&gt;TBOOK&lt;/u&gt;, it starts a COBOL Program like &lt;u&gt;BOOKTKT&lt;/u&gt;. But how does the CICS Software, which COBOL Program to start for the transaction &lt;u&gt;TBOOK&lt;/u&gt;? Moreover, the CICS Software also needs to know the place(location) to look for your COBOL Program. What is the PDS, Folder or library on the Disk in which the COBOL Load Module &lt;u&gt;BOOKTKT&lt;/u&gt; resides, so that CICS Software can pick up the Load, and start running it. Now, all this extra-information is stored in &lt;u&gt;CICS Tables&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;The important CICS Tables are :             &lt;br /&gt;PCT – For Transactions             &lt;br /&gt;PPT – For COBOL Programs             &lt;br /&gt;FCT – For Files             &lt;br /&gt;RCT – For DB2 Connections             &lt;br /&gt;            &lt;br /&gt;When you type the Transaction ID – TBOOK, on the Terminal, the CICS Software will look-up the Transaction in the PCT.             &lt;br /&gt;            &lt;br /&gt;            &lt;table border="1" cellspacing="0" cellpadding="0" width="400"&gt;&lt;tbody&gt;               &lt;tr bgcolor="#808080"&gt;                 &lt;td valign="top" width="200"&gt;&lt;strong&gt;Transaction&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="200"&gt;&lt;strong&gt;Program&lt;/strong&gt;&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="200"&gt;&lt;strong&gt;TBOOK&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="200"&gt;BOOKTKT&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="200"&gt;TABC &lt;/td&gt;                  &lt;td valign="top" width="200"&gt;PROGR01&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="200"&gt;TDEF&lt;/td&gt;                  &lt;td valign="top" width="200"&gt;PROG02&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="200"&gt;...&lt;/td&gt;                  &lt;td valign="top" width="200"&gt;...&lt;/td&gt;               &lt;/tr&gt;             &lt;/tbody&gt;&lt;/table&gt;         &lt;/font&gt;&lt;font size="3" face="Courier New"&gt;           &lt;br /&gt;&lt;u&gt;PCT Table&lt;/u&gt;(Program Control Table) tells the COBOL-CICS Program for any Transaction.             &lt;br /&gt;            &lt;br /&gt;            &lt;table border="1" cellspacing="0" cellpadding="0" width="517"&gt;&lt;tbody&gt;               &lt;tr bgcolor="#808080"&gt;                 &lt;td valign="top" width="200"&gt;&lt;strong&gt;Program&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="315"&gt;&lt;strong&gt;Load Pointer&lt;/strong&gt;&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="200"&gt;BUA21&lt;/td&gt;                  &lt;td valign="top" width="315"&gt;AGY0157.CICS.LOADS&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="200"&gt;BUA22&lt;/td&gt;                  &lt;td valign="top" width="315"&gt;AGY0157.CICS.LOADS&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="200"&gt;&lt;strong&gt;BOOKTKT&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="315"&gt;AGY0157.DEMO.CICS.LOADLIB&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="200"&gt;BUA23&lt;/td&gt;                  &lt;td valign="top" width="315"&gt;AGY0157.DEMO.CICS.LOADLIB&lt;/td&gt;               &lt;/tr&gt;             &lt;/tbody&gt;&lt;/table&gt;         &lt;/font&gt;          &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;u&gt;PPT Table&lt;/u&gt;(Process Program Table) tells the location(Load Library) from which the COBOL Program(Load) must be picked up, and loaded into the CICS Region.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. How do you add entries/remove entries from PCT and PPT, for your Transaction and COBOL Program?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;Just as you can write your own custom Transactions(Online COBOL Programs), IBM supplies some &lt;u&gt;ready-made&lt;/u&gt;, &lt;u&gt;pre-written&lt;/u&gt; transactions for doing some common day-to-day tasks. For example, you can use the Ready-made transaction &lt;u&gt;CEDA&lt;/u&gt;, to add your Transaction’s entry into the CICS PCT Table. Such &lt;u&gt;ready-made&lt;/u&gt; transactions supplied to you by IBM for doing routine tasks are called &lt;u&gt;Utility Transactions&lt;/u&gt;.            &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;CEDA&lt;/u&gt; – CEDA is the ready-made Utility Transaction, to &lt;u&gt;DEFINE&lt;/u&gt;(add) new entries in the &lt;u&gt;CICS Tables&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;CEMT&lt;/u&gt; – CEMT is the ready-made Utility Transaction, to &lt;u&gt;ENQUIRE&lt;/u&gt;(Search), or query the entries(rows) in &lt;u&gt;CICS Tables&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;A second more important use of &lt;u&gt;CEMT&lt;/u&gt; is to refresh the &lt;u&gt;Load Pointer&lt;/u&gt;. Whenever you make changes(modifications) to a CICS Transaction(COBOL Online Program), you also need to &lt;u&gt;reset(refresh)&lt;/u&gt; the &lt;u&gt;Pointer&lt;/u&gt; in &lt;u&gt;PCT Table&lt;/u&gt;, disconnect it from the Old Load, and point it to the new Load Module.            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/TBeq52XRiaI/AAAAAAAAC1A/ZmweS34f4Zk/s1600-h/Image190%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Image190[1]" border="0" alt="Image190[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/TBeq7edZIRI/AAAAAAAAC1E/8AZZJlIHYZY/Image190%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="340" height="143" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;CECI&lt;/u&gt; – CECI is the ready-made Transaction, that stands for &lt;u&gt;CICS Command Level Interpreter&lt;/u&gt;. Essentially, when you want to execute(run) and test some &lt;u&gt;CICS Instructions&lt;/u&gt;, outside a COBOL Program(without writing a complete COBOL Program), you can use CECI ready-made transaction. For example, after designing CICS GUI Screens, when you want to test them, display the screens and see how they look, you would use the ready-made transaction CECI.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-6559378230500374948?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/LHxeTAudTAPcj1eEMw55xxSmt6o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LHxeTAudTAPcj1eEMw55xxSmt6o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/LHxeTAudTAPcj1eEMw55xxSmt6o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LHxeTAudTAPcj1eEMw55xxSmt6o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/3ARGv04pYyk" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/6559378230500374948?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/6559378230500374948?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/3ARGv04pYyk/introduction-to-cics.html" title="Introduction to CICS" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><feedburner:origLink>http://www.mainframes360.com/2010/06/introduction-to-cics.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D08CRnw9fyp7ImA9WxFTEkU.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-5432262961916920668</id><published>2010-04-03T14:39:00.000+05:30</published><updated>2010-04-03T14:41:07.267+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-03T14:41:07.267+05:30</app:edited><title>KSDS Files – Random Processing – Updating records in a VSAM File</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What are the COBOL Instructions for randomly updating a KSDS File?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;The &lt;u&gt;REWRITE&lt;/u&gt; statement in COBOL is used to change the records in a KSDS File. You have to merely supply new values for the record-fields, and the record in the KSDS file gets updated. How does the &lt;u&gt;REWRITE&lt;/u&gt; statement achieve this magnificent feat?             &lt;br /&gt;            &lt;br /&gt;The ingredients that make up a &lt;u&gt;RE-WRITE&lt;/u&gt; statement are (i) &lt;u&gt;RE&lt;/u&gt;ad followed by (ii)&lt;u&gt;WRITE&lt;/u&gt;. When a REWRITE statement is executed, what happens is this. Initially, it &lt;u&gt;RE&lt;/u&gt;ads the record(you intend to modify) from the file into a temporary scratch-pad area or rough-work area. You specify the record you intend to modify, by mentioning its key-value. The modifications(new values) that you supply, are applied to the record that’s brought into the scratch-pad area. The old-values are wiped out(erased off), and the new values take their place. It finally &lt;u&gt;WRITE&lt;/u&gt;s the updated record back to the file.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Is there any structured approach, or systematic procedure that can be followed to update records in a KSDS File?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;Let's say, you want to update this KSDS File, containing a list of Employee details. The Employee record has following layout -            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S7cFw1r3MRI/AAAAAAAACxU/JIEAgMqgnuU/s1600-h/Image17815.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image178[1]" border="0" alt="Image178[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S7cFyKfc9-I/AAAAAAAACxY/DSkGMtNVZ48/Image1781_thumb3.png?imgmax=800" width="770" height="315" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;Here’s the contents of the EMPLOYEE-KSDS-MASTER file, that I intend to update currently -             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S7cFzTAh9rI/AAAAAAAACxc/DHWqfSzXpEg/s1600-h/Image17916.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image179[1]" border="0" alt="Image179[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S7cF0h1UmmI/AAAAAAAACxg/9iJanVQKu8k/Image1791_thumb4.png?imgmax=800" width="775" height="287" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;Its great to follow a general procedure to update(change) the logical records in a KSDS File.&amp;#160; &lt;br /&gt;            &lt;br /&gt;1. First of all, you tell VSAM, what’s the record you want to modify. You &lt;u&gt;MOVE&lt;/u&gt; the key of the record to be changed in RECORD KEY field. So, let’s say I want to update the details of QUASAR, bearing Employee ID=70. Just do a,             &lt;br /&gt;&lt;u&gt;MOVE&lt;/u&gt; 70 TO EMP-ID.             &lt;br /&gt;            &lt;br /&gt;2. Next, supply the new values for the rest of the fields - EMP-NAME, EMP-AGE, EMP-SALARY, and EMP-JDATE. Assume that, I want the age to be 25, salary to 26000 and date-of-joining to be 20081208. So, I should be &lt;u&gt;MOVE&lt;/u&gt;'ing these new values to the corresponding fields in the EMPLOYEE-KSDS-RECORD record area.             &lt;br /&gt;&lt;u&gt;MOVE&lt;/u&gt; 'QUASAR' TO EMP-NAME             &lt;br /&gt;&lt;u&gt;MOVE&lt;/u&gt; 25 TO EMP-AGE             &lt;br /&gt;&lt;u&gt;MOVE&lt;/u&gt; 2600000 TO EMP-SALARY             &lt;br /&gt;&lt;u&gt;MOVE&lt;/u&gt; 20081208 TO EMP-JDATE             &lt;br /&gt;            &lt;br /&gt;3. Essentially, we have now prepared, constructed the record that we want to update. What remains is, to overlay this brand-new record on top of the old-one in the file. To REWRITE the employee-record in the KSDS File, we             &lt;br /&gt;&lt;u&gt;REWRITE&lt;/u&gt; EMPLOYEE-KSDS-RECORD.             &lt;br /&gt;            &lt;br /&gt;The reader should understand, at the face of it, this step looks pretty simple. However, the elements that constitute REWRITE'ing operation are (i) &lt;u&gt;RE&lt;/u&gt;ading the old-record from the file into the temp. scratch-pad area (ii) applying the modifications and changes mentioned in the COBOL Program (iii) &lt;u&gt;WRITE&lt;/u&gt;ing the updated record back to the file.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Could you list a COBOL Program for randomly updating the records in KSDS File?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;I have written a COBOL Program that reads the records to be updated(transactions) from a Transactions-file, and updates them in KSDS Master file. These are the transactions or records that I want to update.            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S7cF1vMW9qI/AAAAAAAACxk/VDHw5xKqUv8/s1600-h/Image18015.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image180[1]" border="0" alt="Image180[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S7cF3DaKmDI/AAAAAAAACxo/mnSr2eeUsA4/Image1801_thumb3.png?imgmax=800" width="776" height="194" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;The Random Update COBOL Program uses flags and switch variables, to detect exceptional conditions.             &lt;br /&gt;            &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;Any input-output operation on KSDS Files – leaves behind a signature – a two digit code – that indicates the result of the operation. The variable FILE-STATUS-CODES is used to store(hold) the result of File Operations. It is defined as follows :&lt;/font&gt;             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S7cF4NSCiEI/AAAAAAAACxs/2ZyAIPX07uA/s1600-h/Image18215.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image182[1]" border="0" alt="Image182[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S7cF5cxedbI/AAAAAAAACxw/V_LVYXXfN2w/Image1821_thumb3.png?imgmax=800" width="776" height="210" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;A status code 0, indicates that the file operation was successful, and the VSAM-FILE-OPERATION-SUCCESS flag is set to TRUE. A non-zero status code, represents an error, and the VSAM-FILE-OPERATION-FAILED flag is set to TRUE.&lt;/font&gt;             &lt;br /&gt;            &lt;br /&gt;Moreover, when reading records from a file sequentially, I use a flag variable to indicate – denote the End-of-file condition(all the records have been read). The END-OF-FILE-SWITCH variable is defined as follows :             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S7cF66f1vII/AAAAAAAACx4/JnnC2-3I8es/s1600-h/Image18315.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image183[1]" border="0" alt="Image183[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S7cF8GZYKnI/AAAAAAAACx8/uybM14ZOLuU/Image1831_thumb3.png?imgmax=800" width="777" height="136" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;The task of updating records in a KSDS File, has been broken down into 3 parts – &lt;u&gt;B100-OPEN-FILES&lt;/u&gt; paragraph, &lt;u&gt;C100-PROCESS&lt;/u&gt; paragraph and &lt;u&gt;D100-CLOSE-FILES&lt;/u&gt; paragraph.&amp;#160; &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S7cF9HlXNpI/AAAAAAAACyA/-sHLXqPpoFo/s1600-h/Image18115.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image181[1]" border="0" alt="Image181[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S7cF-1_vsYI/AAAAAAAACyE/-qs9ts1cZNU/Image1811_thumb3.png?imgmax=800" width="779" height="289" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;On Line 70, &lt;u&gt;B100-OPEN-FILES&lt;/u&gt; paragraph opens the files for processing. The             &lt;br /&gt;&lt;u&gt;VSAM-FILE-OPERATION-SUCCESS&lt;/u&gt; flag is tested, to check if File &lt;u&gt;OPEN&lt;/u&gt; operation was successful. If the OPEN operation succeeded, you proceed to process the files, and then close the files. If the OPEN operation failed, the control is transferred to the ELSE block, and a message 'ERROR WHILE READING FROM VSAM FILE' along with the two-digit status code is DISPLAYed – that’ll tell the exact cause(Reason) behind the error.             &lt;br /&gt;            &lt;br /&gt;Next, we have the &lt;u&gt;B100-OPEN-FILES&lt;/u&gt; paragraph.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S7cF_0EliaI/AAAAAAAACyI/2rkod4v2q6c/s1600-h/Image184%5B1%5D%5B6%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image184[1]" border="0" alt="Image184[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S7cGB9iyTmI/AAAAAAAACyM/23UN3wmz4Zo/Image184%5B1%5D_thumb%5B4%5D.png?imgmax=800" width="786" height="118" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;You &lt;u&gt;OPEN&lt;/u&gt; the &lt;u&gt;EMPLOYEE-KSDS-MASTER&lt;/u&gt; file for I-O, for updating records. You open the &lt;u&gt;EMPLOYEE-TRANSACTION-FILE&lt;/u&gt; for reading &lt;u&gt;INPUT&lt;/u&gt; transaction records sequentially, one-by-one.            &lt;br /&gt;            &lt;br /&gt;The &lt;u&gt;C100-PROCESS&lt;/u&gt; paragraph reads a transaction record from the             &lt;br /&gt;&lt;u&gt;EMPLOYEE-TRANSACTION-FILE&lt;/u&gt;. The &lt;u&gt;WS-INPUT-TRANSACTIONS-CNT&lt;/u&gt; is a counter that keeps track of the no. of transactions that have been read, so far. Each time a record is read, the count increases by 1.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S7cGCykDTfI/AAAAAAAACyU/13w291h6bak/s1600-h/Image185%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image185[1]" border="0" alt="Image185[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S7cGED_KmxI/AAAAAAAACyY/a7dNT0xwD7A/Image185%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="783" height="229" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;We are going to use the EMPLOYEE-KSDS-RECORD area to hold, the new, modified record. Lines 94-95 &lt;u&gt;MOVE&lt;/u&gt; the data from the &lt;u&gt;transaction-record&lt;/u&gt;, to the EMPLOYEE-KSDS-RECORD area, field-by-field. Once the move is complete, the EMPLOYEE-KSDS-RECORD constructed, represents the new record.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S7cGFUMvzNI/AAAAAAAACyc/8pe5QDOK0YQ/s1600-h/Image186%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image186[1]" border="0" alt="Image186[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S7cGHLXdzVI/AAAAAAAACyg/qZ602MjqmBY/Image186%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="786" height="249" /&gt;&lt;/a&gt;            &lt;br /&gt;            &lt;br /&gt;Line 96 REWRITEs(overlays) the new EMPLOYEE-KSDS-RECORD just constructed, on top of the old record in KSDS Master file. But what if, the record you intend to update, is not found in the master-file. This &lt;u&gt;error-condition&lt;/u&gt; when it occurs, can be detected using &lt;u&gt;INVALID KEY&lt;/u&gt; clause on Line 97. Lines 98-99 DISPLAY(print) a message for logging purposes – saying the record was not found. On Line 101, the &lt;u&gt;NOT INVALID KEY&lt;/u&gt; represents the condition, when the &lt;u&gt;REWRITE&lt;/u&gt; operation is successful. The counter &lt;u&gt;WS-RECS-UPDATED-CNT&lt;/u&gt; is used to keep track of the no. of records updated in the Master-file. This process of reading a record from a transaction file, and updating it in the master file, repeated several times again and again, until you have reached the end of the transactions file – all the transactions have been read.            &lt;br /&gt;            &lt;br /&gt;The D100-CLOSE-FILE paragraph closes the EMPLOYEE-KSDS-MASTER file and the EMPLOYEE-TRANSACTION-FILE.            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S7cGI39pvGI/AAAAAAAACyk/RTo-obazk3k/s1600-h/Image187%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image187[1]" border="0" alt="Image187[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S7cGKFfylZI/AAAAAAAACyo/KGsMpxFmRVc/Image187%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="796" height="136" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-5432262961916920668?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Q3ViZEo6CIddPnKHsm2Cx-FqFrk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Q3ViZEo6CIddPnKHsm2Cx-FqFrk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Q3ViZEo6CIddPnKHsm2Cx-FqFrk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Q3ViZEo6CIddPnKHsm2Cx-FqFrk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/4xsmvfrtZJU" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5432262961916920668?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5432262961916920668?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/4xsmvfrtZJU/ksds-files-random-processing-updating.html" title="KSDS Files – Random Processing – Updating records in a VSAM File" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><feedburner:origLink>http://www.mainframes360.com/2010/04/ksds-files-random-processing-updating.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkMDR34-cCp7ImA9WxBaEUQ.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-2546249092894662913</id><published>2010-03-22T00:37:00.000+05:30</published><updated>2010-03-22T00:37:56.058+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-22T00:37:56.058+05:30</app:edited><title>KSDS Files – Random Processing – Adding records to VSAM File</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. Adding records to a file, sequentially or randomly, what’s the difference?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;KSDS Files can be updated &lt;u&gt;sequentially&lt;/u&gt; as well as &lt;u&gt;Randomly&lt;/u&gt;. How does             &lt;br /&gt;&lt;u&gt;Random addition&lt;/u&gt; of records to a file, score over &lt;u&gt;sequential addition&lt;/u&gt; of records?            &lt;br /&gt;            &lt;br /&gt;In Sequential Addition(&lt;u&gt;ACCESS MODE&lt;/u&gt; IS &lt;u&gt;SEQUENTIAL&lt;/u&gt;), new records get added to the &lt;u&gt;tail-end&lt;/u&gt; of the &lt;u&gt;KSDS File&lt;/u&gt;. A file contains 3 employees – 10,20,30. You add a new employee record 40, the file becomes 10,20,30,40. You want to add employee-id 35. Not possible as you’ve been working in Sequential mode.             &lt;br /&gt;            &lt;br /&gt;Ever played a game of Playing Cards? There are Spades, Hearts, Diamonds, and Clubs. When you pick a queen of Diamonds, you first find the suit – in this case Diamonds, to which the card should be added, and then insert it into the right slot. Like putting cards into the right suit, &lt;font size="3" face="Courier New"&gt;in random access(&lt;u&gt;ACCESS MODE&lt;/u&gt; IS &lt;u&gt;RANDOM&lt;/u&gt;), new records can be inserted, interspersed into the file. Random mode finds right-slot for each record. &lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. What are the COBOL instructions for adding records to KSDS Files?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;The Employee-records stored in a KSDS File, have the following record layout -            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S6Zm6l6tZDI/AAAAAAAACt8/xIl0aysBVHY/s1600-h/Image17014.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image170[1]" border="0" alt="Image170[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S6Zm-H5nODI/AAAAAAAACuA/u48vnoGueUI/Image1701_thumb2.png?imgmax=800" width="774" height="316" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;COBOL Program can add(insert) new &lt;u&gt;logical records&lt;/u&gt; to a &lt;u&gt;KSDS File&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;(i) You &lt;u&gt;MOVE&lt;/u&gt; the key of the record that you want to add, to the &lt;u&gt;RECORD KEY&lt;/u&gt; field(employee-id) in the 01-level record-descriptor. For example, if you want to add the employee (45,’RAHUL’,35,4000,’23-12-2005’), you place the key 45 in the key-field &lt;u&gt;EMP-ID&lt;/u&gt;.&amp;#160; &lt;br /&gt;            &lt;br /&gt;(ii) Next, fill in the rest of the fields in the record. So, put ‘RAHUL’ in EMP-NAME, 35 in EMP-AGE, 4000 goes into EMP-SALARY and ‘23-12-2005’ goes into EMP-JDATE.             &lt;br /&gt;            &lt;br /&gt;(iii) The COBOL &lt;u&gt;WRITE&lt;/u&gt; verb is used to add the record to the file.             &lt;br /&gt;            &lt;br /&gt;In response to the&amp;#160; COBOL &lt;u&gt;WRITE&lt;/u&gt; instruction, VSAM performs a full-index search - to find the target &lt;u&gt;Control Interval(CI)&lt;/u&gt; where the record should go. Once the &lt;u&gt;Control Interval(CI)&lt;/u&gt; is located, the record is placed in the free-space available, while re-arranging the other records as necessary. Recollect, that the records in a &lt;u&gt;Control-Interval&lt;/u&gt; are always sorted in &lt;u&gt;key-sequence&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;The format of the COBOL &lt;u&gt;WRITE&lt;/u&gt; statement is -             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;WRITE&lt;/u&gt; record-name             &lt;br /&gt;&lt;u&gt;KEY&lt;/u&gt; IS name-of-key-field             &lt;br /&gt;&lt;u&gt;INVALID KEY              &lt;br /&gt;&lt;/u&gt;&amp;#160;&amp;#160; what-to-do-if-duplicate-field             &lt;br /&gt;&lt;u&gt;NOT INVALID KEY&lt;/u&gt;             &lt;br /&gt;&amp;#160;&amp;#160; what-to-do-if-insert-is-successful             &lt;br /&gt;            &lt;br /&gt;The &lt;u&gt;WRITE&lt;/u&gt; statement includes the record-name(Record to be added). The &lt;u&gt;INVALID KEY&lt;/u&gt; clause serves as &lt;u&gt;red-signal&lt;/u&gt;, an indicator that things went wrong while adding the record. Generally, the &lt;u&gt;INVALID KEY&lt;/u&gt; condition occurs, when you try to &lt;u&gt;WRITE&lt;/u&gt; a duplicate record into a file. Like you try to add an Employee 100, who’s already there in the file. VSAM won’t allow you to over-write it, and throws back an error. You can trap(catch) this exceptional condition, error by &lt;u&gt;INVALID KEY&lt;/u&gt;. &lt;u&gt;NOT INVALID KEY&lt;/u&gt; represents the condition, if the record is successfully added to the file. You would use &lt;u&gt;NOT INVALID KEY&lt;/u&gt; condition for &lt;u&gt;record-keeping&lt;/u&gt;(printing messages) in the logs, it’ll run only if the record is successfully inserted into the file.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. Could you show me a simple COBOL Program to add records to a VSAM File?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;I have a KSDS File, containing a list of Employees. The contents of the KSDS File AGY0157.EMPLOYEE.KSDS are shown below -            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S6Zm_ukzszI/AAAAAAAACuE/cUy1ntKTdQE/s1600-h/Image16415.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image164[1]" border="0" alt="Image164[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S6ZnCg291gI/AAAAAAAACuI/0mUxmXQ7qdI/Image1641_thumb3.png?imgmax=800" width="779" height="198" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;I want to add the following records to the Employees KSDS File -             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S6ZnEvcbWaI/AAAAAAAACuM/S1dlQVio1cY/s1600-h/Image17117.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image171[1]" border="0" alt="Image171[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S6ZnHsurOsI/AAAAAAAACuQ/agsDETz4YFg/Image1711_thumb5.png?imgmax=800" width="780" height="202" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;The flag-variables to detect &lt;u&gt;end-of-file&lt;/u&gt; condition, and &lt;u&gt;error-condition&lt;/u&gt; are shown below.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S6ZnJZ3smrI/AAAAAAAACuU/l5ikr4Q_OD4/s1600-h/Image17315.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image173[1]" border="0" alt="Image173[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S6ZnMwDLyCI/AAAAAAAACuY/02YZH5SUJnU/Image1731_thumb3.png?imgmax=800" width="778" height="292" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;All I/O operations(OPEN,READ,WRITE,CLOSE) on the Employees KSDS File, leave behind a 2-digit Status Code(a trail), indicating the results of the Operation(Success/failed). FILE-STATUS-CODES variable stores the I/O Status Code.             &lt;br /&gt;            &lt;br /&gt;VSAM-FILE-OPERATION-SUCCESS condition represents '00' status code - indicating I/O Operation is Successful. VSAM-FILE-OPERATION-FAILED condition represent non-zero I/O status code – indicating I/O Error.             &lt;br /&gt;            &lt;br /&gt;For record-keeping purposes             &lt;br /&gt;            &lt;br /&gt;The starting point of the Program with the &lt;u&gt;PROCEDURE DIVISION&lt;/u&gt;. We shall break up the task of adding records to Employee KSDS File into 3 paragraphs – OPEN-FILE, PROCESS and CLOSE-FILE.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S6ZnPWtpiKI/AAAAAAAACuc/NbDtPdAQexY/s1600-h/Image17215.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image172[1]" border="0" alt="Image172[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S6ZnRhwHuWI/AAAAAAAACug/my2xKB8gbmw/Image1721_thumb3.png?imgmax=800" width="780" height="296" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;Line 69 opens the Employee KSDS File for adding records. The VSAM-FILE-OPERATION-SUCESS 88-level condition checks status of the &lt;u&gt;OPEN&lt;/u&gt; operation. If the file was &lt;u&gt;OPEN&lt;/u&gt;ed successfully, the VSAM-FILE-OPERATION-SUCCESS switch is turned on(TRUE).             &lt;br /&gt;            &lt;br /&gt;Lines 70-71 transfer the control to C100-PROCESS and D100-CLOSE-FILE para, to process the files and close them.             &lt;br /&gt;            &lt;br /&gt;If the &lt;u&gt;OPEN&lt;/u&gt; operation fails, you &lt;u&gt;DISPLAY&lt;/u&gt; a message 'ERROR OPENING VSAM FILE', and file-status-code is printed.             &lt;br /&gt;            &lt;br /&gt;Let’s go to B100-OPEN-FILE paragraph.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S6ZnSw5EWWI/AAAAAAAACuk/GLlJTtJT1Ww/s1600-h/Image174%5B1%5D%5B6%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image174[1]" border="0" alt="Image174[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S6ZnUXynXRI/AAAAAAAACuo/CPnUIcCO1Z0/Image174%5B1%5D_thumb%5B4%5D.png?imgmax=800" width="782" height="141" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;I shall read records from the &lt;u&gt;EMPLOYEE-TRANSACTION-FILE&lt;/u&gt;&lt;/font&gt; and add them randomly to the &lt;u&gt;EMPLOYEE-KSDS-MASTER&lt;/u&gt; file. As I am reading the records from             &lt;br /&gt;&lt;u&gt;EMPLOYEE-TRANSACTION-FILE&lt;/u&gt;, I open it for &lt;u&gt;INPUT&lt;/u&gt;. For making changes, I &lt;u&gt;OPEN&lt;/u&gt; the &lt;u&gt;EMPLOYEE-KSDS-MASTER&lt;/u&gt; file for &lt;u&gt;I-O&lt;/u&gt;.            &lt;br /&gt;            &lt;br /&gt;Immediately following the &lt;u&gt;B100-OPEN-FILE&lt;/u&gt;, the MAIN-PARA performs             &lt;br /&gt;&lt;u&gt;C100-PROCESS&lt;/u&gt;. This paragraph is reads 1 record from the Input transactions file and writes it to the Output Employee KSDS File. If there are 5 transactions to be added, this &lt;u&gt;C100-PROCESS&lt;/u&gt; must be repeated 5 times. In other words, we iterate through &lt;u&gt;C100-PROCESS&lt;/u&gt; for all the transactions one-by-one, in a cyclic way, till we reach the end of the transactions.             &lt;br /&gt;            &lt;br /&gt;The &lt;u&gt;C100-PROCESS&lt;/u&gt; paragraph looks like this -            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S6ZnWjwM88I/AAAAAAAACus/upQnnCUkew0/s1600-h/Image176%5B1%5D%5B8%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image176[1]" border="0" alt="Image176[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S6ZnZQyA4II/AAAAAAAACuw/XPvN2AH20I4/Image176%5B1%5D_thumb%5B6%5D.png?imgmax=800" width="782" height="378" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;Lines 86-90 &lt;u&gt;READ&lt;/u&gt; a record from the &lt;u&gt;EMPLOYEE-TRANSACTION-FILE&lt;/u&gt;. The &lt;u&gt;READ&lt;/u&gt; block contains an AT END indicator. This condition becomes true when the all transactions from Input Transaction file have been read. At this point, you turn the &lt;u&gt;AT-END&lt;/u&gt; switch on, so that the cyclic process of             &lt;br /&gt;PERFORM’ing &lt;u&gt;C100-PROCESS&lt;/u&gt; comes to a halt.             &lt;br /&gt;            &lt;br /&gt;Every-time you read a record, you increment the counter &lt;u&gt;WS-INPUT-REC-CNT&lt;/u&gt; by 1. This kinda keeps track of, how many records you read off the input-file. This is shown in Line 91. Having done this for logging purposes, Line 92 copies the Input-file’s record &lt;u&gt;EMPLOYEE-TRANSACTION-RECORD&lt;/u&gt; to the output-file’s record area &lt;u&gt;EMPLOYEE-KSDS-RECORD&lt;/u&gt;.            &lt;br /&gt;            &lt;br /&gt;Lines 93-99 write the &lt;u&gt;EMPLOYEE-KSDS-RECORD&lt;/u&gt; to the Ouput Employee KSDS File. The &lt;u&gt;INVALID KEY&lt;/u&gt; condition represents a &lt;u&gt;duplicate record found&lt;/u&gt; error. The &lt;u&gt;NOT INVALID KEY&lt;/u&gt; condition is true, when the employee-record is successfully written to the Output Employee KSDS file. Line 97 increments the counter             &lt;br /&gt;&lt;u&gt;WS-INSERT-RECS-CNT&lt;/u&gt; by 1. This counter on the other hand, keeps track of the no. of records inserted successfully. All the records should get inserted.            &lt;br /&gt;            &lt;br /&gt;The &lt;u&gt;D100-CLOSE-FILE&lt;/u&gt; closes the files, and releases them. We also print the counts of the records read &lt;u&gt;WS-INPUT-RECS-CNT&lt;/u&gt; and the records inserted into the Employee KSDS File &lt;font size="3" face="Courier New"&gt;&lt;u&gt;WS-INSERT-RECS-CNT&lt;/u&gt;&lt;/font&gt; to the log, for error-tracking or bug-fixing purposes.            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S6ZnbbYtuvI/AAAAAAAACu0/FYNFe4r4fpM/s1600-h/Image177%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image177[1]" border="0" alt="Image177[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S6ZneNvS3zI/AAAAAAAACu4/sLD8bzuCEE8/Image177%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="778" height="376" /&gt;&lt;/a&gt;&amp;#160;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-2546249092894662913?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/H0A8cilQi3x3US_LzWfEtmNk9kw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/H0A8cilQi3x3US_LzWfEtmNk9kw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/H0A8cilQi3x3US_LzWfEtmNk9kw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/H0A8cilQi3x3US_LzWfEtmNk9kw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/iUBU6PoU6YQ" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/2546249092894662913?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/2546249092894662913?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/iUBU6PoU6YQ/ksds-files-random-processing-adding.html" title="KSDS Files – Random Processing – Adding records to VSAM File" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><feedburner:origLink>http://www.mainframes360.com/2010/03/ksds-files-random-processing-adding.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cNRXwyeyp7ImA9WxBbF0Q.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-4739417954846395972</id><published>2010-03-16T13:31:00.001+05:30</published><updated>2010-03-17T09:41:34.293+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-17T09:41:34.293+05:30</app:edited><title>KSDS Files – Random Processing – Retrieving Records</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What are the Environment Division considerations for random processing of KSDS File?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;When you want to do random processing of the records in a KSDS File, the COBOL SELECT statement has the following syntax :            &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;SELECT&lt;/u&gt; filename             &lt;br /&gt;&amp;#160;&amp;#160; &lt;u&gt;ASSIGN&lt;/u&gt; TO ddname             &lt;br /&gt;&amp;#160;&amp;#160; &lt;u&gt;ORGANIZATION&lt;/u&gt; IS &lt;u&gt;INDEXED              &lt;br /&gt;&lt;/u&gt;&amp;#160;&amp;#160; &lt;u&gt;ACCESS MODE&lt;/u&gt; IS &lt;u&gt;RANDOM              &lt;br /&gt;&lt;/u&gt;&amp;#160;&amp;#160; &lt;u&gt;RECORD KEY&lt;/u&gt; IS name-of-key-field-in-record             &lt;br /&gt;&amp;#160;&amp;#160; &lt;u&gt;FILE STATUS&lt;/u&gt; IS file-status-area             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S586HgEpfKI/AAAAAAAACqs/hWG8eC9NbJ8/s1600-h/Image163%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image163[1]" border="0" alt="Image163[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S586JsfwweI/AAAAAAAACqw/Y0mxSqZ_CQs/Image163%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="776" height="236" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;The Key field that is used to uniquely identify each employee is the Employee Identification no. – &lt;u&gt;EMP-ID&lt;/u&gt; field.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How Random retrieval of KSDS Files works?&lt;/strong&gt;&amp;#160;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;For the sake of example, let’s assume that we have a KSDS File containing Employee records. The contents of the KSDS file are -            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S586LH9JbNI/AAAAAAAACq0/iwCyPk3eqfA/s1600-h/Image164%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image164[1]" border="0" alt="Image164[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S586SMXBelI/AAAAAAAACq4/q6corKtVJUw/Image164%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="776" height="198" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;The record-layout for the Employees KSDS file is as shown below -             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S586TrVZdAI/AAAAAAAACq8/47ttoORIGFU/s1600-h/Image165%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image165[1]" border="0" alt="Image165[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S586VXZMaAI/AAAAAAAACrA/5QBRYArnX3w/Image165%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="779" height="276" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;For random retrieval of records, you just spell out the key-value(Employee identification no.) of the employee you wanna find, to VSAM and in a jiffy, VSAM fetches the Employee details for you. Now, let’s look at what happens in the background.             &lt;br /&gt;            &lt;br /&gt;The key value(employee-id) of the Employee record, you want to fetch is first placed in the key-field area(EMP-ID). Let’s assume you want to retrieve the details – name, age, salary and joining date of the Employee No. 70.             &lt;br /&gt;            &lt;br /&gt;VSAM compares the &lt;u&gt;RECORD KEY&lt;/u&gt; value(Employee-id) specified in the program, to the entries in the root &lt;u&gt;index set record&lt;/u&gt;. The first entry in the root index record &amp;gt;= RECORD KEY value, is used to point to the next lower level index set record. The entries in this index record is then compared to the RECORD KEY. Again the first entry &amp;gt;= RECORD KEY value is found, and points to a next lower level index set record.             &lt;br /&gt;            &lt;br /&gt;This search process continues downward through the index levels, until an index entry points to a sequence set record. The first sequence set entry which is greater than or equal to the (RECORD KEY)Employee No. 70, points to the &lt;u&gt;Control Interval(CI)&lt;/u&gt; in the KSDS Data file. This &lt;u&gt;Control Interval(CI)&lt;/u&gt; must hold the record(if it is in the file). The CI is now retrieved and searched for the desired logical record. &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What are the PROCEDURE DIVISION statements for random retrieval of records in KSDS file.&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;You are going to write a COBOL Program to search the details of Employee No. 70 in the Employee KSDS File. The COBOL Program can be broken down into three paragraphs – open, fetch, close.            &lt;br /&gt;            &lt;br /&gt;The &lt;u&gt;1000-MAIN-PARA&lt;/u&gt; performs 3 steps -             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S586W_HKf5I/AAAAAAAACrE/vAQOgsaatJw/s1600-h/Image166%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image166[1]" border="0" alt="Image166[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S586YjcZk-I/AAAAAAAACrI/-1AZ-IXrP00/Image166%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="770" height="276" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;Line 51 performs 2000-OPEN-FILE-PARA, which would open the KSDS File for reading the records.             &lt;br /&gt;            &lt;br /&gt;Lines 52-55 are executed, only if the Open operation on the KSDS File is successful. If the Open operation fails, a message stating ERROR OPENING VSAM FILE is displayed, and the error code is printed to the log.             &lt;br /&gt;            &lt;br /&gt;If the OPEN operation is successful, you go ahead and fetch the logical-record you want, and then close the files, once you are done.             &lt;br /&gt;            &lt;br /&gt;The &lt;u&gt;2000-OPEN-FILE&lt;/u&gt; paragraph OPENs the EMPLOYEE-KSDS-FILE containing Employee records in INPUT mode. The INPUT mode is used to read the records from a file. It also OPENs the OUTPUT-FILE in OUTPUT mode. The OUTPUT-FILE points to the log(print output) of the job, and we shall print the details of the Employee we want, to the OUTPUT-FILE.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S586aKeETsI/AAAAAAAACrM/Y1HbZVy5B7U/s1600-h/Image167%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image167[1]" border="0" alt="Image167[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S586mGLNRXI/AAAAAAAACrQ/EaqMERJoCDk/Image167%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="781" height="163" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;The &lt;u&gt;3000-FETCH-RECORD&lt;/u&gt; paragraph will retrieve(search) the details of Employee-ID 70.             &lt;br /&gt;            &lt;br /&gt;We begin by placing the key value(employee-id) of the employee, we would like to search in the &lt;u&gt;RECORD KEY&lt;/u&gt; field – &lt;u&gt;EMP-ID&lt;/u&gt;. Lines 68 places the value '070' in the Key-field &lt;u&gt;EMP-ID&lt;/u&gt;.&amp;#160; &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S586nfxtG7I/AAAAAAAACrU/XR1GFuWZf6o/s1600-h/Image168%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image168[1]" border="0" alt="Image168[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S586uQdqARI/AAAAAAAACrY/-WfP9M_wrwk/Image168%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="777" height="314" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;On Line 69, the COBOL READ Statement, causes VSAM to perform a random search on the EMPLOYEE-KSDS-FILE for the record with EMP-ID 70. If the search returns positive results - Employee record with EMP-ID=70 is found, the             &lt;br /&gt;&lt;u&gt;NOT INVALID KEY&lt;/u&gt; clause is executed, and a message ‘RECORD FOUND’ is printed to the log. If the search is a failure – there is no Employee record in the KSDS File with EMP-ID=70, the &lt;u&gt;INVALID KEY&lt;/u&gt; clause is executed, and a message ‘RECORD NOT FOUND’ is printed to the log.             &lt;br /&gt;            &lt;br /&gt;We then store the data present in the &lt;u&gt;EMPLOYEE-KSDS-RECORD&lt;/u&gt; area into             &lt;br /&gt;&lt;u&gt;OUTPUT-RECORD&lt;/u&gt; area. Line 77 write the &lt;u&gt;OUTPUT-RECORD&lt;/u&gt;, details of the Employee no. 70 to the &lt;u&gt;OUTPUT-FILE&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;The &lt;u&gt;4000-CLOSE-PARA&lt;/u&gt; closes the files, and releases them.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S586vnL0uUI/AAAAAAAACrc/LoJtOe7lcts/s1600-h/Image169%5B1%5D%5B10%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image169[1]" border="0" alt="Image169[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S586w6NooTI/AAAAAAAACrg/B1gisfoJuWo/Image169%5B1%5D_thumb%5B6%5D.png?imgmax=800" width="778" height="162" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-4739417954846395972?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rr3svYrBu2ctiyJYKmjoD1qYLis/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rr3svYrBu2ctiyJYKmjoD1qYLis/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rr3svYrBu2ctiyJYKmjoD1qYLis/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rr3svYrBu2ctiyJYKmjoD1qYLis/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/NQaSyEGss64" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/4739417954846395972?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/4739417954846395972?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/NQaSyEGss64/ksds-files-random-processing.html" title="KSDS Files – Random Processing – Retrieving Records" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><feedburner:origLink>http://www.mainframes360.com/2010/03/ksds-files-random-processing.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUEFRH87eSp7ImA9WxBUGU0.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-5085778971014777682</id><published>2010-03-07T00:56:00.001+05:30</published><updated>2010-03-07T00:56:55.101+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-07T00:56:55.101+05:30</app:edited><title>KSDS Files – Sequential Processing</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. What are the ENVIRONMENT DIVISION considerations for sequential processing of KSDS File?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;The &lt;u&gt;SELECT statement&lt;/u&gt; in COBOL assigns a Symbolic-name(second name), to the actual TSO-file. So, I could use the symbolic file-name &lt;u&gt;OUTPUT-FILE&lt;/u&gt; in COBOL, to refer to my file AGY0157.EMPLOYEE.KSDS.             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;SELECT&lt;/u&gt; Statement describes the file - (i) what’s the file-layout, the &lt;u&gt;organization&lt;/u&gt; (ii) and the &lt;u&gt;mode of processing&lt;/u&gt;(how are you going to process it).             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;File organization&lt;/u&gt; - Is the file &lt;u&gt;sequential&lt;/u&gt; or does it also have an index, is it &lt;u&gt;indexed&lt;/u&gt;. You also want to tell, how the records should be processed in a file – do you traverse the records one-by-one sequentially, and process the file from start-to-end, till you find the desired record – that’s &lt;u&gt;sequential processing&lt;/u&gt;. On the other hand, you can directly jump(hop) or fly over-to the desired record(that’s a lot quicker) and process it – that’s &lt;u&gt;random processing&lt;/u&gt;. For &lt;u&gt;sequential processing&lt;/u&gt; of records, you must set the ACCESS MODE to Sequential.             &lt;br /&gt;            &lt;br /&gt;The &lt;u&gt;SELECT&lt;/u&gt; statement highlights the &lt;u&gt;RECORD KEY&lt;/u&gt;. The value in &lt;u&gt;record key&lt;/u&gt; field provides a unique identification for each record in the file. &lt;u&gt;Every record&lt;/u&gt; will have a &lt;u&gt;unique value&lt;/u&gt; in record key field. For example, in the Employees KSDS File, the &lt;u&gt;record key&lt;/u&gt; is EMP-ID. This is because, every employee has a unique EMP-ID. No two employees have same &lt;u&gt;EMP-ID&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;First up, in the picture below, see what the &lt;u&gt;SELECT statement&lt;/u&gt; for KSDS file has -&amp;#160; &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S5KsLqPi_RI/AAAAAAAACoY/gwFME5DIQcQ/s1600-h/Image158%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image158[1]" border="0" alt="Image158[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S5KsNdEdFSI/AAAAAAAACoc/hNNdmC8alD0/Image158%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="782" height="235" /&gt;&lt;/a&gt;&amp;#160;&amp;#160; &lt;br /&gt;            &lt;br /&gt;Now, the File descriptor and record-layout(the various fields in Employee record) for the Employees KSDS file is shown in the picture :             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S5KsOk3m-9I/AAAAAAAACog/Xx73PaXxXfw/s1600-h/Image157%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image157[1]" border="0" alt="Image157[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S5KsQkxiAxI/AAAAAAAACok/dlq6ZhrNTxg/Image157%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="777" height="321" /&gt;&lt;/a&gt;&amp;#160;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. How do you perform initial loading of records in KSDS file?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;When you create an empty KSDS file, you want to store some meaningful data in the file. Storing records, or populating an empty KSDS file with records is called &lt;u&gt;Initial Load&lt;/u&gt;. You write records out one-by-one sequentially to the KSDS file. Thus, for the Initial load, the access mode is set to &lt;u&gt;Sequential&lt;/u&gt;. During &lt;u&gt;Initial Load&lt;/u&gt;, the records must be loaded in increasing(ascending) sequence of the &lt;u&gt;RECORD KEY&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;We are going to load records sequentially in the Employee KSDS File. To begin with, here are the Working storage section variables -             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S5KsSP91p3I/AAAAAAAACoo/nkfGU5y1it0/s1600-h/Image159%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image159[1]" border="0" alt="Image159[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S5KsULwu0XI/AAAAAAAACos/Ik_13iE0lyc/Image159%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="780" height="283" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;Lines 42-44 define the END-OF-INPUT-FILE flag variable. This variable behaves like a switch, initially it is in NOT-AT-END state. When you have read all the records in the file, it flips over to AT-END state.             &lt;br /&gt;            &lt;br /&gt;Lines 46-48 define the &lt;u&gt;STATUS CODE&lt;/u&gt; area for the KSDS File. Whenever you perform a VSAM operation, like opening the file, writing to the file, or closing the file, it leaves behind a &lt;u&gt;2-digit code number&lt;/u&gt;. 00 indicates a successful operation and non-zero code indicates failure.             &lt;br /&gt;            &lt;br /&gt;Make it a habit to use &lt;u&gt;File Status codes&lt;/u&gt; because, trapping errors, and nipping them in the bud, helps your program to recover from the dangerous run-time errors, which could crash your program and leave your files or database in an inconsistent state.             &lt;br /&gt;            &lt;br /&gt;Lines 50-51 define the counter variable which keeps track of the number of input records processed.             &lt;br /&gt;            &lt;br /&gt;The procedure for sequentially loading a KSDS file, is as follows             &lt;br /&gt;1. &lt;u&gt;OPEN&lt;/u&gt; &lt;u&gt;OUTPUT&lt;/u&gt; filename             &lt;br /&gt;2. &lt;u&gt;WRITE&lt;/u&gt; record-name             &lt;br /&gt;&amp;#160;&amp;#160; &lt;u&gt;FROM&lt;/u&gt; data-area             &lt;br /&gt;&amp;#160;&amp;#160; &lt;u&gt;INVALID&lt;/u&gt; KEY what to do             &lt;br /&gt;3. CLOSE filename             &lt;br /&gt;            &lt;br /&gt;The &lt;u&gt;WRITE&lt;/u&gt; statement in COBOL is used to write a record to a KSDS file. When you initially load a KSDS file, the &lt;u&gt;RECORD KEY&lt;/u&gt; must be increasing(ascending) order. What happens when this condition is not met? The WRITE is aborted, and a STATUS CODE is set. The &lt;u&gt;INVALID KEY&lt;/u&gt; clause is executed, when the WRITE operation fails. Thus, key-violation is automatically detected by the &lt;u&gt;INVALID KEY&lt;/u&gt; clause. Thus, &lt;u&gt;INVALID KEY&lt;/u&gt; Routine can be used to trap duplicate key, or out-of-sequence record errors.&amp;#160; &lt;br /&gt;            &lt;br /&gt;The picture below shows the PROCEDURE DIVISION statements -             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S5KsVntHehI/AAAAAAAACow/QrjDDZdZLPo/s1600-h/Image160%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image160[1]" border="0" alt="Image160[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S5KsYN0XE_I/AAAAAAAACo0/BZDNGpDA_QQ/Image160%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="789" height="309" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;Line 55 performs the OPEN-FILE routine, which opens the KSDS file.             &lt;br /&gt;            &lt;br /&gt;The conditional IF block(Lines 56-63) tests the value of FILE-STATUS-CODES variable. If the Open operation leaves behind a STATUS CODE 00(VSAM-FILE-OPERATION-OK), a loop is generated to load the records in the KSDS file and then close it. If a non-zero status code is left behind&lt;font size="3" face="Courier New"&gt;(ELSE block)&lt;/font&gt;, you print a message to the log which says 'Unable to open indexed file'.             &lt;br /&gt;            &lt;br /&gt;Lines 66-69 is the OPEN-FILE routine. EMPLOYEE-KSDS-FILE is opened for output on line 68.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S5KsZtYyDtI/AAAAAAAACo4/w5u4et30YAg/s1600-h/Image161%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image161[1]" border="0" alt="Image161[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S5KscBDHrHI/AAAAAAAACo8/wv3qXKo6p5s/Image161%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="792" height="396" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;Lines 71-81 is the load a record into the Employees file. Line 72 reads a record from the input data. The record is placed in the INPUT-RECORD area. Once the record has been read, the counter WS-EMLOYEE-CNT is incremented. The WRITE statement in line 77 attempts to add this record to the file. WRITE automatically sequence checks the records on the RECORD KEY field. If WRITE operation fails, it is because of duplicate key, or out-of-sequence error. A message is DISPLAYed on line 80.             &lt;br /&gt;            &lt;br /&gt;Here, I have just assumed that the WRITE operation fails because of key-violation. However, this may not always be the case(e.g. if the file fills up and no more space is available, or hardware I/O error). Ideally speaking, the STATUS CODE must be tested to differentiate between possible errors.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S5KsddVdOgI/AAAAAAAACpA/UFggkUZZ_LI/s1600-h/Image162%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image162[1]" border="0" alt="Image162[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S5KsfYc6jRI/AAAAAAAACpE/MfQUeTveGxI/Image162%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="792" height="261" /&gt;&lt;/a&gt;             &lt;br /&gt;Lines 83-92 CLOSE the KSDS file, after the loading is complete. The CLOSE operation leaves behind a STATUS CODE. If the CLOSE is successful, a message is DISPLAYed 'VSAM FILE CREATION COMPLETED'. The number of records processed are also displayed. If the CLOSE fails, the message 'VSAM FILE NOT PROPERLY CLOSED'.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-5085778971014777682?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/x7LX7kcknC8SkEKfZUTMuyFsYQE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/x7LX7kcknC8SkEKfZUTMuyFsYQE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/x7LX7kcknC8SkEKfZUTMuyFsYQE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/x7LX7kcknC8SkEKfZUTMuyFsYQE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/8tKZmsc5qJ8" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5085778971014777682?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5085778971014777682?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/8tKZmsc5qJ8/ksds-files-sequential-processing.html" title="KSDS Files – Sequential Processing" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><feedburner:origLink>http://www.mainframes360.com/2010/03/ksds-files-sequential-processing.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUICQ3o8eCp7ImA9WxFUFkw.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-2221310017867988507</id><published>2010-03-01T02:14:00.000+05:30</published><updated>2010-06-27T10:09:22.470+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-27T10:09:22.470+05:30</app:edited><title>CICS Tutorials</title><content type="html">&lt;br /&gt;  &lt;table border="2" cellspacing="0" cellpadding="0" width="679"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="544"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Tutorial Link&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;        &lt;td bgcolor="#808080" valign="top" width="131"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Downloads&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="544"&gt;&lt;font color="#666666"&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;&lt;font color="#000000"&gt;&lt;a href="http://www.mainframes360.com/2010/06/introduction-to-cics.html" target="_blank"&gt;Introduction to CICS&lt;/a&gt;&lt;/font&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;        &lt;td bgcolor="#ffffff" valign="top" width="131"&gt;&lt;font size="3" face="Courier New"&gt;Word,PDF&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="544"&gt;&lt;font size="3" face="Courier New"&gt;&lt;a href="http://www.mainframes360.com/2010/06/pseudo-conversational-programs-and.html" target="_blank"&gt;Pseudo-conversational Programs and DFHCOMMAREA&lt;/a&gt;&lt;font size="3" face="Courier New"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;        &lt;td bgcolor="#ffffff" valign="top" width="131"&gt;&lt;font size="3" face="Courier New"&gt;Word,PDF&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="544"&gt;&lt;font size="3" face="Courier New"&gt;Constructing&lt;/font&gt;&lt;font size="3" face="Courier New"&gt; CICS GUI Screens&lt;/font&gt;&lt;/td&gt;        &lt;td bgcolor="#ffffff" valign="top" width="131"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="544"&gt;&lt;font size="3" face="Courier New"&gt;Writing, compiling and preparing CICS Transaction in COBOL&lt;/font&gt;&lt;/td&gt;        &lt;td bgcolor="#ffffff" valign="top" width="131"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="544"&gt;&lt;font size="3" face="Courier New"&gt;Transfer of Control – RETURN, XCTL, LINK, CALL, START and ABEND&lt;/font&gt;&lt;/td&gt;        &lt;td bgcolor="#ffffff" valign="top" width="131"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="544"&gt;&lt;font size="3" face="Courier New"&gt;Saving data between transactions – DFHCOMMAREA, Temporary Storage Queues(TSQ) and &lt;/font&gt;&lt;/td&gt;        &lt;td bgcolor="#ffffff" valign="top" width="131"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-2221310017867988507?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3W-ayD7Qy7sa3DgGeu9M2RDdSs4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3W-ayD7Qy7sa3DgGeu9M2RDdSs4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3W-ayD7Qy7sa3DgGeu9M2RDdSs4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3W-ayD7Qy7sa3DgGeu9M2RDdSs4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/ueY4HFzm6mY" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/2221310017867988507?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/2221310017867988507?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/ueY4HFzm6mY/cics-tutorials.html" title="CICS Tutorials" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><feedburner:origLink>http://www.mainframes360.com/2010/03/cics-tutorials.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUMFRX49eip7ImA9WxBUEEU.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-8449589426510099191</id><published>2010-02-25T13:03:00.000+05:30</published><updated>2010-02-25T13:06:54.062+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-25T13:06:54.062+05:30</app:edited><title>IDCAMS – LISTCAT Command</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;b&gt;&lt;font size="3" face="Courier New"&gt;Q. What is a Catalog? What is meant by cataloging or un-cataloging a file?&lt;/font&gt;&lt;/b&gt; &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;Data on computers is stored in Files. The files are generally scattered everywhere haphazardly in Computer Memory. Well, let's say you want to see, or read the file in which you stored your Birthday photographs. The file containing the birthday photographs could be placed anywhere in the Computer Memory. How do you know, the location of your file(where is it) in this vast galaxy of Computer Memory space? It’s like finding a needle in a haystack.&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;The MVS Operating System keeps a diary/register, which contains name of each file, and its location in the computer memory. This diary/register is like your map around the Mainframe's memory land. You want to find a file, just see the MVS operating system’s diary, and it will tell you the location of your file.&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;This diary or map, which you consult to find a file on a Mainframe computer, is called &lt;u&gt;Catalog&lt;/u&gt;. The &lt;u&gt;Catalog&lt;/u&gt; contains entries for each file, a file-name and a pointer to the physical memory location, where the file is present.&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;Not all the files present on a Mainframe may have an entry in the &lt;u&gt;Catalog&lt;/u&gt;. If a given file’s entry is not present in the &lt;u&gt;Catalog&lt;/u&gt;, you will have to find the file manually, by explicitly specifying the UNIT and VOLUME parameters on the DD Statements. Adding an entry for a file i.e. File name and its location to &lt;u&gt;Catalog&lt;/u&gt;, is called &lt;u&gt;cataloging a file&lt;/u&gt;. Deleting the entry of a file, from the Catalog is called &lt;u&gt;uncataloging the file&lt;/u&gt;. &lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;Actually, the &lt;u&gt;Catalog&lt;/u&gt; itself is a VSAM File. So, you can use the ready-made IBM Supplied program &lt;u&gt;IDCAMS&lt;/u&gt; to read the contents of the Catalog.&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;b&gt;&lt;font size="3" face="Courier New"&gt;Q. What is the LISTCAT command in IDCAMS?&lt;/font&gt;&lt;/b&gt; &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;u&gt;LISTCAT&lt;/u&gt; command stands for &lt;u&gt;List Catalog&lt;/u&gt;. It is the control-instruction or order to IDCAMS, to display the contents of the &lt;u&gt;Catalog&lt;/u&gt;. &lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;&lt;u&gt;LISTCAT&lt;/u&gt; command of &lt;u&gt;IDCAMS&lt;/u&gt; is a very powerful tool. You can use &lt;u&gt;LISTCAT&lt;/u&gt; command to ask a Yes/No Question. Is there a file by the name of &lt;u&gt;AGY0157.DEMO.FILE&lt;/u&gt; on the system? If such a file exists, the answer returned is yes. If the file does not exist the answer returned is no.                 &lt;br /&gt;                &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;The LISTCAT command has the following syntax :&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;LISTCAT ENTRIES(your.file.name) ALL&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;I have written a JCL, to test if a given file is available on the system. Take a look at it –              &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S4Ynwg7AJuI/AAAAAAAACjg/Xx6IJK0maSQ/s1600-h/Image144%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image144[1]" border="0" alt="Image144[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S4YnyXFAdAI/AAAAAAAACjk/k0lifSuqU4E/Image144%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="776" height="211" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;              &lt;br /&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;In the above JCL, I have asked a question, is there a file called &lt;u&gt;AGY0157.DEMO.FILE&lt;/u&gt; available? If yes, then IDCAMS will leave behind a Condition Code = 0. If the file does not exist, then IDCAMS will sign off with a return Code &amp;gt; 0.               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S4Ynzf3ADtI/AAAAAAAACjo/KuBy5E0OfyY/s1600-h/Image145%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image145[1]" border="0" alt="Image145[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S4Yn0vPIEsI/AAAAAAAACjs/QJfQPVCSbVc/Image145%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="779" height="208" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;Since, I do have a file called AGY0157.DEMO.FILE, IDCAMS will print a description about the file to the log. The Log shows various details – like the catalog in which the file's entry is present, when the file was created, the file’s location(On which volume the file resides?) etc.               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S4Yn2r-O3DI/AAAAAAAACjw/KTpr-jM_OaM/s1600-h/Image146%5B1%5D%5B6%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image146[1]" border="0" alt="Image146[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S4Yn6UUMzkI/AAAAAAAACj0/0FSPkA14s2Q/Image146%5B1%5D_thumb%5B4%5D.png?imgmax=800" width="779" height="390" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;Upon scrolling down to the bottom of the log, you would find that, IDCAMS has left a trail – the condition code is set to 0.               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S4Yn71ljbXI/AAAAAAAACj4/_uV9oSUNAeg/s1600-h/Image147%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image147[1]" border="0" alt="Image147[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S4Yn-CzUjKI/AAAAAAAACj8/xBVwK2nbkss/Image147%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="785" height="370" /&gt;&lt;/a&gt;               &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Wait a minute, you are asking me to use LISTCAT command, just to know if the file’s availability. In TSO/ISPF, I would just navigate to Dataset List Menu 3.4, and perform a simple search to check availability. What’s the difference?&lt;/strong&gt;&lt;/font&gt; &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;That’s a good question, why use LISTCAT Command, when you can just use Dataset List Menu 3.4. Let me set things straight. The Dataset List Menu 3.4 is an ISPF Screen, where you type the name of the file, and press &amp;lt;ENTER&amp;gt;, you get the list of files, and details(description) about them.              &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S4Yn_-t1tAI/AAAAAAAACkA/1dA6jEbhAVg/s1600-h/Image148%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image148[1]" border="0" alt="Image148[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S4YoCTAn5dI/AAAAAAAACkE/Xbt34XGidwM/Image148%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="782" height="398" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;Actually, Dataset List Menu 3.4 is just a GUI Front-end or screen. It presents a nice, friendly user-interface for checking the availability of a file. In background, there is a ready-made template JCL. The file-name you typed on the 3.4 screen is substituted in this template JCL. This template JCL, uses LISTCAT command to find infomation from the catalog. This template JCL is ready-made, you don’t have to write it. When you press &amp;lt;ENTER&amp;gt;, this template Job is submitted to the MVS Operating System. After the job completes, the results of this job, are populated on the ISPF Screen.               &lt;br /&gt;              &lt;br /&gt;Using the TSO/ISPF Menu 3.4, is equivalent to submitting a job in background which uses LISTCAT command to query the &lt;u&gt;Catalog&lt;/u&gt;, and check the availability of the file.               &lt;br /&gt;              &lt;br /&gt;In fact, just to let you guys know, behind every ISPF Menu screen, there is a&amp;#160; corresponding skeleton or template JCL that runs in the background. ISPF Screen is just a presentation layer, a front-end. &lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;b&gt;&lt;font size="3" face="Courier New"&gt;Q. Well that sounds good in theory. Is the LISTCAT command used in real production environment, in projects?&amp;#160;&amp;#160; &lt;/font&gt;&lt;/b&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;In most projects/sites, there is a complex relationship amongst systems. As an example, suppose there are two Jobs(systems) 1 and 2. Suppose, the JOB 1 produces an Output file. This Output file is fed as Input to JOB 2. In other words, the Job1 is the feeder system of Job 2. Generally in projects, they would express this fact as, &lt;u&gt;Job 2 has a dependency on Job 1&lt;/u&gt;.               &lt;br /&gt;              &lt;br /&gt;Suppose Job 2 has been scheduled to run at 12 o'clock. Remember, that Job 2 expects to pick up a file, which Job 1 will produce as Output. If this file is not available by 12 o'clock, when the Job 2 is about to start, the Job 2 will fail(abnormally end) or abend.&amp;#160; &lt;br /&gt;              &lt;br /&gt;Many-a-times, Job 1 gets delayed, and does not make it within the cut-off time -&amp;#160; 12 o'clock. In this unfortunate situation, Job 2 abends(fails). How could you prevent this incident?               &lt;br /&gt;              &lt;br /&gt;You could add a condition to the Job 2, to first check if the file is available. Provided the file is available, the Job 2 should process it. If the file is not yet available, the Job 2 should bypass it, avoid processing it. Take a look at the JCL, I have written below -               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S4YoEWGp1uI/AAAAAAAACkI/Cb3D3LbUQdk/s1600-h/Image149%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image149[1]" border="0" alt="Image149[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S4YoHPVULiI/AAAAAAAACkM/m46nKvOxzUI/Image149%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="785" height="399" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;Here, I have used LISTCAT command to check the availability of the file AGY0157.DEMO.FILE. If the file exists, the step //CHECK01 leaves behind a condition code=0. If the file is not available, I set the               &lt;br /&gt;MAX Condition Code = 4. The next step //PROCESS will execute if, the condition code of //CHECK01 is 0. If the condition code of //CHECK01 is 4, meaning the file is not available, the next step //PROCESS is bypassed. The job will however not fail or abend.&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-8449589426510099191?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9D0GqWoY_6tc94I27GbSy8NeHGU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9D0GqWoY_6tc94I27GbSy8NeHGU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9D0GqWoY_6tc94I27GbSy8NeHGU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9D0GqWoY_6tc94I27GbSy8NeHGU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/rV3LAATgdt4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/8449589426510099191/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2010/02/idcams-listcat-command.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/8449589426510099191?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/8449589426510099191?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/rV3LAATgdt4/idcams-listcat-command.html" title="IDCAMS – LISTCAT Command" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2010/02/idcams-listcat-command.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0MBSXk9eCp7ImA9WxBVFks.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-3822318044485630608</id><published>2010-02-12T01:13:00.001+05:30</published><updated>2010-02-20T15:54:18.760+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-20T15:54:18.760+05:30</app:edited><title>Submitting Job</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="2" width="790"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="788"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How do you submit a Job on Mainframes for execution?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="788"&gt;&lt;font size="3" face="Courier New"&gt;On Mainframes, when you want to perform any task, you write a Job, and give it to the Mainframe Computer for processing. This is called &lt;u&gt;submitting&lt;/u&gt; a job.             &lt;br /&gt;            &lt;br /&gt;However, contrary to what you might fancy, your job doesn’t run immediately. Picture this - there are hundreds and thousands of Jobs, that are submitted on a Mainframe, minute-by-minute, every second, by different folks. How would the Mainframe computer decide which job goes first, and then which goes next and so on..             &lt;br /&gt;            &lt;br /&gt;The MVS Operating System prepares a pretty time-table, a schedule, that goes something like this - JOB 1 runs at 12 o’ clock, JOB 2 runs at 1 o’ clock, JOB 3 runs at 2 o’ clock and so on.. Thus every job is allotted a time-slot(period) in the Mainframe's Calendar/time-table.             &lt;br /&gt;            &lt;br /&gt;To submit a JOB on Mainframes, you must type &lt;u&gt;SUBMIT command&lt;/u&gt; or just &lt;u&gt;SUB&lt;/u&gt;, on the command line of the editor. I have shown below, how you submit a job on Mainframes.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S3Rdmz_C6aI/AAAAAAAACaI/qyMWZc_kxO4/s1600-h/Image124%5B1%5D%5B6%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image124[1]" border="0" alt="Image124[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S3RdquFSzWI/AAAAAAAACaM/CABQcyii3pg/Image124%5B1%5D_thumb%5B4%5D.png?imgmax=800" width="772" height="463" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;When you press &amp;lt;Enter&amp;gt;, the Job &lt;u&gt;AGY015A&lt;/u&gt; gets submitted to the Mainframe computer for processing. This is indicated by a &lt;strong&gt;***&lt;/strong&gt; message displayed at the bottom of the screen. The &lt;strong&gt;***&lt;/strong&gt; indicates, that TSO is waiting for me to read the message. As soon as you press &amp;lt;Enter&amp;gt; key again, the message goes away.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S3Rdt2_Z1aI/AAAAAAAACaQ/7-MB9a6DNY0/s1600-h/Image125%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image125[1]" border="0" alt="Image125[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S3RdxeJl9jI/AAAAAAAACaU/r089ZQyLLN4/Image125%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="775" height="465" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;A common practise adopted by most Mainframe Programmers, is to code the &lt;u&gt;NOTIFY&lt;/u&gt; parameter on the JOB Statement. Coding this parameter is quite useful, as it gives you an alert, a notification message, saying &amp;quot;&lt;strong&gt;The job AGY0157A has completed&amp;quot;&lt;/strong&gt;.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S3RdydWfilI/AAAAAAAACaY/MiGWlgXvMR4/s1600-h/Image126%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image126[1]" border="0" alt="Image126[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S3RdzdrQIyI/AAAAAAAACac/XBO2L25_2vI/Image126%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="774" height="358" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="788"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How do you see the Job Print Output in TSO/ISPF?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="788"&gt;&lt;font size="3" face="Courier New"&gt;I submitted the simple 3-Step JCL, by typing the &lt;u&gt;SUBMIT command&lt;/u&gt;. Shortly after, MVS also alerted me, by sending a message, that my job &lt;u&gt;AGY0157A&lt;/u&gt; completed.             &lt;br /&gt;            &lt;br /&gt;But, I don’t know for sure, whether my job completed successfully, or it failed(and the reason why it failed). MVS Operating System prints messages to a log, as the job is processed. These run-time messages which get recorded to the log, helps track, if the Job completed successfully or it failed. Further, they also contain error-messages that point out why the job fails.             &lt;br /&gt;            &lt;br /&gt;To see the print output/log of any Batch Job, you use a software called SDSF. &lt;u&gt;SDSF&lt;/u&gt; stands for &lt;u&gt;Spooler Display and Search Facility&lt;/u&gt; – its a software for seeing the output in the Spool.             &lt;br /&gt;            &lt;br /&gt;What is Spool? Well, generally, the log of a Job, when it runs on Mainframes, are to be sent to a printer. But prior to sending the log to the printer, the logs have to wait(buffered) in a staging area(in a queue), because hundreds of jobs complete every minute, and the logs gotta be printed. Not all logs can be printed at once. The logs have to wait in a Queue/staging area. This staging area is called &lt;u&gt;Spool(Queue)&lt;/u&gt;. The Mainframe printer will pick up the log from the spool one-by-one and print it.             &lt;br /&gt;            &lt;br /&gt;Before TSO and SDSF was invented, you couldn’t see the output till the time, it got printed. Waiting for it to get printed, could take hours on end. Now-a-days, TSO makes this easy, it’s possible to view the logs in the Spool(Queue).             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S3Rd2Jaqe5I/AAAAAAAACag/HIpEHeLYkck/s1600-h/Image122%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image122[1]" border="0" alt="Image122[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S3Rd5bSmS5I/AAAAAAAACak/VrZZyreYoxo/Image122%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="782" height="368" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;To view the log of a Job in the Spool(Queue), type &lt;u&gt;START SDSF&lt;/u&gt; and press &amp;lt;Enter&amp;gt;. This shows the shows the SDSF Screen. To see the log of Job, you must type ST on the SDSF menu and press &amp;lt;Enter&amp;gt;.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S3Rd7Y1SN2I/AAAAAAAACas/jM74NsAUt1k/s1600-h/Image128%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image128[1]" border="0" alt="Image128[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S3Rd_XDGAjI/AAAAAAAACaw/5lXQejUJ4YM/Image128%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="777" height="479" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;A list of the logs for all jobs in Spool(Output Queue) is displayed. By default, this list will displayed only those jobs submitted via your             &lt;br /&gt;&lt;u&gt;TSO User-id&lt;/u&gt;. For example, if my TSO User-id is AGY0157, it will display all jobs starting with(prefix) AGY0157*.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S3aflwEsxqI/AAAAAAAACdI/yptoUUZf834/s1600-h/Image131%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image131[1]" border="0" alt="Image131[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S3afpt1NLNI/AAAAAAAACdM/jRZmkn7bJoQ/Image131%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="785" height="193" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;The screen displays a list of logs of all jobs, you have submitted. For each job that you submit, there is an entry, and it shows various details like the job-name, owner, class and priority.             &lt;br /&gt;            &lt;br /&gt;If your job is complete, and its log is ready to be dispatched to the printer, the log is on the &lt;u&gt;PRINT&lt;/u&gt; Queue. On the other hand, if the job is still running, then it is still in the &lt;u&gt;EXECUTION&lt;/u&gt; Queue.             &lt;br /&gt;            &lt;br /&gt;Mostly, all jobs that you submit, their logs would be dumped here in the Spool. To view the contents any particular job log, you can type &lt;strong&gt;?&lt;/strong&gt; against the job=name and press &amp;lt;Enter&amp;gt;. This takes you inside the log.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S3afrCDYwUI/AAAAAAAACdQ/oN1yz86y1Ms/s1600-h/Image132%5B1%5D%5B6%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image132[1]" border="0" alt="Image132[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S3aftzJKCII/AAAAAAAACdU/DTP5zEd2wyY/Image132%5B1%5D_thumb%5B4%5D.png?imgmax=800" width="788" height="289" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;The log(print output) of a job, contains several sections. You can type S(Show) against each section, and view the contents of it.&amp;#160; &lt;br /&gt;            &lt;br /&gt;The &lt;u&gt;Input Queue&lt;/u&gt; and &lt;u&gt;Output Queue&lt;/u&gt; are analogous to the &lt;u&gt;run-ways&lt;/u&gt; on an Airport. The &lt;u&gt;Input Queue&lt;/u&gt; is runway from where the Jobs take-off. After their flight is complete, the jobs land on the runway called the &lt;u&gt;Output Queue&lt;/u&gt;.&lt;font size="3" face="Courier New"&gt;But who's the Air Traffic Controller(ATC) on this Airport?              &lt;br /&gt;              &lt;br /&gt;The &lt;u&gt;JES(Job Entry Sub-System)&lt;/u&gt; is a software that manages the &lt;u&gt;Input Queue&lt;/u&gt; and &lt;u&gt;Output Queue&lt;/u&gt;. The JES acts like Traffic Controllers(Traffic cops). Without them, two airplanes or jobs could collide. The JES is a part of the MVS Operating System that decides, what time a job can takeoff safely from the &lt;u&gt;Input Queue&lt;/u&gt;(Takeoff runway). Thus, it monitors the traffic in the Input Queue(Runway) and prepares the time-table, a chart or a schedule for Jobs entering the system.               &lt;br /&gt;              &lt;br /&gt;On the &lt;u&gt;Input Queue&lt;/u&gt; side, the &lt;u&gt;JES(Job Entry Subsystem)&lt;/u&gt; welcomes all Jobs that enter into the &lt;u&gt;Input Queue&lt;/u&gt;, reads the Jobs' JCL, converts it into an internal format known to MVS, and schedules the job for takeoff at 2 o’clock or 3 o’clock, till the Job takes off, and begins its flight(execution).               &lt;br /&gt;              &lt;br /&gt;Sometimes, on the &lt;u&gt;Output Queue&lt;/u&gt;(Staging area) side contains logs(outputs) of old jobs. Such old logs(print outputs) of a job, are deleted from time-to-time periodically by JES. So, JES ensures that the Output Queue clean and tidy.               &lt;br /&gt;              &lt;br /&gt;The &lt;u&gt;JES Message Log&lt;/u&gt; contains the following messages -               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S3-Ect1I8lI/AAAAAAAACe0/QCDUXXDefqI/s1600-h/Image133%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image133[1]" border="0" alt="Image133[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S3-EgtjU8jI/AAAAAAAACe8/g_QmK27R_cg/Image133%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="775" height="333" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;              &lt;br /&gt;The &lt;u&gt;Job Entry Subsystem(JES)&lt;/u&gt; reads the Job’s JCL Statements. My Job had 24 lines of JCL Code, so JES reports this as 24 cards read.               &lt;br /&gt;              &lt;br /&gt;Once the job takes off from the &lt;u&gt;Input Queue&lt;/u&gt;, it executes, and lands at &lt;u&gt;Output Queue&lt;/u&gt;. The log(print output) of Job, is referred as SYSOUT. This contains 125 lines of text. JES reports this as 125 SYSOUT Print records. This implies, the log(print output) of the job, contains 125 lines of text, in the &lt;u&gt;Output Queue&lt;/u&gt;(Staging area), waiting to get printed.               &lt;br /&gt;              &lt;br /&gt;MVS numbers the JCL Statements that you submitted as part of the job.               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S3-EjVizqHI/AAAAAAAACfA/EH4sbCUJsT8/s1600-h/Image134%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image134[1]" border="0" alt="Image134[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S3-EnOQE_9I/AAAAAAAACfE/DcQly8fMD2I/Image134%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="790" height="441" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;ALLOC tells you which devices and how much memory was allocated for the job-step. As you know, &lt;u&gt;one step&lt;/u&gt; runs &lt;u&gt;one program&lt;/u&gt;. It also informs you about the CPU time required to process a Job-step. Every Job-step leaves behind a trail, a &lt;u&gt;COND CODE&lt;/u&gt; in the range of 0000 to 4095.                   &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S3-Eq7O_FKI/AAAAAAAACfI/_ctyzX39yn4/s1600-h/Image135%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image135[1]" border="0" alt="Image135[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S3-EvZCPOOI/AAAAAAAACfM/tOtSxii4z2k/Image135%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="792" height="469" /&gt;&lt;/a&gt;                  &lt;br /&gt;                  &lt;br /&gt;But apart from this , when &lt;u&gt;you want to write your own extra notes to the logs&lt;/u&gt;(diary), you code a &lt;u&gt;SYSOUT=*&lt;/u&gt; parameter on the &lt;u&gt;DD Statement&lt;/u&gt;. For the 3-step job-stream that I have written, I have set the //SYSUT2 DD statement to point to the logs. This means that, the outputs of //STEP01 and //STEP03 shall be jotted down in the logs. The first step prints/copies the contents of the Unsorted Input file to the log. The second step                   &lt;br /&gt;                  &lt;br /&gt;These are the contents of the Unsorted Input File, written to the log -                  &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S3-4M2kg1PI/AAAAAAAACf0/zwSWUFEOWlI/s1600-h/Image136%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image136[1]" border="0" alt="Image136[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S3-4PlQogKI/AAAAAAAACf4/JC2VPGwEV0A/Image136%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="775" height="146" /&gt;&lt;/a&gt;                  &lt;br /&gt;                  &lt;br /&gt;These are the contents of the Sorted Output, written to the log -                  &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S3-4Rv7IuWI/AAAAAAAACf8/9-gnfEPkxp8/s1600-h/Image137%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image137[1]" border="0" alt="Image137[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S3-4T1ie3II/AAAAAAAACgA/QUdJ-Jq4Rpc/Image137%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="781" height="150" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-3822318044485630608?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nCJDHsuzUJL9zUsV0h2U8UGhO88/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nCJDHsuzUJL9zUsV0h2U8UGhO88/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nCJDHsuzUJL9zUsV0h2U8UGhO88/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nCJDHsuzUJL9zUsV0h2U8UGhO88/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/42l33qUTOtQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/3822318044485630608/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2010/02/submitting-job.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/3822318044485630608?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/3822318044485630608?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/42l33qUTOtQ/submitting-job.html" title="Submitting Job" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2010/02/submitting-job.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUIHR3s9eyp7ImA9WxBWFEk.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-3923410572756564177</id><published>2010-02-01T07:48:00.001+05:30</published><updated>2010-02-06T14:42:16.563+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-06T14:42:16.563+05:30</app:edited><title>Multi-step Job Streams</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Can Job run just one program? What if I want the output of one program, to be fed as input to a second program?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;Yes, your intuition is absolutely correct. A job can have many(multiple) steps, each step runs a program. The output of 1st step can be fed to the 2nd step, the output of 2nd step can be fed to the 3rd step and so on..            &lt;br /&gt;            &lt;br /&gt;You already know the &lt;u&gt;general pattern of any Job&lt;/u&gt;. It has a JOB statement at the beginning that describes the job, EXEC to run the program, followed by DD Statements that represent the files/datasets, from which the program accesses data. It looks like this -             &lt;br /&gt;            &lt;br /&gt;            &lt;table border="1" cellspacing="0" cellpadding="2" width="796"&gt;&lt;tbody&gt;               &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;//name&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;JOB&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;parameters&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;//name&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;EXEC&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;parameters&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;//name&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;DD&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;parameters..&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;//name&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;DD&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;parameters..&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;//name&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;DD&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;parameters..&lt;/td&gt;               &lt;/tr&gt;             &lt;/tbody&gt;&lt;/table&gt;            &lt;br /&gt;The above was a very &lt;u&gt;simple, single-step Job&lt;/u&gt;. However, in most production environments in real Projects, a Job has multiple steps. Each step runs a program, that reads input data, processes it, and produces some output. Thus, typically the job would be a stream, a inter-linked chain of several steps.             &lt;br /&gt;            &lt;br /&gt;The best way to understand a multi-step job-stream is to think of an Indian railways train.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S2Y5yehp59I/AAAAAAAACS8/ecEfkAdP_Cs/s1600-h/Image10715.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image107[1]" border="0" alt="Image107[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S2Y5zz27GnI/AAAAAAAACTA/iV2Vn65N9E8/Image1071_thumb3.png?imgmax=800" width="783" height="95" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;The JOB Statement is the locomotive engine. Each program to run is inside a train compartment, and the last bogie/compartment would be null card – indicating the end of the &lt;u&gt;JOB Train&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;In this job train, each step runs a program, that receives input feed from the preceding step(step before that), processes it, and gives an output, which is fed to the next succeeding step. This way, the data is processed step-by-step, and you arrive at the final output, once the last step is complete.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. Vow, that was fun! Tell me more about these multi-step jobs.&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;Well, to learn more about multi-step jobs, you need to take some existing jobs and analyse them, how they work. This would give you a far better view of how multi-step jobs work.            &lt;br /&gt;            &lt;br /&gt;But, first to understand any multi-step job, you need to know how to draw JCL flow-charts.             &lt;br /&gt;            &lt;br /&gt;I am going to take a 3-step job, for the sake of example. I have given the skeleton of this 3-step job below.             &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S2Y51tOFaGI/AAAAAAAACTE/LKKV3mFVTOg/s1600-h/Image10815.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Image108[1]" border="0" alt="Image108[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S2Y53a9YwDI/AAAAAAAACTI/mLMeHXaxer4/Image1081_thumb3.png?imgmax=800" width="370" height="468" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;If you can graphically draw what a JCL would do(does), it helps a lot to understand the JCL. Now, each step is gonna read one/more datasets, do some processing, and produce reports and write output to one/more datasets. First let me draw a simple diagram for the above JCL Skeleton.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S2Y54PHD50I/AAAAAAAACTM/L9HUmMoBfxM/s1600-h/Image10913.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Image109[1]" border="0" alt="Image109[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S2Y549Q9r-I/AAAAAAAACTQ/3dP8Onssmus/Image1091_thumb1.png?imgmax=800" width="123" height="240" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;Now, you can enrich this basic diagram by adding some more flowchart symbols, as shown below -             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S2Y55nvD3KI/AAAAAAAACTU/QXxrzHpPb4c/s1600-h/Image11014.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Image110[1]" border="0" alt="Image110[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S2Y56qu65DI/AAAAAAAACTY/gNh_5g_SCpk/Image1101_thumb2.png?imgmax=800" width="323" height="478" /&gt;&lt;/a&gt;             &lt;br /&gt;You must be familiar with flowcharting symbols such as decision-box and loop statements. However, understand that &lt;u&gt;JCL is not a programming language&lt;/u&gt;, and hence you do not have such symbols out here.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Often, I see a lot of these DD * and DD DUMMY Statements. Could you just give me a crash course, before telling me more about job-streams?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;Before you proceed ahead, here’s a crash course on two parameters that you often code on DD Statement – * and DUMMY.            &lt;br /&gt;            &lt;br /&gt;1. &lt;u&gt;DD *&lt;/u&gt; - What if you wanted to give special commands(instructions), to IEBGENER. Like &amp;quot;&lt;u&gt;Copy only those employee records whose name starts with A&lt;/u&gt;&amp;quot;. Note, that this is not data, so you don’t supply it in a file. These are commands, or instructions(orders) to IEBGENER telling it what records to copy. Such direct commands or instructions to the EXEC PGM program, that influence(control) the way the PGM works are called &lt;u&gt;Control Instructions&lt;/u&gt;.&amp;#160; &lt;br /&gt;            &lt;br /&gt;Usually, the custom adopted is to &lt;u&gt;hard-code(or embed) the control instructions in the body of the JCL itself&lt;/u&gt;(instead of putting them in a separate file). When you want to &lt;u&gt;directly hard-code any stuff in JCL&lt;/u&gt;,&amp;#160; you must use *(wild-card) as a parameter on the DD Statement.             &lt;br /&gt;            &lt;br /&gt;//name DD *             &lt;br /&gt;Control instruction 1 -             &lt;br /&gt;Control instruction 2 -             &lt;br /&gt;...             &lt;br /&gt;/*             &lt;br /&gt;            &lt;br /&gt;You indicate the end of the control instructions by putting /* statement.&amp;#160; &lt;br /&gt;            &lt;br /&gt;2. &lt;u&gt;DD DUMMY&lt;/u&gt; – What if you wanted to shut off the input fed to a particular Program. As an example, you don’t want to supply any input data file to IEBGENER. Shutting off input or output isn’t that easy, because IEBGENER would expect you to write //SYSUT1 DD Statement. Omitting //SYSUT1 isn’t an option(that would be a JCL Error). You can’t do away with it, just like that. So, you code a DUMMY parameter on the DD Statement. DUMMY implies, that this is just a DUMMY input or output file. In other words, that input/output feed is shut off(you have just sealed it off!).             &lt;br /&gt;            &lt;br /&gt;DD * and DD DUMMY should come in handy while understanding a complete job-stream.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. Can you put together piece-by-piece, how the flow of a 3-step job looks like?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;Alright friends, we shall go about it like this. We are first going to construct (pieces)blocks one-by-one, and them put them all together, assemble them to build a complete job.            &lt;br /&gt;            &lt;br /&gt;The toy job shown here does the following             &lt;br /&gt;1. STEP01 – Read EMPLOYEE Data stored in a disk file(AGY0157.EMPLOYEE.INPUT) and print a list of all employees to the log for information purposes.             &lt;br /&gt;2. STEP02 - Arrange the records of the EMPLOYEE Data file in alphabetical order i.e. sort the EMPLOYEEs data             &lt;br /&gt;3. STEP03 – Print a report of the sorted output EMPLOYEE Data to the logs.             &lt;br /&gt;            &lt;br /&gt;The first Step01 of the toy job, runs IEBGENER.             &lt;br /&gt;a) IEBGENER expects to read the input file at //SYSUT1 DD Statement.             &lt;br /&gt;b) IEBGENER copies the contents, and prints it to the dataset represented by //SYSUT2 DD Statement. We would like the input file’s contents are printed to the log just for informative purposes(so it helps tracking), //SYSUT2 file must point to the log(code the parameter SYSOUT=*).             &lt;br /&gt;c) IEBGENER expects to receive control instructions, at the //SYSIN DD Statement. Since, we are not gonna issue any control instruction, and want this functionality turned off, you can code a DUMMY parameter on the //SYSIN DD Statement.             &lt;br /&gt;d) Also, MVS Operating System, expects to write messages about the execution of the program at the dataset represented by //SYSPRINT DD Statement. Usually, you would want these messages to be printed to the log, so I would code SYSOUT=* as a parameter on the //SYSPRINT DD Card.            &lt;br /&gt;            &lt;br /&gt;Okay, with that background, let me show you the JCL for the first step STEP01.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S2j2WjoXaqI/AAAAAAAACUI/R1s2YDk2o_k/s1600-h/Image111%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image111[1]" border="0" alt="Image111[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S2j2dNdARrI/AAAAAAAACUM/JNj08EZC0qQ/Image111%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="782" height="189" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;The second step STEP02 of the toy job, runs SORT. Essentially, SORT utility takes the input file records, and &lt;u&gt;arranges them in order(in sequence)&lt;/u&gt;, ascending or descending.            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S20GhOn6F-I/AAAAAAAACVE/_UT8GEEbEPY/s1600-h/Image112%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image112[1]" border="0" alt="Image112[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S20GjDpGHPI/AAAAAAAACVI/L_B0Vz9YB9g/Image112%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="783" height="232" /&gt;&lt;/a&gt;            &lt;br /&gt;            &lt;br /&gt;1. SORT pgm. expects to reads records from the //SORTIN DD Statement. The //SORTIN DD Statement points to the File – AGY0157.INPUT.DATA.            &lt;br /&gt;2. SORT Pgm. sorts the input records in this file, as per the special control instructions(commands) that are supplied in the //SYSIN DD statement. I have instructed/commanded SORT Pgm, to apply sort on the field starting from columns &lt;u&gt;1 to 4&lt;/u&gt;, the data must be treated as a textual string(Character), and it should be sorted in ascending order(A).            &lt;br /&gt;&lt;strong&gt;SORT FIELDS=(1,4,CH,A)             &lt;br /&gt;              &lt;br /&gt;&lt;/strong&gt;For your reference, the input file’s records are shown below.            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S20GkbzJfgI/AAAAAAAACVM/BAsE31WuyYs/s1600-h/Image114%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image114[1]" border="0" alt="Image114[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S20Gl3eIslI/AAAAAAAACVQ/h2PwKT9xUKs/Image114%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="785" height="121" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;             &lt;br /&gt;3. SORT Pgm. writes the &lt;u&gt;sorted(ordered) output&lt;/u&gt; to the file represented by the //SORTOUT DD Statement. Here, I’ve created a new file, to which the sorted output records are written. This is one of the most difficult category of DD Statements to compose. Instead of specifying an actual output file-name, the &lt;u&gt;&amp;amp;&amp;amp;OUTPUT&lt;/u&gt; on the SYSOUT DD Statement indicates a &lt;u&gt;temporary file&lt;/u&gt;. This &lt;u&gt;temporary output file&lt;/u&gt;, will be deleted, after the job completes.              &lt;br /&gt;              &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;4. Once again, the MVS Operating System, &lt;u&gt;generates a report at how the SORT PGM ran&lt;/u&gt;, at //SYSOUT DD Statement. We would write this messages to log, by coding SYSOUT=* Parameter.                &lt;br /&gt;                &lt;br /&gt;The third step STEP03 of the toy job, runs IEBGENER, a second time.                &lt;br /&gt;1. IEBGENER reads the input from the //SYSUT1 file – this is &lt;u&gt;temporary output file &amp;amp;&amp;amp;OUTPUT&lt;/u&gt; containing the Sorted Output Records from the preceding Step STEP02. Thus, temp output file of the previous step is picked up as input for the next step.                &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S20GmuCyxJI/AAAAAAAACVU/aS0-ktTpb4I/s1600-h/Image115%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image115[1]" border="0" alt="Image115[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S20GpbobaTI/AAAAAAAACVY/aMWe6ZVNOzM/Image115%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="780" height="150" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;2. IEBGENER copies these sorted records from the temporary file, to the //SYSUT2 DD File. The //SYSUT2 DD Statement points to the log - SYSOUT=*. Thus, the list of sorted records are written to the log.                &lt;br /&gt;                &lt;br /&gt;3. Since, I have not given any special commands or instructions to IEBGENER, I have turned off the //SYSIN DD functionality, by coding DUMMY Parameter on it.                &lt;br /&gt;                &lt;br /&gt;4. The report generated MVS about the execution of IEBGENER, is written to the file represented by //SYSPRINT DD Statement. I have set //SYSPRINT DD to point to the log(SYSOUT=*). As a consequence, the Status Report of MVS, of how the IEBGENER PGM ran, is printed to the log.                &lt;br /&gt;                &lt;br /&gt;The crux of this entire job-stream is -                 &lt;br /&gt;- It picks up &lt;u&gt;unsorted&lt;/u&gt;,&lt;u&gt;un-arranged&lt;/u&gt; input records from the file AGY0157.INPUT.DATA.                &lt;br /&gt;- It sorts, arranges the data in ascending order, on the key field from                 &lt;br /&gt;cols 1-4.                &lt;br /&gt;- It writes the &lt;u&gt;sorted&lt;/u&gt;, &lt;u&gt;ordered&lt;/u&gt; output records to the Log.                &lt;br /&gt;                &lt;br /&gt;Putting it all together, and assembling, the below flow-diagram gives a gist of the entire job-stream.                &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S20yYTsfB1I/AAAAAAAACVk/_xeXNXJ9q0M/s1600-h/Image116%5B1%5D%5B7%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Image116[1]" border="0" alt="Image116[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S20ybXtQZiI/AAAAAAAACVo/y3_pmMfIShE/Image116%5B1%5D_thumb%5B5%5D.png?imgmax=800" width="604" height="906" /&gt;&lt;/a&gt;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-3923410572756564177?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/UNSjRcBzO1L1h1BJyvpoygWciHM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UNSjRcBzO1L1h1BJyvpoygWciHM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/UNSjRcBzO1L1h1BJyvpoygWciHM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UNSjRcBzO1L1h1BJyvpoygWciHM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/QqQFVE8Xxcs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/3923410572756564177/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2010/02/multi-step-job-streams.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/3923410572756564177?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/3923410572756564177?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/QqQFVE8Xxcs/multi-step-job-streams.html" title="Multi-step Job Streams" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2010/02/multi-step-job-streams.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8ARHk7fyp7ImA9WxBXFU8.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-5653241501634916909</id><published>2010-01-22T12:30:00.001+05:30</published><updated>2010-01-26T21:50:45.707+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-26T21:50:45.707+05:30</app:edited><title>Basic Framework of JCL</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. My head’s spinning around the 3 JCL Statements : JOB, EXEC and DD. Could you tell me something more about them?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;So, you’ve got the gist of the concept behind JCL, all the JCL that you going to write from hereon, maybe for the next 10-20 years, would be composed of three main statements :            &lt;br /&gt;            &lt;br /&gt;            &lt;table border="1" cellspacing="0" cellpadding="2" width="796"&gt;&lt;tbody&gt;               &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;//name&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;&lt;strong&gt;JOB&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;parameters...&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;//name&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;&lt;strong&gt;EXEC&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;parameters...&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;//name&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;&lt;strong&gt;DD&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;parameters...&lt;/td&gt;               &lt;/tr&gt;             &lt;/tbody&gt;&lt;/table&gt;         &lt;/font&gt;          &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;Each of this JCL Statements have a label – a symbolic name assigned to them. Its like naming kids. Well, there could be so many boys in your area, but how do distinguish them? Of course, by their names.            &lt;br /&gt;            &lt;br /&gt;In the same way, a JCL may contain a bunch of &lt;strong&gt;DD&lt;/strong&gt; Statements, one for Input file, one for the output file, one for the error file. How do you tell them apart, by naming them. As a good practice, &lt;u&gt;we always give names to all our JCL Statements&lt;/u&gt;. Names kinda help you to &lt;u&gt;refer back&lt;/u&gt; to these statements in the future. You want to point out a particular JCL Statement to your friend, just spell out its name.             &lt;br /&gt;            &lt;br /&gt;But, notice carefully, each label(name) is preceded with two slashes //. The two slashes are a JCL Statement’s signature. They indicate that the statement is a JCL Statement(one of JOB, EXEC, DD). Every JCL Statement wear the two slashes //. A naked statement without // won’t be treated as a JCL Statement.             &lt;br /&gt;            &lt;br /&gt;Now, every JOB, EXEC and DD Statement has got these whole lot of parameters. What you’ll be learning throughout these tutorials is mostly the parameters. Parameters add stuff and meaning to the JCL Statement.&amp;#160; &lt;br /&gt;            &lt;br /&gt;Now, let me give you a booster, that’s going to help you organise the way you think about this JCL.             &lt;br /&gt;            &lt;br /&gt;- JCL is made up of mainly JOB, EXEC and DD.             &lt;br /&gt;- JOB is easy to learn and use.             &lt;br /&gt;- EXEC is easy and fun to use.             &lt;br /&gt;- DD Statements take three forms             &lt;br /&gt;&amp;#160;&amp;#160; 1. DD Statements to read a file.(easy)             &lt;br /&gt;&amp;#160;&amp;#160; 2. DD Statements to write to the logs.(easy)             &lt;br /&gt;&amp;#160;&amp;#160; 3. DD Statements to create a new file(hard!); you’d have to learn parameters such as DISP, UNIT, DCB, SPACE and several others to code this.             &lt;br /&gt;            &lt;br /&gt;Have a good look at this chart :             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S1lM_OHNAkI/AAAAAAAACIE/csuKaW9RtLQ/s1600-h/Image99%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Image99[1]" border="0" alt="Image99[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S1lNA0tMhQI/AAAAAAAACII/2j7bobiqcpE/Image99%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="522" height="339" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Let’s set this straight. You’ve got to give me an overview of the JOB Statement.&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;You code the JOB Statement at the start of any JCL you write. It tells the MVS Operating system, who’s the guy requesting the program to be sent to MVS for execution, where MVS should send the print output, how much reporting(level of detail) should MVS provide, and how important is the Job as opposed to other competing jobs.            &lt;br /&gt;            &lt;br /&gt;You can even indicate things like memory and processing time limits on the JOB Statement.             &lt;br /&gt;            &lt;br /&gt;You write the JOB statement starting with a name, which becomes the JOB Name. JOB Names are a big deal, because MVS keeps track of thousands of Jobs using Job Names.             &lt;br /&gt;            &lt;br /&gt;The most general form of the JOB Statement is this :             &lt;br /&gt;//AGY0157A JOB ...other parameters             &lt;br /&gt;            &lt;br /&gt;As a programmer or developer, when you code some jobs for executing the programs that you’ve written, the &lt;u&gt;job-name&lt;/u&gt; that follows the slashes, is &lt;u&gt;your TSO-userid followed by a single letter&lt;/u&gt;. Like my TSO-userid happens to be &lt;u&gt;AGY0157&lt;/u&gt;, so I’ve coded the job-name as &lt;u&gt;AGY0157A&lt;/u&gt;. By doing so, anyone who happens to look at these jobs will deduce, all Jobs of the format AGY0157* belong to(are owned by) the TSO User-id AGY0157. It becomes so much each easier to trace back/revert back to the &lt;u&gt;owner&lt;/u&gt;. God forbidding, should your job fail for some reason, the operator can immediately find out, to whom the job belongs and contact the respective owner.             &lt;br /&gt;            &lt;br /&gt;The content of your JOB Statement usually very stable. Once, you have established a JOB Statement, you can use it for most of your work. Sometimes, your project leader or client Manager may give you an account-number to use, so that the resources used to run your job, maybe charged to an appropriate account.(The example, I have written is going to use the Account-no A123)             &lt;br /&gt;            &lt;br /&gt;You are going to use other parameters like CLASS, MSGCLASS, MSGLEVEL, NOTIFY, REGION, TIME, and PRTY in you JOB Statements. Hey wait, don’t hit on the gas right now, hold on for a while, I am going to discuss the JOB Statement at length in the next tutorial.             &lt;br /&gt;            &lt;br /&gt;In the figure below, I’ve reproduced the JCL, I wrote to copy one file to another using IEBGENER Utility program. Notice, the two different styles of coding the parameters. You can code just one parameter on each line to make it more readable.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S1lNCxHFkeI/AAAAAAAACIM/AsnO8Oor99M/s1600-h/Image101%5B1%5D%5B6%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image101[1]" border="0" alt="Image101[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S1lNFcYlB-I/AAAAAAAACIQ/fNzzG3mgclk/Image101%5B1%5D_thumb%5B4%5D.jpg?imgmax=800" width="764" height="478" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;(a) You can code JCL with a compact JOB Statement and put several parameters on the same line (b) An easier to read-style, is to code one parameter on each line, leaving room for comments.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Could you give me a brief idea about EXEC Statement too..?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;The EXEC Statement is the &lt;u&gt;engine of your JOB&lt;/u&gt;. The EXEC statement tells the MVS, which &lt;u&gt;program&lt;/u&gt; to run. So, you use EXEC JCL Statement, to announce to the MVS, which program, you want to run.             &lt;br /&gt;            &lt;br /&gt;//STEP01 EXEC PGM=IEBGENER             &lt;br /&gt;            &lt;br /&gt;Like any other JCL Statement, you write the EXEC Statement starting with two slashes //. You assign a name/label &lt;font size="3" face="Courier New"&gt;to the EXEC Statement,&lt;/font&gt; for unique identification like STEP01, which is called &lt;u&gt;Step-name&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;Let us make no mistake in understanding that -             &lt;br /&gt;1. The step-name is just a name given to the EXEC Statement. The step-name could be omitted as well. However, its always good to name all your EXEC steps, so that you can always refer back to step later. This would count a lot, pretty important stuff, when you write multi-step jobs.             &lt;br /&gt;            &lt;br /&gt;2. AS Shakespeare has said, what’s in a name? A step-name is just a name given to the EXEC Step. The name could be possibly anything at all, it doesn’t need to always start with //STEP prefix. You could also name your step as //QUASAR or //BARABARA or //COPYSTEP or any name of your choice. But most people would use a step-name which is meaningful, and conveys the meaning of the step.             &lt;br /&gt;            &lt;br /&gt;3. The executable program that you want to run, should be specified after PGM.             &lt;br /&gt;            &lt;br /&gt;You can code a lot of extra things on the EXEC Statement, such as REGION, TIME, COND, PARM and ACCT. I’ll give many more inputs to my readers, about these extra parameters, as you progress through the tutorials.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S1yPAYN9MfI/AAAAAAAACQM/JzvdhFs7L_w/s1600-h/Image102%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image102[1]" border="0" alt="Image102[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S1yPDIbrR8I/AAAAAAAACQQ/ide8n9FUW34/Image102%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="777" height="327" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;In the above JCL, to copy the contents of a file to another file, using IEBGENER, when you take a glance at the JOB Statement, you would find that I’ve coded REGION and TIME Parameters on the JOB Statement. REGION and TIME specify memory space limit and time limit on the JOB. But guess what, if you code the REGION and TIME Parameter on the EXEC Statement, that allows you to specify a memory limit and time limit for that program or step only. &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Could you give me a brief overview of how DD Statement refers to files?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;A program executed at a step can access zero, one or more Files(Datasets). &lt;u&gt;For each dataset, the program accesses, you must code a DD Statement&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;MVS frees and relieves the programmer/developer, from having to know the actual(real) name of the file, and other details about the files, while writing a COBOL or PL/I Program. The programmer is unaware of the real file. Instead in COBOL, &lt;u&gt;he refers to the input file(s) and output file(s) only by their symbolic DD-names&lt;/u&gt;. COBOL Program refers to files by their smbolic dd-names. It is through the DD Statement in JCL, that assign actual physical files to these symbolic dd-names. Thus, the dd-names serve as an indirect reference to the actual file.             &lt;br /&gt;            &lt;br /&gt;How symbolic dd-names are associated with actual, physical files, is explained in the diagram below.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S103sp6Q4pI/AAAAAAAACQc/oVUCsmOnM3U/s1600-h/Image104%5B1%5D%5B7%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image104[1]" border="0" alt="Image104[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S103vwElggI/AAAAAAAACQg/2xe1uWZ7d1A/Image104%5B1%5D_thumb%5B5%5D.png?imgmax=800" width="801" height="596" /&gt;               &lt;br /&gt;              &lt;br /&gt;&lt;/a&gt;The COBOL Program refers to the files as &lt;u&gt;INPUT-FILE&lt;/u&gt; and &lt;u&gt;OUTPUT-FILE&lt;/u&gt;. In the JCL, you specify the actual(real) files in the DD-Statement, &lt;u&gt;AGY0157.INPUT.DATA&lt;/u&gt; and &lt;u&gt;AGY0157.OUTPUT.DATA&lt;/u&gt;. The common connecting link/bridge between them is the dd-name &lt;u&gt;INPUTDD&lt;/u&gt; and &lt;u&gt;OUTPUTDD&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;In the COBOL Program, the INPUT-FILE and OUTPUT-FILE shall represent the file whose dd-names are INPUTDD and OUTPUTDD. In the Job JCL, the ddnames //INPUTDD and //OUTPUTDD are set to point to the files AGY0157.INPUT.DATA and AGY0157.OUTPUT.DATA. Thus, this helps establish a relationship. Thus, the COBOL Programmer and the one who writes the JOB; there should be common agreement amongst them, with regards to the dd-names. If the COBOL program expects an input file, with dd-name INPUTDD, which is not supplied in the JCL, this would be a JCL-Error.             &lt;br /&gt;            &lt;br /&gt;The same applies to the IBM-supplied Utility programs like IEBGENER, SORT, IEBCOPY etc. The developers of IEBGENER assumed dd-name of input file as SYSUT1, and output file as SYSUT2. The //SYSUT1 and //SYSUT2 DD Statements must appear in your JCL. Thus, &lt;u&gt;for built-in IBM Utility programs, there are some pre-defined dd-names, which you have to stick to&lt;/u&gt;. &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Could you give me a short description of the 3 different types of DD-Statements?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;As I mentioned before, the 3 general categories of DD Statements are :            &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;1. A DD Statement for reading a file/dataset              &lt;br /&gt;2. A DD Statement for recording/writing to the log(diary). MVS operating System keeps a log, a diary of notes of how each job ran, whether it was successful or a failure. With this DD Statement, you can scribble and write anything you wish to the log               &lt;br /&gt;3. A DD Statement for creating a new dataset, and writing to the file(dataset).               &lt;br /&gt;&amp;#160; &lt;br /&gt;Let me explain this, with a concrete example -               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S16SDZs7GGI/AAAAAAAACQ0/5IT2EMYIc_I/s1600-h/Image105%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Image105[1]" border="0" alt="Image105[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S16SFHmyqcI/AAAAAAAACQ4/hbcZ4rNLZyA/Image105%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="794" height="255" /&gt;&lt;/a&gt;               &lt;br /&gt;&lt;u&gt;Reading a file or Dataset&lt;/u&gt;               &lt;br /&gt;The IEBGENER program expects to read the records from the Input file at the //SYSUT1 DD Statement. There’s nothing much to it, DD statement for reading records from an Input file is damn easy.               &lt;br /&gt;              &lt;br /&gt;&lt;u&gt;Creating a new Dataset, and writing records to it(Hard!!)                &lt;br /&gt;&lt;/u&gt;The IEBGENER program expects to write the records to the output file at the //SYSUT2 DD Statement. To create a new file/dataset in JCL, as you can observe, you need to code a lot of extra parameters like SPACE, UNIT, DCB etc.               &lt;br /&gt;              &lt;br /&gt;&lt;u&gt;Writing to the log                &lt;br /&gt;&lt;/u&gt;To make note in the logs(diary), to write any text to the logs, you code a parameter on the DD Statement called SYSOUT=*.&amp;#160; Logs are indicated by coding the parameter SYSOUT=* on the DD Statement.               &lt;br /&gt;&amp;#160; &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;While running your job, ,MVS keeps prepares a status report about how your program is running, its status, whether it succeeded or failed. Thus, this status report report messages are important, because they tell you whether the Job ran fine.                  &lt;br /&gt;                  &lt;br /&gt;The MVS OS expects to write status report messages to the output file at //SYSPRINT DD Statement. By coding the SYSOUT=* parameter on //SYSPRINT DD statement, you redirect all MVS Messages to be recorded in the logs.                  &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S18WUdF0lFI/AAAAAAAACRg/C7So7y4597o/s1600-h/Image106%5B1%5D%5B6%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Image106[1]" border="0" alt="Image106[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S18WWrkC2oI/AAAAAAAACRk/GbS2g6moyGk/Image106%5B1%5D_thumb%5B4%5D.png?imgmax=800" width="708" height="475" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-5653241501634916909?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0e178B2-Upmx0k4Tc13bHfEsTy0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0e178B2-Upmx0k4Tc13bHfEsTy0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0e178B2-Upmx0k4Tc13bHfEsTy0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0e178B2-Upmx0k4Tc13bHfEsTy0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/vaKf0gcHuBk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/5653241501634916909/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2010/01/basic-framework-of-jcl.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5653241501634916909?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5653241501634916909?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/vaKf0gcHuBk/basic-framework-of-jcl.html" title="Basic Framework of JCL" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2010/01/basic-framework-of-jcl.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkQDSH4zeCp7ImA9WxBXEEk.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-4428497597039494390</id><published>2010-01-21T10:02:00.001+05:30</published><updated>2010-01-21T10:02:59.080+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-21T10:02:59.080+05:30</app:edited><title>The Structure of JCL</title><content type="html">&lt;br /&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. What is Job Control Language?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;Job Control Language(JCL) is used to tell the computer what programs to run, which files these programs will use, to read input data and write output data.&amp;#160; &lt;br /&gt;            &lt;br /&gt;Mainframes are different from your Windows PC, where you give an input command, and the computer&amp;#160; produces some output, then you give some more input, the computer produces another output and so on, this interactive input-process-output cycle continues, until all the processing is done and your task is completed. On the Windows PC, programs run in an online interactive mode. Generally there is only 1 user to a PC, and it provides immediate response(output) to a user Input.             &lt;br /&gt;            &lt;br /&gt;On the other hand, millions of people send request, feed inputs to a Mainframe. Thus, Mainframes don’t like to talk to people interactively. Instead, Mainframes process your data in &lt;strong&gt;Batch Mode&lt;/strong&gt;.&amp;#160; &lt;br /&gt;            &lt;br /&gt;&lt;strong&gt;Batch Mode&lt;/strong&gt; means, that you need to tell the Mainframe, right at the start, what is the program you want to run, in which file the input data is stored, what will be the output files, everything right at the beginning, even before the Mainframe starts with your task. Specify the program, the input source files, the output destination files, before the program commences to run.             &lt;br /&gt;            &lt;br /&gt;Once the Mainframe &lt;u&gt;knows all the details about your task&lt;/u&gt; – Program to be run, Input files, Output files(to store results), error files etc., it accepts the task.&amp;#160; The task may take an indefinite amount of time to complete, the Mainframe schedules the task for a particular time, depending on which time-slot is available. Just like you, there would be millions of other guys, whose tasks have to be completed. On Mainframes, you would not get immediate output results(immediate service) on the spur of the moment(on the go). Instead, the Mainframe performs the task as per its convenience, and notifies you, alerts you, once your task is completed.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Isn’t TSO/ISPF interactive? I give some input, and it immediately displays some output screen.&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;You might be tempted to think so, because you used TSO to deal interactively with a Mainframe via a 3270 terminal or PC. However, what you need to realize, is that, &lt;u&gt;TSO itself is a program that’s being run on the Mainframe&lt;/u&gt;. It’s actually a Giant Word-Processor, that lets you key in(type in) your programs and Job Control Language into the computer. It actually converts your programs and JCL, into machine-readable form, an internal format which the MVS Operating System can understand. Thus, &lt;u&gt;TSO is just a messenger/carrier to the MVS Operating System&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;If you want to talk to the MVS Operating System, your messages, instructions or commands must be in a language called Job Control Language(JCL). &lt;u&gt;JCL is the only way to talk and give instructions to the MVS Operating System&lt;/u&gt;! &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. How does JCL execute Programs?&lt;/font&gt;&amp;#160;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;A Program is sequence of instructions to the computer, that performs some task/function. A Program is usually written in a High-Level language like Assembler, COBOL, PL/I, C, C++, Java etc. Your program statements are then translated into binary machine language, which IBM Mainframes understand. These machine language programs are stored as members in Partitioned datasets. The Partitioned Dataset(PDS), whose members are Machine Language Programs is called &lt;u&gt;Load Module Library&lt;/u&gt;, and each such binary program, or member is called &lt;u&gt;Load Module&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;To execute a program, you specify which Load Module, and load library in the JCL.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How does MVS Operating System think about Programs?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;MVS Operating system doesn’t know about the internals of your COBOL Program. It simply looks at it as a Black-box, which expects some inputs and produces some outputs(without bothering about what’s there inside the box).            &lt;br /&gt;            &lt;br /&gt;Just as you write your own COBOL Programs, to perform some tasks, IBM provides some pre-written ready-made programs, that you can directly lift and use in order to perform some common, basic functionalities. For example, when YOU want to create a copy of a file, you want to sort the contents of a file, there are ready-made programs supplied by IBM, which can do these tasks for you. Such pre-written, ready-to-use programs shipped along with Mainframe computers are called &lt;u&gt;Utility Programs&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;One of the ready-made utility programs provided by IBM is &lt;u&gt;IEBGENER&lt;/u&gt;. &lt;u&gt;IEBGENER&lt;/u&gt; is used to copy the contents of one file to another. It basically creates a shadow copy of a file. &lt;/font&gt;            &lt;br /&gt;            &lt;br /&gt;All COBOL programs(whether your own program, or pre-written &amp;amp; ready-made utility) refer to the input and output files that they access, not by the actual(physical) file name, but using a short &lt;u&gt;symbolic name&lt;/u&gt;. The short (alias) symbolic name merely refers to the actual file name values. Through JCL, you will be attaching the actual physical file-names to the symbols.&amp;#160; &lt;br /&gt;            &lt;br /&gt;The IBM Utility – IEBGENER expects 4 files :             &lt;br /&gt;&lt;strong&gt;Symbolic file name&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;Description              &lt;br /&gt;&lt;/strong&gt;1. &lt;strong&gt;SYSUT1&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Where IEBGENER expects to read Input Data             &lt;br /&gt;2. &lt;strong&gt;SYSUT2&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Where IEBGENER expects to write Output Data             &lt;br /&gt;3. &lt;strong&gt;SYSIN&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Where IEBGENER expects to receive any special and optional instructions             &lt;br /&gt;4. &lt;strong&gt;SYSPRINT&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Where IEBGENER expects to write a simple report, about the task it’s done for you, whether it got completed successfully or not, and much more.             &lt;br /&gt;            &lt;br /&gt;Thus, &lt;strong&gt;IEBGENER &lt;/strong&gt;reads input from //SYSUT1 file, and copies it to //SYSUT2 file. It is a simple copy utility.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S1fY41xkV1I/AAAAAAAAB-I/YuaigTXENnQ/s1600-h/Image9714.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image97[1]" border="0" alt="Image97[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S1fY6OVpdHI/AAAAAAAAB-M/7m91D1MdHg0/Image971_thumb2.png?imgmax=800" width="720" height="357" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. What are the different statement types in JCL?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;JCL is very simple and easy to master. There are only eight different JCL statement Types. JCL is is actually a piece of cake, because you use only three of these JCL statements most often – JOB, EXEC and DD.            &lt;br /&gt;            &lt;br /&gt;You’ll use these very often!            &lt;br /&gt;            &lt;br /&gt;            &lt;table border="1" cellspacing="0" cellpadding="2" width="796"&gt;&lt;tbody&gt;               &lt;tr&gt;                 &lt;td valign="top" width="116"&gt;//name&lt;/td&gt;                  &lt;td valign="top" width="100"&gt;&lt;strong&gt;JOB&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="579"&gt;parameters ...&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="116"&gt;//name &lt;/td&gt;                  &lt;td valign="top" width="100"&gt;&lt;strong&gt;EXEC&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="579"&gt;parameters ...&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="116"&gt;//name&lt;/td&gt;                  &lt;td valign="top" width="100"&gt;&lt;strong&gt;DD&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="579"&gt;parameters ...&lt;/td&gt;               &lt;/tr&gt;             &lt;/tbody&gt;&lt;/table&gt;            &lt;br /&gt;You’ll use these to “gift-wrap” and pack your JCLs into PROCs            &lt;br /&gt;            &lt;br /&gt;            &lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;               &lt;tr&gt;                 &lt;td valign="top" width="114"&gt;//name&lt;/td&gt;                  &lt;td valign="top" width="102"&gt;&lt;strong&gt;PROC&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="582"&gt;parameters ...&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="114"&gt;//name&lt;/td&gt;                  &lt;td valign="top" width="102"&gt;&lt;strong&gt;PEND&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="582"&gt;parameters ...&lt;/td&gt;               &lt;/tr&gt;             &lt;/tbody&gt;&lt;/table&gt;            &lt;br /&gt;These are [optional] -             &lt;br /&gt;            &lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;               &lt;tr&gt;                 &lt;td valign="top" width="112"&gt;//*&lt;/td&gt;                  &lt;td valign="top" width="688"&gt;comment&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="112"&gt;/*&lt;/td&gt;                  &lt;td valign="top" width="688"&gt;delimiter&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="112"&gt;//&lt;/td&gt;                  &lt;td valign="top" width="688"&gt;null ending statement&lt;/td&gt;               &lt;/tr&gt;             &lt;/tbody&gt;&lt;/table&gt;         &lt;/font&gt;          &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;Now, I shall focus mostly on the 3 important statement types – JOB, EXEC and DD first, so that you can start to write JCL’s and become productive soon. In the later course of this tutorial, I shall also explain to you how to pack JCLs into Procedures using PROC and PEND.           &lt;br /&gt;            &lt;br /&gt;The next figure shows how I use JOB, EXEC and DD Statements to copy a file using IEBGENER Program. Below you shall find a stripped down, bare-bones version of the same.            &lt;br /&gt;            &lt;br /&gt;General format:            &lt;br /&gt;            &lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;               &lt;tr&gt;                 &lt;td valign="top" width="140"&gt;//AGY0157A&lt;/td&gt;                  &lt;td valign="top" width="160"&gt;&lt;strong&gt;JOB&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="498"&gt;parameters..&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="140"&gt;//*&lt;/td&gt;                  &lt;td valign="top" width="160"&gt;&amp;#160;&lt;/td&gt;                  &lt;td valign="top" width="498"&gt;&amp;#160;&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="140"&gt;//STEP01&lt;/td&gt;                  &lt;td valign="top" width="160"&gt;&lt;strong&gt;EXEC&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="498"&gt;parameters..&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="140"&gt;//SYSUT1&lt;/td&gt;                  &lt;td valign="top" width="160"&gt;&lt;strong&gt;DD&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="498"&gt;parameters..&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="140"&gt;//SYSUT2&lt;/td&gt;                  &lt;td valign="top" width="160"&gt;&lt;strong&gt;DD&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="498"&gt;parameters..&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="140"&gt;//SYSPRINT&lt;/td&gt;                  &lt;td valign="top" width="160"&gt;&lt;strong&gt;DD&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="498"&gt;parameters..&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="140"&gt;//SYSIN&lt;/td&gt;                  &lt;td valign="top" width="160"&gt;&lt;strong&gt;DD&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="498"&gt;parameters..&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="140"&gt;//&lt;/td&gt;                  &lt;td valign="top" width="160"&gt;&amp;#160;&lt;/td&gt;                  &lt;td valign="top" width="498"&gt;&amp;#160;&lt;/td&gt;               &lt;/tr&gt;             &lt;/tbody&gt;&lt;/table&gt;         &lt;/font&gt;          &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;I hope you recognized this pattern – JOB, EXEC followed by one or more DD Statements. The JCL for all you Batch Jobs will start with one JOB Statement. Following this, the &lt;strong&gt;EXEC &lt;/strong&gt;statement tells which program to run. And, then you code several &lt;strong&gt;DD(&lt;/strong&gt;&lt;em&gt;Data Device&lt;/em&gt;&lt;strong&gt;) &lt;/strong&gt;statements, for specifying the input and output files being used by the program. The DD Statement, would assign a symbolic name to an actual dataset name.             &lt;br /&gt;            &lt;br /&gt;Given below is the JCL that executes the IEBGENER Program to copy the contents of the Physical sequential(PS) file AGY0157.INPUT.DATA to AGY0157.OUTPUT.DATA.            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S1fY797Q5qI/AAAAAAAAB-Q/z1VQHfgZnpw/s1600-h/Image98%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image98[1]" border="0" alt="Image98[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S1fY-Dj3hgI/AAAAAAAAB-U/QJffyuo8WmA/Image98%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="780" height="335" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-4428497597039494390?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xXNbSk8n6XBAe5PFVbvK4G1esrU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xXNbSk8n6XBAe5PFVbvK4G1esrU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xXNbSk8n6XBAe5PFVbvK4G1esrU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xXNbSk8n6XBAe5PFVbvK4G1esrU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/XWArtDeed-8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/4428497597039494390/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2010/01/structure-of-jcl.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/4428497597039494390?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/4428497597039494390?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/XWArtDeed-8/structure-of-jcl.html" title="The Structure of JCL" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2010/01/structure-of-jcl.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIBQnoyfSp7ImA9WxBQF00.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-7429307483241609443</id><published>2010-01-16T01:50:00.001+05:30</published><updated>2010-01-17T10:32:33.495+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-17T10:32:33.495+05:30</app:edited><title>Mainframe Information Representation and Storage</title><content type="html">&lt;br /&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How do Mainframe Computers store Data?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;On computers, data is stored in the form of bits - 0’s and 1’s(binary). Characters like A,B,C,...,Z are formed with 8 bits called as Bytes. When you press a key on the keyboard, the key emits out eight bits from the cable.            &lt;br /&gt;            &lt;br /&gt;Every key is represented with a unique combination of 0s and 1s. Because, we use 8 bits to store a character, a total of 2^8 = 256 patterns are possible. IBM Mainframe’s designers assigned a unique 8-bit pattern to each character. This scheme of representing characters and data in Mainframe Computers is called &lt;u&gt;Extended Binary Coded Decimal Interchange Code(EBCDIC)&lt;/u&gt;.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What are Fields, Records, Files and Datasets?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;Data such as Customer Name, Customer Address, Phone-numbers are nothing but, just a sequence or group of characters. A group of characters that represent a data-item is called a &lt;u&gt;Field&lt;/u&gt;. For example, Customer-name is one field, Customer Address is another such field and so on.             &lt;br /&gt;            &lt;br /&gt;When you group fields like Customer’s name, address and phone-number together, to represent all the information about 1 single customer, it is called a &lt;u&gt;Record&lt;/u&gt;. A record can contain of any number of fields. Thus, you can have a record which 100 bytes long, 200 bytes long,..., but records of length 80-byte are common in Mainframes, as in early, input data was fed to Mainframes using Punched Cards which had 80-columns.             &lt;br /&gt;            &lt;br /&gt;When you store a group of records, say 1000 customer records of a Bank, it is called a &lt;u&gt;File&lt;/u&gt;. A File is then, just a sequence of records.             &lt;br /&gt;            &lt;br /&gt;IBM Mainframes use the term &lt;u&gt;Dataset&lt;/u&gt; instead of &lt;u&gt;File&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;Generally, Datasets(Files) are stored on Computer Storage Devices. In Mainframes, there are two popular storage devices – &lt;u&gt;Disk&lt;/u&gt; and &lt;u&gt;Tape&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S1DN8bQ306I/AAAAAAAAB3s/-r-Vnnt9oZI/s1600-h/Image8115.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image81[1]" border="0" alt="Image81[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S1DN98mXtAI/AAAAAAAAB3w/qBfiFkUeZFc/Image811_thumb3.png?imgmax=800" width="764" height="691" /&gt;&lt;/a&gt;             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;u&gt;INFORMATION STORAGE HIERARCHY              &lt;br /&gt;&lt;/u&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How do you form Dataset Names?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;In a Mainframe computer, there would be thousands of files(datasets). It is obvious, to name each &lt;u&gt;Dataset&lt;/u&gt; differently. Mainframes support very large dataset names. In Mainframes, a dataset name can be 44 characters long in this format :             &lt;br /&gt;XXXXXXXX.XXXXXXXX.XXXXXXXX.XXXXXXXX.XXXXXXXX             &lt;br /&gt;            &lt;br /&gt;You can form a dataset name by taking groups of upto 8 characters. Each of the group must start with a capital letter(alphabet).             &lt;br /&gt;            &lt;br /&gt;Generally, it is a good practice to give meaningful names to your dataset. For example, if you are storing Employees data in a file, you can name it as EMPLOYEE.DATA             &lt;br /&gt;            &lt;br /&gt;The MVS Operating System keeps track of groups of datasets by referring to their names, which are called &lt;u&gt;Qualifiers&lt;/u&gt;. The first part of the dataset name is called &lt;u&gt;High-level Qualifier(HLQ)&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;Generally, when you access or log-in to Mainframes, you are given a USER-ID, just as on Windows PC, you need a userid to login. Most professionals or software engineers who work in Mainframe Projects would have a TSO user-ID. &lt;strong&gt;When you use a TSO-id, a special requirement applies to most datasets(files) that belong to you.&lt;/strong&gt;             &lt;br /&gt;            &lt;br /&gt;Suppose your TSO-id is AGY0157, then all your datasets should have the High-level qualifier AGY0157. Thus, the files that belong to you should start with AGY0157. For example, the name of Employees file would be             &lt;br /&gt;            &lt;br /&gt;AGY0157.EMPLOYEE.DATA             &lt;br /&gt;            &lt;br /&gt;You must understand that, mostly in projects, you can identify the files that belong to you, your application or your system by seeing the High-level Qualifier.             &lt;br /&gt;            &lt;br /&gt;In fact, Mainframes are also installed with Security Software(like RACF), that controls access to files by seeing the High-Level Qualifiers. Thus, although you can see your buddy’s files on a Mainframe, you cannot make any changes to it. &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What are Sequential Datasets?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;You can think of sequential datasets as a Music cassette, on which music songs are stored one after the other. When you play the cassette, you listen to the music, one song and then the next song and so on.. till you reach the end of the cassette. You cannot directly jump to, or fly to the 5th song, or last song. Thus, a music cassette is accessed sequentially.            &lt;br /&gt;            &lt;br /&gt;On the same lines, records in Sequential files are stored after the other in a series. In a sequential file, you need to read through all the records one by one, step-by-step till you reach the desired record.             &lt;br /&gt;            &lt;br /&gt;Thus, a sequential dataset is the simplest form of dataset. In Mainframes MVS Operating System, sequential dataset is known as &lt;u&gt;PS Dataset&lt;/u&gt;, PS stands for &lt;u&gt;Physical Sequential&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S1DN-z9_sLI/AAAAAAAAB30/xdITMG2OtBM/s1600-h/Image83%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Image83[1]" border="0" alt="Image83[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S1DOANoICPI/AAAAAAAAB34/Ddg44sOnCXU/Image83%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="307" height="307" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How do you create a file in ISPF? &lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;ISPF organises most common functionalities that you need to perform on Mainframes – like &lt;u&gt;creating a new file/folder&lt;/u&gt;, &lt;u&gt;editing a file&lt;/u&gt;, &lt;u&gt;searching for files&lt;/u&gt;, &lt;u&gt;taking backup&lt;/u&gt; etc. in the form of menus, just like a Nokia Cellular Phone.             &lt;br /&gt;            &lt;br /&gt;To create a new file, you have to go to the menu 3.2 in ISPF. You enter the dataset name here on ISPF Screen.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S1DOB6v1ZFI/AAAAAAAAB38/qH8l1Q8BhUo/s1600-h/Image82%5B1%5D%5B7%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image82[1]" border="0" alt="Image82[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S1DOD6WhoGI/AAAAAAAAB4A/SOyXL8YmYBs/Image82%5B1%5D_thumb%5B5%5D.png?imgmax=800" width="771" height="441" /&gt;&lt;/a&gt;&amp;#160;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What is a Partitioned Dataset(PDS)?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;When you create a sequential dataset(PS), it occupies a large amount of storage space(minimum 50,000 bytes). Sometimes for doing trivial tasks,&amp;#160; storing only a few records, you would not be utilising the entire space available in a sequential file. Thus most of the space in the Sequential file is wasted and is blocked.            &lt;br /&gt;            &lt;br /&gt;IBM provides a way to split or &lt;u&gt;partition&lt;/u&gt; up the space in a sequential data-set. IBM Software engineers invented the &lt;u&gt;Partitioned Dataset&lt;/u&gt;, often called PDS. Each part is called a &lt;u&gt;Member&lt;/u&gt;. A &lt;u&gt;Partitioned Dataset&lt;/u&gt; can have many &lt;u&gt;members&lt;/u&gt;(parts). Each member behaves like a sequential file on it own.             &lt;br /&gt;            &lt;br /&gt;How does the PDS then keep track of its members? A Partitioned Dataset(PDS) includes a &lt;u&gt;directory&lt;/u&gt;(like a telephone directory), which is a diary or journal, where MVS Operating system keeps track of the members in a PDS. The members of a PDS can be scattered haphazardly anywhere in the vast computer storage space. Well-then, you consult the directory to find out the members in the PDS. Just like in a book, the index tells you, the keyword you are looking for, and the page no. where it can be found, the same way, the directory tells you the member name, and the computer memory address where you can find it. Thus, the directory maintains the list of member-names and pointers to the actual physical place in Computer Memory where they are stored.             &lt;br /&gt;            &lt;br /&gt;Not just this, but the directory also keeps track of its statistics, like when each member was created, when was it last changed/viewed by somebody, how much space it occupies, which TSO-userid created it and bla bla..             &lt;br /&gt;            &lt;br /&gt;On the Windows Operating System, we generally keep related files together in a folder. On the same lines, you keep related members together in one PDS. Thus, &lt;u&gt;a Partitioned Dataset is Mainframes-counterpart of Folders on Windows Operating System&lt;/u&gt;. Folders contain many related files. A PDS contains many related members.             &lt;br /&gt;            &lt;br /&gt;When create this special type of partitioned sequential file – Partitioned Dataset, you need to decide, how big its directory is going to be. The bigger the directory, the more no. of partitions(members) it will support. You express this in terms of &lt;u&gt;Directory Blocks&lt;/u&gt;. Generally, 1 directory block can store information about 5 members. The directory always remains fixed, can’t grow bigger on the fly, so you need to careful when specifying the directory blocks, and you have to do it in advance.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S1FvPaCDORI/AAAAAAAAB4o/ObHZ3MqhGwc/s1600-h/Image84%5B1%5D%5B6%5D.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Image84[1]" border="0" alt="Image84[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S1FvRBbo9qI/AAAAAAAAB4s/5Rbsxy3kzjk/Image84%5B1%5D_thumb%5B4%5D.png?imgmax=800" width="476" height="476" /&gt;&lt;/a&gt;&lt;/font&gt;           &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;To sum up, a &lt;u&gt;Partitioned Dataset(PDS)&lt;/u&gt; is a specialised type of sequential file, which is divided into members, each member being a sequential dataset by itself. Thus, a PDS acts like a library which houses several related files.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. While creating a new file in ISPF, how do I specify whether is Sequential file(PS), or a Partitioned Dataset(PDS)?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;A sequential PS File doesn’t have any partitions or members(0 members). So, it doesn’t have a directory to look upto. Thus, the space allocated to a directory, in terms of &lt;u&gt;Directory Blocks&lt;/u&gt; for a Sequential PS File is 0.             &lt;br /&gt;            &lt;br /&gt;On the other hand, for Partitioned Dataset(PDS), it can contain 1 or more members. So, it needs a directory to record the whereabouts(location) of its members, which are scattered throughout the memory randomly. You need to allocate space in terms of &lt;u&gt;Directory Blocks&lt;/u&gt; to a Directory in Partitioned Dataset(PDS). Thus, &lt;u&gt;Directory Blocks&lt;/u&gt; for a PDS should be some finite number, say 5 blocks, or 10 blocks.             &lt;br /&gt;            &lt;br /&gt;Suppose you are creating a new File &lt;u&gt;AGY0157.EMPLOYEE.DATA&lt;/u&gt;. You specify the Directory Blocks on the ISPF Menu 3.2 screen, as follows -             &lt;br /&gt;            &lt;br /&gt;1. If you want the file &lt;u&gt;AGY0157.EMPLOYEE.DATA&lt;/u&gt; to be a &lt;strong&gt;Physical Sequential File(PS)&lt;/strong&gt;, then fill the &lt;u&gt;Directory Blocks&lt;/u&gt; field = 0.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S1F5pSUmtbI/AAAAAAAAB48/I_fXJetcP0s/s1600-h/Image85%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image85[1]" border="0" alt="Image85[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S1F5qxkhREI/AAAAAAAAB5A/hDH6u286jXA/Image85%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="772" height="393" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;2. On the other hand, if you want the file &lt;u&gt;AGY0157.EMPLOYEE.DATA&lt;/u&gt; to be a &lt;strong&gt;Partitioned Dataset(PDS)&lt;/strong&gt;, having 1 or many members, and a directory, specify &lt;u&gt;Directory Blocks&lt;/u&gt; field = 1,2,3 or ...(any finite value) blocks. In the figure below, I have put Directory Blocks = 5 Blocks.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S1F5s8kfJ7I/AAAAAAAAB5I/ROxKpZ9lmCA/s1600-h/Image86%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image86[1]" border="0" alt="Image86[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S1F5u8UQZkI/AAAAAAAAB5M/sT-m6NZJVqQ/Image86%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="777" height="395" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How do I find the file I want on Mainframes? How do you find/list files in ISPF?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;You want to search and locate a file. Finding the file on MVS Operating System is done using, ISPF Menu 3.4, called Dataset List Utility. Go to ISPF Menu 3.4 screen, and type the name of the dataset that you want to search and hit Ctrl.            &lt;br /&gt;            &lt;br /&gt;For example, if you want to search for the file AGY0157.EMPLOYEE.DATA, then type AGY0157.EMPLOYEE.DATA in Dsname field.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S1GGITVHE3I/AAAAAAAAB6I/IpaqAGVrUXs/s1600-h/Image87%5B1%5D%5B6%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image87[1]" border="0" alt="Image87[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S1GGKvbO-XI/AAAAAAAAB6M/kBmqmbEPm6k/Image87%5B1%5D_thumb%5B4%5D.png?imgmax=800" width="759" height="386" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;Upon hitting the Ctrl button, you would find list of files displayed before. Note that, Dataset List Utility(DSLIST) works by searching for all files that match a pattern. So, when you type AGY0157.EMPLOYEE.DATA, what you actually specify is a pattern.             &lt;br /&gt;            &lt;br /&gt;All files matching this pattern will be displayed. So, if there is a file – AGY0157.EMPLOYEE.DATA.MASTER, it also matches the pattern. Thus, it will also be listed.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S1GGMISqqZI/AAAAAAAAB6Q/C8qmqPogij0/s1600-h/Image88%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image88[1]" border="0" alt="Image88[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S1GGNgDODII/AAAAAAAAB6U/XVlLiSdz1as/Image88%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="773" height="380" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;In fact, if you don’t know the exact name of your file, you can just specify the pattern followed by a wild-card. Say, for example, if you want to search for all the files starting with AGY0157.DEMO.something, then you can specify it as AGY0157.DEMO.*             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S1GGOyvg2bI/AAAAAAAAB6Y/imw0w7NYE4M/s1600-h/Image89%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image89[1]" border="0" alt="Image89[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S1GGQyimQPI/AAAAAAAAB6c/6Gn7azOr_eE/Image89%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="765" height="386" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;When you hit Ctrl, you would get the list of all datasets(files), whose names start with AGY0157.DEMO.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S1GGR84Bu4I/AAAAAAAAB6g/KkRWzcGtATI/s1600-h/Image90%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image90[1]" border="0" alt="Image90[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S1GGTv5gR1I/AAAAAAAAB6k/07jTgQHV1-0/Image90%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="767" height="377" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What if the file is Partitioned Dataset? How do you search the directory for the members in the PDS Library?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;To see the directory of a PDS Library, you need to type M against the name of the Partitioned Dataset(PDS). The M Command tells the MVS Operating System to display the directory of the Partitioned Dataset(PDS).            &lt;br /&gt;            &lt;br /&gt;Suppose, you want to see the directory(List of all the members) of the Partitioned Dataset(Library) &lt;strong&gt;AGY0157.DEMO.SRCLIB.&lt;/strong&gt; Then, type an M against its name in the DSLIST Utility ISPF Menu 3.4 screen.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S1GZuVRgrEI/AAAAAAAAB60/NHf87YDBRiw/s1600-h/Image91%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image91[1]" border="0" alt="Image91[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S1GZwfcq0JI/AAAAAAAAB64/gvG_b_pboog/Image91%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="769" height="372" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;Upon hitting the Ctrl Button, you get to see the directory of the Partitioned Dataset(PDS) AGY0157.DEMO.SRCLIB – you can see the entire list of members in the PDS.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S1GZx-3L1FI/AAAAAAAAB68/aNZIu2tP0gQ/s1600-h/Image92%5B1%5D%5B6%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image92[1]" border="0" alt="Image92[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S1GZ0CeKNbI/AAAAAAAAB7A/NkymD6KW5-U/Image92%5B1%5D_thumb%5B4%5D.png?imgmax=800" width="773" height="377" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;Generally, you will keep your program, jobs, REXX scripts assorted in Libraries or Partitioned Datasets(PDS). Here, I have stored all my COBOL Programs in this library.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How do code member names of a Partitioned Dataset in JCL?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;To refer to a member of a Partitioned Dataset in JCL, you code the dataset name with the member name in parenthesis. Here, is how you code my dataset name in JCL, when I have to refer to a job named PROGRAM1 in my SRCLIB (Source Library).            &lt;br /&gt;            &lt;br /&gt;AGY0157.DEMO.SRCLIB(PROGRAM1)&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How do you store some data in file? How do open and edit the contents of a file?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;In the next few tutorials, I’ll show you how to use JCL to run programs, read file, send output to printer, create and delete files. But, before this you need to key in some data into your computer system. This data consists of 80-byte records.            &lt;br /&gt;            &lt;br /&gt;After creating a file, you need to an ‘E’ against the file-name to edit the file. Let’s assume that you wanted to key in Employee Data in Physical Sequential file – AGY0157.EMPLOYEE.DATA. Here goes. After you’ve found the file using ISPF Dataset List Utility 3.4, just type E against that dataset, and hit Ctrl.            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S1KZuvvsCsI/AAAAAAAAB8E/t2D1vJhY1wE/s1600-h/Image93%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image93[1]" border="0" alt="Image93[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S1KZxN2tYPI/AAAAAAAAB8I/ec647AVdLlg/Image93%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="770" height="392" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;Just as on Windows, the default editor in Notepad, typing E against the dataset name, causes the file &lt;strong&gt;AGY0157.EMPLOYEE.DATA&lt;/strong&gt; to open in the &lt;u&gt;editing mode&lt;/u&gt;. The &lt;u&gt;editing mode&lt;/u&gt; allows you to change the contents of the file – add new data, modify the data, or delete the data. On the other hand, you can also open the file in &lt;u&gt;View Mode&lt;/u&gt; (type V) or &lt;u&gt;Browse Mode&lt;/u&gt; (type B). View Mode or Browse mode is a read-only mode(You cannot change the contents).             &lt;br /&gt;            &lt;br /&gt;Generally, when you open Production Files(Files which are being used, when the Mainframe application is running live), it’s always a good practice to open them in read-only mode.            &lt;br /&gt;            &lt;br /&gt;Initially, the file AGY0157.EMPLOYEE.DATA is empty. When you open it, in &lt;u&gt;Editing mode&lt;/u&gt;, it looks like this -             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S1KZyS7ABbI/AAAAAAAAB8Q/wSyn6llsr10/s1600-h/Image94%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image94[1]" border="0" alt="Image94[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S1KZ0WSw-6I/AAAAAAAAB8U/BcsR7XaawJU/Image94%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="767" height="380" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;You can now key in your data in the file, and save it by typing the SAVE Command on the command line field.            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S1KZ2h22zLI/AAAAAAAAB8Y/gKX_UlBZHmg/s1600-h/Image95%5B1%5D%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image95[1]" border="0" alt="Image95[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S1KZ5Lk1tEI/AAAAAAAAB8c/z3S6jA7jNpk/Image95%5B1%5D_thumb%5B3%5D.png?imgmax=800" width="768" height="375" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-7429307483241609443?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/TMhMhD93Z3o7PjhvNX7EM4cnCQA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TMhMhD93Z3o7PjhvNX7EM4cnCQA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/TMhMhD93Z3o7PjhvNX7EM4cnCQA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TMhMhD93Z3o7PjhvNX7EM4cnCQA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/GNoqa9z_VjI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/7429307483241609443/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2010/01/mainframe-information-representation.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/7429307483241609443?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/7429307483241609443?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/GNoqa9z_VjI/mainframe-information-representation.html" title="Mainframe Information Representation and Storage" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2010/01/mainframe-information-representation.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUENSXc_fSp7ImA9WxBUEEU.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-8084775156659500697</id><published>2010-01-15T22:57:00.001+05:30</published><updated>2010-02-25T13:11:38.945+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-25T13:11:38.945+05:30</app:edited><title>What on Earth is a Mainframe</title><content type="html">&lt;br /&gt;  &lt;table border="1" cellspacing="0" cellpadding="0" width="640"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="406"&gt;         &lt;p&gt;&lt;b&gt;&lt;font face="Courier New"&gt;Tutorial Name&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="232"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Download Links&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="406"&gt;         &lt;p&gt;&lt;font face="Courier New"&gt;&lt;a href="http://www.mainframes360.com/2009/06/what-is-mainframe-computer.html"&gt;Introduction to Mainframes&lt;/a&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;              &lt;br /&gt;- What is a Mainframe?               &lt;br /&gt;- How did IBM Mainframe Machines evolve?               &lt;br /&gt;- What does a Mainframe Computer look like?               &lt;br /&gt;- Like Windows, which is the Operating System on Mainframes?               &lt;br /&gt;- Are Mainframes faster than Supercomputers?               &lt;br /&gt;- What is a Batch Job?               &lt;br /&gt;- Like Desktop, how do you interact with a Mainframe Computer?               &lt;br /&gt;- What is ISPF?&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="232"&gt;&lt;font face="Courier New"&gt;PDF            &lt;br /&gt;Word             &lt;br /&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="406"&gt;         &lt;p&gt;&lt;font face="Courier New"&gt;&lt;a href="http://www.mainframes360.com/2010/01/mainframe-information-representation.html"&gt;Mainframe Information Representation and Storage&lt;/a&gt;               &lt;br /&gt;- How do Mainframes represent data?               &lt;br /&gt;- What are fields, records, files and Datasets?               &lt;br /&gt;- How do you form File(Dataset) names?               &lt;br /&gt;- What are High-level Qualifiers?               &lt;br /&gt;- What are Sequential Files(Datasets)?               &lt;br /&gt;- What are Partitioned Datasets?               &lt;br /&gt;- Your TSO Libraries               &lt;br /&gt;- Coding Member names in JCL               &lt;br /&gt;- Storing some data in File using TSO/ISPF&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="232"&gt;&lt;font face="Courier New"&gt;PDF            &lt;br /&gt;Word&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="406"&gt;         &lt;p&gt;&lt;font face="Courier New"&gt;&lt;a href="http://www.mainframes360.com/2010/01/structure-of-jcl.html"&gt;Structure of JCL&lt;/a&gt;               &lt;br /&gt;- How does JCL Execute Programs?               &lt;br /&gt;- How MVS thinks about Programs?               &lt;br /&gt;- What are the different Statement types in JCL?&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="232"&gt;&lt;font face="Courier New"&gt;PDF            &lt;br /&gt;Word&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="406"&gt;         &lt;p&gt;&lt;font face="Courier New"&gt;&lt;a href="http://www.mainframes360.com/2010/01/basic-framework-of-jcl.html"&gt;Basic Framework of JCL&lt;/a&gt;               &lt;br /&gt;- Overview of JOB Statement               &lt;br /&gt;- Overview of EXEC Statement               &lt;br /&gt;- Overview of three kinds of DD Statements               &lt;br /&gt;- Common JCL Error : Using Column 72               &lt;br /&gt;- Summary of Coding Rules for JCL Statements               &lt;br /&gt;- Misspelling a JCL Statement Type               &lt;br /&gt;- JOB ABEND(Abnormal End Processing)&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="232"&gt;&lt;font face="Courier New"&gt;PDF            &lt;br /&gt;Word&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="406"&gt;         &lt;p&gt;&lt;font face="Courier New"&gt;&lt;a href="http://www.mainframes360.com/2010/02/multi-step-job-streams.html"&gt;Multi-step Job Streams&lt;/a&gt;               &lt;br /&gt;- JCL and Flowcharting               &lt;br /&gt;- A three-step job stream               &lt;br /&gt;- Three step job stream JCL &lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="232"&gt;&lt;font face="Courier New"&gt;PDF            &lt;br /&gt;Word&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="406"&gt;         &lt;p&gt;&lt;font face="Courier New"&gt;&lt;a href="http://www.mainframes360.com/2010/02/submitting-job.html"&gt;Submitting a Job&lt;/a&gt;              &lt;br /&gt;- SUBMIT Command              &lt;br /&gt;- Input Queue, Spool and SDSF&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="232"&gt;&lt;font face="Courier New"&gt;PDF            &lt;br /&gt;Word&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-8084775156659500697?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/kkA1vQi0pVeD0ncIcwyHTOK9ULU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kkA1vQi0pVeD0ncIcwyHTOK9ULU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/kkA1vQi0pVeD0ncIcwyHTOK9ULU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kkA1vQi0pVeD0ncIcwyHTOK9ULU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/b_7kqWrczfM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/8084775156659500697/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2010/01/what-on-earth-is-mainframe.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/8084775156659500697?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/8084775156659500697?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/b_7kqWrczfM/what-on-earth-is-mainframe.html" title="What on Earth is a Mainframe" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.mainframes360.com/2010/01/what-on-earth-is-mainframe.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08BQH8yeSp7ImA9WxBQFEg.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-1602982342992249804</id><published>2010-01-14T14:34:00.001+05:30</published><updated>2010-01-14T14:34:11.191+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-14T14:34:11.191+05:30</app:edited><title>Table Handling</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. What is table in COBOL? How do you define a Table?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;In COBOL, you’ve learnt how to store a simple integer number, real number, text-strings etc. in Computer Memory. A simple variable can hold only &lt;i&gt;one&lt;/i&gt;, &lt;i&gt;single&lt;/i&gt; data-item. For example, a PIC X(10) variable can store the text-string ‘HELLOWORLD’, a PIC 9(03) variable&lt;b&gt; &lt;/b&gt;can store the integer number 125, and so on.&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;However, in your day-to-day life, you often come across a list of items, say your shopping list, your phone-book(list of contacts), your favourite books(list of books) etc. What if, you want to store a list of data-items in Computer Memory? Say, for example like a collection of 5 PIC X(10) text-string’s, or 100 PIC 9(03) numbers.&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;&lt;b&gt;Table can be used to store a list of data-items. &lt;/b&gt;An table is a list, a collection of similar data-items. So, &lt;i&gt;Tables store multiple data-items of the same type&lt;/i&gt;. Take data-items, which are logically-related to each other, and put them together, in a table. For example, a table of integer numbers = {1, 2, 5, 8, -6}. Thus, in essence, a table is a set of data-items of the same type.                 &lt;br /&gt;                &lt;br /&gt;A table must be assigned a unique name. Say, for example, you can take a table, a set of PIC 9(04) numbers {1000, 2000, 5000, 8000, 6000} and assign it the name &lt;b&gt;INCOME-TABLE. &lt;/b&gt;Then INCOME-TABLE = {1000, 2000, 5000, 8000, 6000}. The table INCOME-TABLE is said to have five members – 1000, 2000, 5000, 8000 and 6000. These are called &lt;b&gt;elements of the Table&lt;/b&gt;. The number of elements in an table is called the &lt;b&gt;size of the table&lt;/b&gt;, or &lt;b&gt;table length. &lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. How do you refer to individual elements of a table?&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;Consider the table INCOME-TABLE = {1000, 2000, 5000, 8000, 6000}. You access the elements of a table, by specifying the position. The element at the 1st position is 1000, 2nd position is 2000, 3rd position is 5000 and so on... So, if you were to ask a question, “Give the element at position 4”, the answer would be 8000.             &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. Could you demonstrate via an example, how to create a simple table and retrieve data from it?&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;Suppose you want to store the names of you 5 friends in a COBOL Table. To create a table in COBOL, you must understand 3 important things -                &lt;br /&gt;                &lt;br /&gt;Q1. &lt;strong&gt;Assigning a unique name to the table                 &lt;br /&gt;&lt;/strong&gt;A. FRIENDS-TABLE is the unique name of the table                &lt;br /&gt;                &lt;br /&gt;Q2. &lt;strong&gt;What is the data being recorded in this table, and how many data-items it contains?                 &lt;br /&gt;&lt;/strong&gt;A. The data generally stored in this table represents your friends information. So the name of the record should be FRIEND-RECORD. The FRIEND-RECORD should store information about 5 friends. So, it contains 5 cells.                &lt;br /&gt;                &lt;br /&gt;3. &lt;strong&gt;What is the specification/PICTURE clause for each such data-item?                 &lt;br /&gt;&lt;/strong&gt;Each such cell contains FRIEND-NAME, which is textual-string and can be 20 characters long.                &lt;br /&gt;                &lt;br /&gt;In COBOL, you would write                &lt;br /&gt;                &lt;br /&gt;01&amp;#160; FRIENDS-TABLE                &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; 02 FRIEND-RECORD OCCURS 5 TIMES                &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 03 FRIEND-NAME PIC X(20)                &lt;br /&gt;                &lt;br /&gt;Understand that the OCCURS Clause is used to specify, how many items(cells) are contained in the record.                &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S07ddKQV2sI/AAAAAAAAB0Q/Cs9JQV0Freg/s1600-h/Image73%5B2%5D%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image73[2]" border="0" alt="Image73[2]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S07delbnG2I/AAAAAAAAB0U/p8YHYzHVTsA/Image73%5B2%5D_thumb%5B1%5D.png?imgmax=800" width="776" height="113" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;Now, you can access the elements of this table as follows :                &lt;br /&gt;                &lt;br /&gt;To access your first friend’s name, you write FRIEND-NAME(1)                &lt;br /&gt;To access your second friend’s name,you write FRIEND-NAME(2)                &lt;br /&gt;...                &lt;br /&gt;To access your fifth friend’s name, you write FRIEND-NAME(5)&lt;em&gt;                 &lt;br /&gt;                  &lt;br /&gt;&lt;/em&gt;The COBOL Definition of the above friend’s table, would look&lt;/font&gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt; like this :               &lt;br /&gt;                &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S07dfjk150I/AAAAAAAAB0Y/k5SBDx5g85o/s1600-h/Image74%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image74[1]" border="0" alt="Image74[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S07dhOWorgI/AAAAAAAAB0c/dlQMIq0O620/Image74%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="780" height="117" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;Given below is a simple COBOL Program, that shows how to store data in the Friends table, and display the contents of the table.                &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S07dizNyAfI/AAAAAAAAB0g/IPVE0ZSy-kw/s1600-h/Image75%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image75[1]" border="0" alt="Image75[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S07dkXHtzTI/AAAAAAAAB0k/Hn1ao8HwB2w/Image75%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="784" height="251" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;Upon running the above COBOL Program, you should get the following output -                 &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S07dllGHm-I/AAAAAAAAB0o/qusCu6LgfM0/s1600-h/Image76%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image76[1]" border="0" alt="Image76[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S07dm3gJW3I/AAAAAAAAB0s/7gWC4beQThY/Image76%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="782" height="163" /&gt;&lt;/a&gt; &lt;/font&gt;              &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;&lt;u&gt;&lt;em&gt;Note:&lt;/em&gt;&lt;/u&gt;&lt;/strong&gt;&lt;em&gt; Since, FRIEND-RECORD is a group consisting of only one sub-item, you can use FRIEND-RECORD and FRIEND-NAME interchangeably. Which means,                      &lt;br /&gt;FRIEND-RECORD(1) and FRIEND-NAME(1), both would work.&lt;/em&gt;&lt;/font&gt; &lt;/font&gt;&lt;/p&gt;           &lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. Can the elements of the table be more complex group-items?&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;The elements of a table can be simple data-items like a number PIC 9(04), or a text-string PIC X(10). On the other hand, they may also be complex group-data-items, like 01 EMPLOYEE item, which in turn consists of a 02 EMP-NAME PIC X(20) &lt;u&gt;text-string&lt;/u&gt; and 02 SALARY PIC 9(04) &lt;u&gt;number&lt;/u&gt;. So, you can have a table of 50 numbers, 100 text-strings or 3 employees.               &lt;br /&gt;              &lt;br /&gt;In the example, given here, I have created a table, that stores the data of 3 employees. The temporary variables defined in the Working Storage Section of the COBOL Program.               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S07doF91ieI/AAAAAAAAB0w/mYHIEfcCEc8/s1600-h/Image68%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image68[1]" border="0" alt="Image68[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S07dpQIOZeI/AAAAAAAAB00/kpn1pph7GOQ/Image68%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="779" height="198" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;Now, the table EMPLOYEE-TABLE can contain the data of 3 employees. Now, you can write a COBOL Program, to store some data in the Employee Table, and then display its contents.               &lt;br /&gt;              &lt;br /&gt;Look at the sample COBOL Program, given below.               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S07dq7NEGJI/AAAAAAAAB04/5Ejbpt9Nefc/s1600-h/Image69%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image69[1]" border="0" alt="Image69[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S07dslNspDI/AAAAAAAAB08/LOLO6DzFOfM/Image69%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="777" height="320" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;              &lt;br /&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;Upon running the above COBOL Program, you get the following output -                &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S07duLA4lnI/AAAAAAAAB1A/0wdg2CbRQNo/s1600-h/Image70%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image70[1]" border="0" alt="Image70[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S07dvcHoBxI/AAAAAAAAB1E/fnZwLDV0BaY/Image70%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="779" height="120" /&gt;&lt;/a&gt;                 &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What are two-dimensional tables? How do you create them? &lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;A table is a collection/list of data-items. Each data-item can be a simple data-item, or a complex group-item. What if the data-item is a table? Thus, you have a “Table of tables”. A 2-dimensional table looks like a matrix of cells, consisting of rows and columns. To access any cell at the intersection of a row and column, you need to know the row-no and the column-no.                &lt;br /&gt;                &lt;br /&gt;Suppose, we wish to setup a table, which will represent the below statistic. The table below gives the class-wise and year-wise breakup of the spending capacity of an Indian Household.                 &lt;br /&gt;                &lt;br /&gt;&lt;u&gt;Spending of an Average Indian Household annually in Rs.                  &lt;br /&gt;&lt;/u&gt;                &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S07dwldShRI/AAAAAAAAB1I/Ij7qASDQd3o/s1600-h/Image71%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image71[1]" border="0" alt="Image71[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S07dynpUgII/AAAAAAAAB1M/O29N0880oMg/Image71%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="534" height="154" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;                &lt;br /&gt;&lt;strong&gt;First let me show, how to create &lt;u&gt;Working-Storage definition for this table&lt;/u&gt; in COBOL. You need to create a 5 x 4 table(5 rows, each having 4 cells)                   &lt;br /&gt;&lt;/strong&gt;                &lt;br /&gt;1. You need to assign a unique name to the table, so say the name of the table is AVERAGE-INDIAN-SPEND-TABLE.                 &lt;br /&gt;                &lt;br /&gt;01&amp;#160; AVERAGE-INDIAN-SPEND-TABLE.                 &lt;br /&gt;                &lt;br /&gt;2. Next, we have collected statistics for 5 different classes. So, the table will contain 5 records – one for each class.                 &lt;br /&gt;                &lt;br /&gt;01&amp;#160; AVERAGE-INDIAN-SPEND-TABLE                 &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; 02 SOCIAL-CLASS OCCURS 5 TIMES                 &lt;br /&gt;                &lt;br /&gt;3. Next, each of the classes, Upper, Upper-Middle, Middle-Middle, Lower-Middle and Lower class give the year-wise breakup of the money spend for 4 years (2007,2008,2009,2010). So, each row contains 4 cells.                 &lt;br /&gt;                &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;01&amp;#160; AVERAGE-INDIAN-SPEND-TABLE&amp;#160; &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; 02 SOCIAL-CLASS 5 TIMES&amp;#160; &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 03 YEAR OCCURS 4 TIMES                &lt;br /&gt;                &lt;br /&gt;4. Moreover, the actual data in each cell is the money spend in Rupees. So, in general, each cell has the format PIC 9(4)V99.                 &lt;br /&gt;                &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;01&amp;#160; AVERAGE-INDIAN-SPEND-TABLE&amp;#160; &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; 02 SOCIAL-CLASS OCCURS 5 TIMES&lt;/font&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 03 YEAR OCCURS 4 TIMES                 &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 04 AMOUNT&amp;#160; PIC 9(5)V99                 &lt;br /&gt;                &lt;br /&gt;In COBOL, you can in-fact go a level further, and create 3-dimensional cubes, 4,5,.. upto 7-dimensional tables as per COBOL-85 Standard.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Can you suggest any general formula for creating two-dimensional tables in COBOL?&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;Consider the following working-storage definition of a table                &lt;br /&gt;                &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; 02 A OCCURS &lt;strong&gt;r&lt;/strong&gt; TIMES                 &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 03 B OCCURS &lt;strong&gt;c &lt;/strong&gt;TIMES                 &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 04 CELL PIC p (p = field size)                 &lt;br /&gt;                &lt;br /&gt;In general, the above formula holds to create a table of size r rows x c columns, where each cell has PICTURE Clause PIC P.                 &lt;br /&gt;                &lt;br /&gt;The &lt;u&gt;PICTURE&lt;/u&gt; Clause &lt;u&gt;is used at the lowest hierarchical level of a table.&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;               &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Could you show me a complete example of how to store data and retrieve data from 2-dimensional tables?&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;Let’s take the example of the AVERAGE-INDIAN-SPEND-TABLE. The COBOL Definition of this table is shown below -                &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S07dz4lGqzI/AAAAAAAAB1Q/k8JZDZJwemk/s1600-h/Image77%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image77[1]" border="0" alt="Image77[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S07d1WcNLSI/AAAAAAAAB1U/5TSAwx_1iTw/Image77%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="784" height="134" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;The below COBOL Program, shows how to fill up AVERAGE-INDIAN-SPEND-TABLE with values. You can refer to any cell of this 2-dimensional table by using (row,col). For example, to refer to the amount in 2nd row, 4th column, you would write AMOUNT(2,4).                &lt;br /&gt;                &lt;br /&gt;The COBOL Program is divided into 2 parts :-                &lt;br /&gt;1) Filling(Initialising) the Table                &lt;br /&gt;2) Displaying the contents of the Table                &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/S07d4E_8ADI/AAAAAAAAB1Y/S_XwE3728Sk/s1600-h/Image78%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image78[1]" border="0" alt="Image78[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S07d6tof-II/AAAAAAAAB1c/P2FZCyx5MyY/Image78%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="783" height="508" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;The next COBOL Paragraph displays values in the AVERAGE-INDIAN-SPEND-TABLE on the screen.                &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S07d8IKv9mI/AAAAAAAAB1g/hcWBdxPrJrQ/s1600-h/Image79%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image79[1]" border="0" alt="Image79[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S07d-u2WfaI/AAAAAAAAB1k/hASdRuJWBRI/Image79%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="785" height="232" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;Upon running the above COBOL Program, you get the contents of the table                 &lt;br /&gt;displayed on the screen.                &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S07eAAQd6jI/AAAAAAAAB1o/LFgPJzg-WBE/s1600-h/Image80%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image80[1]" border="0" alt="Image80[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S07eBxG4PeI/AAAAAAAAB1s/4xkU5iIEX8Y/Image80%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="784" height="154" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-1602982342992249804?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/T8Qd-9w7VcLACy8vufc8IZBmxy0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/T8Qd-9w7VcLACy8vufc8IZBmxy0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/T8Qd-9w7VcLACy8vufc8IZBmxy0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/T8Qd-9w7VcLACy8vufc8IZBmxy0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/v-CeNoYPNQA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/1602982342992249804/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2010/01/table-handling.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/1602982342992249804?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/1602982342992249804?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/v-CeNoYPNQA/table-handling.html" title="Table Handling" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2010/01/table-handling.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEANQn0_eyp7ImA9WxBRGE0.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-5379814269357218216</id><published>2010-01-07T01:08:00.000+05:30</published><updated>2010-01-07T01:09:53.343+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-07T01:09:53.343+05:30</app:edited><title>EVALUATE Statement – Part II</title><content type="html">&lt;br /&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. What values the Subject and Object in the EVALUATE and WHEN Clauses can take?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;In the EVALUATE Statement, the subject and object may equate to one of the below -            &lt;br /&gt;1) TRUE or FALSE – The subject or object may contain TRUE/FALSE constant. Also, if the Subject or object is condition, then its value would be either true or false.             &lt;br /&gt;            &lt;br /&gt;2) A Value – The subject or object may specify an expression(A + B – C) or variables like AGE, whose result is a definite value. Moreover, it may also specify a literal-data value directly like 35.             &lt;br /&gt;            &lt;br /&gt;3) A range of values – The object may also be specified as a range of values, for example, to specify a range or values (3,4,5,..,7), you could simply write 3 THRU 7.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. Could you explain the above idea simple and easy-to-remember example?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;Suppose you want to write a COBOL Program, to calculate your income-tax payable in India for the financial year 2009-10, as per the slab in which your income falls.           &lt;br /&gt;            &lt;br /&gt;            &lt;table border="1" cellspacing="0" cellpadding="2" width="796"&gt;&lt;tbody&gt;               &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;RATE-OF-TAX&lt;/strong&gt;                      &lt;br /&gt;&lt;/font&gt;&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;STATUS&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;&lt;strong&gt;TAX-SLAB&lt;/strong&gt;&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;0 percent&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;MALE&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;0-1,60,000&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;&amp;#160;&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;FEMALE&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;0-1,90,000&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;&amp;#160;&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;SENIOR-CITIZEN&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;0-2,40,000&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;10 percent&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;MALE&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;1,60,001-3,00,000&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;&amp;#160;&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;FEMALE&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;1,90,001-3,00,000&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;&amp;#160;&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;SENIOR-CITIZEN&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;2,40,001-3,00,000&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;20 percent&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;ANY&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;3,00,001-5,00,000&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="265"&gt;30 percent&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;ANY&lt;/td&gt;                  &lt;td valign="top" width="265"&gt;5,00,001 and above&lt;/td&gt;               &lt;/tr&gt;             &lt;/tbody&gt;&lt;/table&gt;           &lt;font size="3" face="Courier New"&gt;             &lt;br /&gt;The necessary working-storage variables for the above COBOL Program are as shown below-              &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S0Tm4r19Z_I/AAAAAAAABw0/NxShz3Q6nTE/s1600-h/Image65%5B3%5D%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image65[3]" border="0" alt="Image65[3]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S0Tm6P4c53I/AAAAAAAABw4/vGHKI7m5C5U/Image65%5B3%5D_thumb%5B1%5D.png?imgmax=800" width="786" height="193" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;The EVALUATE statement in COBOL, which calculates the Income-tax according to the above given rules, is as follows :              &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S0Tm7w-VHLI/AAAAAAAABw8/pblXJXwYT-k/s1600-h/Image66%5B2%5D%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image66[2]" border="0" alt="Image66[2]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S0Tm-WN7gSI/AAAAAAAABxA/wBLFrXVUo1k/Image66%5B2%5D_thumb%5B2%5D.png?imgmax=800" width="778" height="469" /&gt;&lt;/a&gt;              &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;                 &lt;br /&gt;In the above COBOL Program, I have assumed that the taxable income of the individual is 2.5 lacs, and she is female. 2.5 lacs salary for a female falls into the second tax slab, where the income tax rate is 10 percent. Upon running the above COBOL Program, you should get the following output :                  &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S0Tm_iiDlNI/AAAAAAAABxE/wpjbIqd2sTU/s1600-h/Image67%5B2%5D%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image67[2]" border="0" alt="Image67[2]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S0TnBZRQS5I/AAAAAAAABxI/9f9wLpmdLC4/Image67%5B2%5D_thumb%5B1%5D.png?imgmax=800" width="793" height="168" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-5379814269357218216?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/6DDldrp1KA_7rJTCXeYGyoAqRho/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6DDldrp1KA_7rJTCXeYGyoAqRho/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/6DDldrp1KA_7rJTCXeYGyoAqRho/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6DDldrp1KA_7rJTCXeYGyoAqRho/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/1uuhhIeRXCo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/5379814269357218216/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2010/01/evaluate-statement-part-ii.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5379814269357218216?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5379814269357218216?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/1uuhhIeRXCo/evaluate-statement-part-ii.html" title="EVALUATE Statement – Part II" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2010/01/evaluate-statement-part-ii.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QAQXgyfip7ImA9WxBRF0s.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-7688011046583701286</id><published>2010-01-06T12:32:00.001+05:30</published><updated>2010-01-06T12:32:20.696+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-06T12:32:20.696+05:30</app:edited><title>EVALUATE Statement – Program Flow Control</title><content type="html">&lt;table border="1" cellspacing="0" cellpadding="2" width="775"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="773"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. What is the EVALUATE Statement used for? How does it work?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="773"&gt;&lt;font size="3" face="Courier New"&gt;When there are multiple options to choose from, the &lt;u&gt;EVALUATE&lt;/u&gt; statement works best. When there are several choices to be made, IF-ELSE logic can become very complicated. To avoid writing complex nested IF Conditionals(condition-within-condition), the EVALUATE Statement can be used. The &lt;u&gt;EVALUATE&lt;/u&gt; statement is the COBOL equivalent of &lt;em&gt;switch-case&lt;/em&gt; in most conventional programming languages.             &lt;br /&gt;            &lt;br /&gt;The general format of the EVALUATE Statement is as follows :             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;Syntax:              &lt;br /&gt;&lt;/u&gt;            &lt;br /&gt;EVALUATE &amp;lt;expression&amp;gt;             &lt;br /&gt;&amp;#160;&amp;#160; WHEN condition-1             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Statement-1             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ...             &lt;br /&gt;            &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&amp;#160;&amp;#160; WHEN condition-2              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Statement-2               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ...&lt;/font&gt;             &lt;br /&gt;            &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&amp;#160;&amp;#160; WHEN OTHER              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Statement-n               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ...&lt;/font&gt;             &lt;br /&gt;END-EVALUATE             &lt;br /&gt;STATEMENT-X             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;Interpretation:              &lt;br /&gt;&lt;/u&gt;            &lt;br /&gt;The EVALUATE computes the value of the main expression.             &lt;br /&gt;            &lt;br /&gt;1. If the value satisfies condition-1, then Statement-1 is performed, and after execution, control jumps to STATEMENT-X(Outside the EVALUATE Block).             &lt;br /&gt;            &lt;br /&gt;2. Else If the value satisfies condition-2, then Statement-2 is performed, and after execution, control jumps to STATEMENT-X(Outside the EVALUATE Block).             &lt;br /&gt;            &lt;br /&gt;...             &lt;br /&gt;            &lt;br /&gt;n. If the values satisfies none of the above conditions, then by default WHEN OTHER case is executed(Statement-n), and then the control jumps to STATEMENT-X.(Outside the EVALUATE Block)             &lt;br /&gt;            &lt;br /&gt;Thus, at each level of the EVALUATE block, the condition is checked, if it holds true, the case is executed, if it doesn’t hold true, you descend to the next lower level and so on... This is called a &lt;u&gt;fall-through&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;Example:              &lt;br /&gt;              &lt;br /&gt;&lt;/u&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S0Q1IKSR7_I/AAAAAAAABv8/TpODuERPLNg/s1600-h/Image60%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image60[1]" border="0" alt="Image60[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/S0Q1K_YAstI/AAAAAAAABwA/hQgR6k_lDuw/Image60%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="773" height="379" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;Upon running the above COBOL Program, you should get the following output-             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/S0Q1MK9nshI/AAAAAAAABwE/3t7BnpaXlUI/s1600-h/Image61%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image61[1]" border="0" alt="Image61[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S0Q1OsNcYJI/AAAAAAAABwI/YXmFnOeqDus/Image61%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="764" height="105" /&gt;&lt;/a&gt;&amp;#160;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="773"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What are subjects and objects in the EVALUATE Block? How are they used?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="773"&gt;&lt;font size="3" face="Courier New"&gt;Generally, the expression being tested, specified by EVALUATE Clause is called the &lt;u&gt;subject&lt;/u&gt;. The values against which it is tested, specified by the WHEN Clause is called the &lt;u&gt;object&lt;/u&gt;. Thus, you test a &lt;u&gt;subject&lt;/u&gt; expression against an &lt;u&gt;object&lt;/u&gt; value using the EVALUATE case structure.            &lt;br /&gt;            &lt;br /&gt;The EVALUATE Block allows you to specify the multiple subjects and objects. Each subject in the EVALUATE Clause would be tested against the corresponding object-value in the WHEN Clause.            &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;Example:&lt;/u&gt;            &lt;br /&gt;Suppose you want to write a simple COBOL Program to decide the pay of an employee. The pay of the employee is calculated as per this table.            &lt;br /&gt;            &lt;br /&gt;            &lt;table border="1" cellspacing="0" cellpadding="2" width="779"&gt;&lt;tbody&gt;               &lt;tr&gt;                 &lt;td valign="top" width="619"&gt;                   &lt;p align="center"&gt;&lt;strong&gt;CONDITION                       &lt;br /&gt;DESIGNATION&amp;#160; LEVEL-OF-EXP&amp;#160; FLEXIBLE&lt;/strong&gt;&lt;/p&gt;                 &lt;/td&gt;                  &lt;td valign="top" width="159"&gt;                   &lt;p align="center"&gt;&lt;strong&gt;Salary&lt;/strong&gt;&lt;/p&gt;                 &lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="619"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ACCOUNTANT&amp;#160;&amp;#160;&amp;#160; EXPERIENCED&amp;#160;&amp;#160; WILLING-TO-TRAVEL&lt;/td&gt;                  &lt;td valign="top" width="159"&gt;2000&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="619"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ACCOUNTANT&amp;#160;&amp;#160;&amp;#160; INEXPERIENCED WANTS-TO-STAY-PUT&lt;/td&gt;                  &lt;td valign="top" width="159"&gt;1000&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="619"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; COMPUTER-SCIENTIST&amp;#160;&amp;#160; ANY&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ANY&lt;/td&gt;                  &lt;td valign="top" width="159"&gt;3000&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="619"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SYSTEMS-ANALYST&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; EXPERIENCED&amp;#160;&amp;#160; ANY&lt;/td&gt;                  &lt;td valign="top" width="159"&gt;4000&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="619"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ANY&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; EXPERIENCED&amp;#160;&amp;#160; ANY&lt;/td&gt;                  &lt;td valign="top" width="159"&gt;500&lt;/td&gt;               &lt;/tr&gt;             &lt;/tbody&gt;&lt;/table&gt;            &lt;br /&gt;There are 3 subjects that you need to evaluate in above table, to decide the salary of the employee. The variables for the above data in COBOL are as shown below:            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S0Q1RJnYKrI/AAAAAAAABwM/Zbw_DSEKi64/s1600-h/Image62%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image62[1]" border="0" alt="Image62[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/S0Q1U5wWflI/AAAAAAAABwQ/wHscTzX0ZpU/Image62%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="771" height="288" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;To calculate the salary of the employee according to the above decision chart, I have written the following code in COBOL :            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S0Q1XPi5BNI/AAAAAAAABwU/OIQ601mhXCU/s1600-h/Image63%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image63[1]" border="0" alt="Image63[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/S0Q1as7Q8yI/AAAAAAAABwY/TBeONeWKs3Y/Image63%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="773" height="376" /&gt;&lt;/a&gt;             &lt;br /&gt;Now, in the above COBOL Program, I have set ACCOUNTANT flag to true, and he is INEXPERIENCED, and wants to STAYPUT. For such a condition, the salary should be 1000. Upon running the above COBOL Program, you should get the following output :            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S0Q1cEAZpiI/AAAAAAAABwc/PFEWrEwuSt4/s1600-h/Image64%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image64[1]" border="0" alt="Image64[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S0Q1eCzk40I/AAAAAAAABwg/3EBm5iCg6ok/Image64%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="769" height="157" /&gt;&lt;/a&gt;&amp;#160;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-7688011046583701286?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/C3UjDtBhvyFD--ZZo-xtfHISq7M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/C3UjDtBhvyFD--ZZo-xtfHISq7M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/C3UjDtBhvyFD--ZZo-xtfHISq7M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/C3UjDtBhvyFD--ZZo-xtfHISq7M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/v4MltQVurgM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/7688011046583701286/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2010/01/evaluate-statement-program-flow-control.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/7688011046583701286?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/7688011046583701286?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/v4MltQVurgM/evaluate-statement-program-flow-control.html" title="EVALUATE Statement – Program Flow Control" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2010/01/evaluate-statement-program-flow-control.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEAGRnwycSp7ImA9WxBRFko.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-374220646015923599</id><published>2010-01-01T12:48:00.000+05:30</published><updated>2010-01-05T11:55:27.299+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-05T11:55:27.299+05:30</app:edited><title>Program Flow Control</title><content type="html">&lt;br /&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. What does one mean by ‘Program Flow Control’? Why is it important?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;COBOL allows programmers to write computer programs in a systematic manner. You can divide and organize your programs into &lt;u&gt;sections&lt;/u&gt; and &lt;u&gt;paragraphs&lt;/u&gt;. Each section or paragraph is dedicated to perform a specific task or function. While writing a particular section or paragraph, you can focus and put all your energy, towards the task you want to perform, without bothering about the rest of the program.             &lt;br /&gt;            &lt;br /&gt;When the control first enters into the Program, depending upon what task is to be performed, you accordingly just direct/transfer the control to the appropriate section or paragraph, jump to the relevant para. This idea is called &lt;u&gt;Program Flow Control&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;You have written the program, in a well-organised manner. If an error occurs in particular task/functionality, you only need to search and rectify the error in that section or paragraph corresponding to this functionality(You don’t need to search the whole program).             &lt;br /&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Q. How do you write SECTION’s and PARAGRAPH’s in COBOL?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;Just as DIVISION’s start in Area A(Columns 8-11), &lt;u&gt;Section names&lt;/u&gt; and &lt;u&gt;Paragraph names&lt;/u&gt; should begin in Area A. Every Section name and paragraph name should end with a period.             &lt;br /&gt;            &lt;br /&gt;Moreover, it is customary to follow a naming-convention for paragraph-names. Generally, the naming convention for COBOL Para’s used by most programmers(in different shops) is to prefix the paragraph name with a number. For example, if your program has 2 paragraphs INDIA and CHINA, then name them as 0100-INDIA and 0200-CHINA. This way, it becomes easier to identify them.             &lt;br /&gt;            &lt;br /&gt;Given below is simple example of a typical COBOL Program that is divided into two sections READ-FILE-SECTION and WRITE-FILE-SECTION, each of them containing one paragraph.             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;Example:              &lt;br /&gt;              &lt;br /&gt;&lt;/u&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/Sz2h1RW23pI/AAAAAAAABtI/x797Te0ACgI/s1600-h/Image52%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image52[1]" border="0" alt="Image52[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/Sz2h4OGG4SI/AAAAAAAABtQ/_2-4hO6xhfs/Image52%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="794" height="218" /&gt;&lt;/a&gt;             &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;             &lt;br /&gt;&lt;/font&gt;Think what if, you executed this COBOL Program. The starting point of the program is the PROCEDURE DIVISION. Each statement is executed by the computer one-by-one sequentially. It is terminated at STOP RUN. Thus, the output on the screen(SYSOUT Dataset) should be             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/Sz2h5sRQfUI/AAAAAAAABtU/zij-iWlqSvU/s1600-h/Image53%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image53[1]" border="0" alt="Image53[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/Sz2h8CSqZoI/AAAAAAAABtY/OUKbMQJ2Rm8/Image53%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="795" height="136" /&gt;&lt;/a&gt;             &lt;br /&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What is PERFORM Statement used for? How does it control the program flow?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;One of the statements in COBOL, to control the flow of the program is &lt;u&gt;PERFORM&lt;/u&gt; Statement. The PERFORM Statement basically transfers control(jumps) to the specified paragraph or section.             &lt;br /&gt;            &lt;br /&gt;The general syntax of PERFORM Statement is :             &lt;br /&gt;&lt;strong&gt;PERFORM &amp;lt;procedure-name&amp;gt;              &lt;br /&gt;              &lt;br /&gt;&lt;/strong&gt;The &lt;u&gt;procedure-name&lt;/u&gt; refers to the name of the paragraph or section that, you want jump to.             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;Example:&lt;/u&gt;             &lt;br /&gt;Consider the following COBOL Program, that consists of a 0100-MAIN-PARA and 0200-INDIA-PARA.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/Sz2h9tfdUSI/AAAAAAAABtc/eikAuf0ni-4/s1600-h/Image50%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image50[1]" border="0" alt="Image50[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/Sz2h_OUhQKI/AAAAAAAABtg/QZuNPCj973w/Image50%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="781" height="218" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;The starting point is PROCEDURE DIVISION.             &lt;br /&gt;1. The DISPLAY ‘START OF PROGRAM’ statement causes START OF PROGRAM to be displayed.             &lt;br /&gt;2. PERFORM 0200-INDIA-PARA causes transfers the control(jumps) to the 0200-INDIA-PARA. All the statements in this paragraph are executed one-by-one. DISPLAY ‘INDIA’ prints INDIA to the output. After the 0200-INDIA-PARA is complete, the control returns back to the point(0100-MAIN-PARA) from where it had left off.             &lt;br /&gt;3. The next statement DISPLAY ‘END OF PROGRAM’ causes END OF PROGRAM to be printed to the output. The program terminates at STOP RUN.             &lt;br /&gt;            &lt;br /&gt;Upon running the above COBOL Program, you should get the following output -             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/Sz2iATYCa3I/AAAAAAAABtk/6zqgg4GJ8MM/s1600-h/Image51%5B2%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image51[2]" border="0" alt="Image51[2]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/Sz2iCCAAreI/AAAAAAAABto/Exy8tc9RnsI/Image51%5B2%5D_thumb%5B1%5D.png?imgmax=800" width="794" height="126" /&gt;&lt;/a&gt;             &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;             &lt;br /&gt;The &lt;u&gt;procedure&lt;/u&gt; to which the PERFORM statement transfers control, can be a 1 single para, or multi-paragraph procedure.               &lt;br /&gt;              &lt;br /&gt;The general syntax to perform a multi-paragraph procedure is:               &lt;br /&gt;&lt;strong&gt;PERFORM paragraph-A THRU paragraph-Z                &lt;br /&gt;                &lt;br /&gt;&lt;/strong&gt;Suppose you have written a sequence of paragraphs : PARAGRAPH-A, PARAGRAPH-B, PARAGRAPH-C,...,upto PARAGRAPH-Z. The above PERFORM Statement transfers control(jumps) to the starting point – PARAGRAPH-A, then all the intermediate paragraphs B,C,D,...,Y between A to Z are also executed. Then, the last paragraph PARAGRAPH-Z is executed, before the control returns back to the point from where it had left off.               &lt;br /&gt;              &lt;br /&gt;&lt;u&gt;Example:                &lt;br /&gt;                &lt;br /&gt;&lt;/u&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/Sz2iD9n5zAI/AAAAAAAABts/nZ5y5bb_zEQ/s1600-h/Image54%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image54[1]" border="0" alt="Image54[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/Sz2iGvckNHI/AAAAAAAABtw/tqESh5ejLy4/Image54%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="784" height="348" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;Upon running the above COBOL Program, you should get the following output -               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/Sz2iH6kcQpI/AAAAAAAABt0/sMS6Jksb1-E/s1600-h/Image55%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image55[1]" border="0" alt="Image55[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/Sz2iJpnODQI/AAAAAAAABt4/0RKDxMCxQ7U/Image55%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="784" height="192" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;The PERFORM statement can also be used to execute a complete &lt;u&gt;SECTION&lt;/u&gt; consisting of several paragraphs.               &lt;br /&gt;              &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;u&gt;Example:                    &lt;br /&gt;                    &lt;br /&gt;&lt;/u&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S0La6CzSD3I/AAAAAAAABuw/fkv67qxv6GU/s1600-h/Image56%5B2%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image56[2]" border="0" alt="Image56[2]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S0LbAN0izkI/AAAAAAAABu0/KRa0QJzeeck/Image56%5B2%5D_thumb%5B2%5D.png?imgmax=800" width="791" height="329" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;Upon executing the above COBOL Code, you should get the following output -                      &lt;br /&gt;                      &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S0LbBhWNGuI/AAAAAAAABu4/0VLneRR9iS4/s1600-h/Image57%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image57[1]" border="0" alt="Image57[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S0LbFELeFrI/AAAAAAAABu8/87756ScEdHA/Image57%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="791" height="125" /&gt;&lt;/a&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;Q. Is it possible to execute a procedure repetitively over and over again? Can PERFORM statement be used to loop through a procedure?&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="800"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;PERFORM Statement can be used to execute a procedure(set of paragraphs) 1 time, 2 times, 3 times, and so on.. repetitively. Performing the same task over and over again, can be done using PERFORM Statement.                      &lt;br /&gt;                      &lt;br /&gt;When you write a PERFORM Statement to loop/repeat a task again and again, you need to specify, how many times you want to perform the task. Now, specifying how many times, you want to do something – once, twice,thrice, 5 times, 10 times... is sometimes difficult.                       &lt;br /&gt;                      &lt;br /&gt;For example, assume that you want to read data from a file.                       &lt;br /&gt;                      &lt;br /&gt;Read 1st record                      &lt;br /&gt;Read 2nd record                      &lt;br /&gt;Read 3rd record                      &lt;br /&gt;...                      &lt;br /&gt;Read last record                      &lt;br /&gt;                      &lt;br /&gt;&lt;strong&gt;To Read a record&lt;/strong&gt; is the task to be performed again and again. So, you can write a PERFORM Statement to do the task - &lt;u&gt;READ&lt;/u&gt; a record, again and again till, you reach the end of the file(all the data-records have been read).                       &lt;br /&gt;                      &lt;br /&gt;PERFORM as (i=1,2,3,..,??)&amp;#160; &lt;br /&gt;&amp;#160; READ ith record                      &lt;br /&gt;                      &lt;br /&gt;How many read’s would you do? You don’t know this upper-bound, as you don’t know the exact no. of records in the file before-hand. Instead, you could type a boundary-condition, saying that, Stop reading when you reach End-of-file.                       &lt;br /&gt;                      &lt;br /&gt;Thus, you can specify exactly how many &lt;u&gt;no. of times&lt;/u&gt; to perform a loop, or you may specify a &lt;u&gt;boundary(termination) condition&lt;/u&gt;.                      &lt;br /&gt;                      &lt;br /&gt;1. To specify the no. of times, you want to perform a loop, you use &lt;u&gt;TIMES&lt;/u&gt; option.                      &lt;br /&gt;2. To specify a boundary(termination) condition for a loop, you use &lt;u&gt;UNTIL&lt;/u&gt; option.                      &lt;br /&gt;                      &lt;br /&gt;The general syntax for the PERFORM Statement used to do a task again and again many times is,                      &lt;br /&gt;                      &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;PERFORM &amp;lt;procedure-name&amp;gt; &amp;lt;n&amp;gt; TIMES                         &lt;br /&gt;&lt;/strong&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;                                   &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;u&gt;Example-&lt;/u&gt;                        &lt;br /&gt;                        &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/S0LbIXACmII/AAAAAAAABvA/jI2ErXkHAjk/s1600-h/Image58%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image58[1]" border="0" alt="Image58[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S0LbMDcGFQI/AAAAAAAABvE/ncMIHqAeYOA/Image58%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="781" height="344" /&gt;&lt;/a&gt;                        &lt;br /&gt;                        &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;&lt;font size="3" face="Courier New"&gt;Upon executing the above COBOL Code, you should get the following output -                                    &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;                        &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/S0LbOWwVr2I/AAAAAAAABvI/NsCpCTli_qg/s1600-h/Image59%5B2%5D%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Image59[2]" border="0" alt="Image59[2]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/S0LbUPCyGlI/AAAAAAAABvM/2_3cCIw73ZM/Image59%5B2%5D_thumb%5B1%5D.png?imgmax=800" width="794" height="399" /&gt;&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-374220646015923599?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0nNKrv6zjLep3ZG8gaCcp2UKuQI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0nNKrv6zjLep3ZG8gaCcp2UKuQI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0nNKrv6zjLep3ZG8gaCcp2UKuQI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0nNKrv6zjLep3ZG8gaCcp2UKuQI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/IU9sTGDIbZk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/374220646015923599/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2010/01/program-flow-control.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/374220646015923599?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/374220646015923599?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/IU9sTGDIbZk/program-flow-control.html" title="Program Flow Control" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2010/01/program-flow-control.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkAEQ3o8eyp7ImA9WxBSGEg.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-331179397565715928</id><published>2009-12-25T11:07:00.001+05:30</published><updated>2009-12-27T00:41:42.473+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-27T00:41:42.473+05:30</app:edited><title>Decision Making in COBOL</title><content type="html">&lt;br /&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. How does the IF Condition in COBOL work? What’s the syntax for it..?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;The IF-condition is used for decision-making in COBOL. The basic IF-condition has following structure -            &lt;br /&gt;            &lt;br /&gt;IF &lt;strong&gt;&amp;lt;test-condition&amp;gt; &lt;/strong&gt;THEN             &lt;br /&gt;&amp;#160;&amp;#160; Statement-1             &lt;br /&gt;&amp;#160;&amp;#160; Statement-2             &lt;br /&gt;&amp;#160;&amp;#160; ...             &lt;br /&gt;END-IF             &lt;br /&gt;Statement-X             &lt;br /&gt;            &lt;br /&gt;The entire IF END-IF construct along with all its statements, Statement-1, Statement-2 constitute a single unit, a &lt;u&gt;BLOCK&lt;/u&gt;. Upon entry into the IF Block, the &lt;u&gt;test-condition&lt;/u&gt; is checked. The statements inside the IF Block constitute the &lt;u&gt;body of the IF Block&lt;/u&gt;. Thus, the &lt;u&gt;test-condition&lt;/u&gt; guards entry into the IF Body.             &lt;br /&gt;            &lt;br /&gt;The &lt;strong&gt;&amp;lt;test-condition&amp;gt;&lt;/strong&gt; expression is evaluated. If the test-condition expression equals = true, then the Statement-1, Statement-2,... are executed, i.e. the statements in the body of the IF-Block are executed. Once, the IF-Block has been completed, the next successive statement following the IF-Block, say Statement-X will be executed.             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/SzSNzjCYWyI/AAAAAAAABnk/bLl-7wY0Uag/s1600-h/Image34.png%5B3%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Image34.png[3]" border="0" alt="Image34.png[3]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/SzRPjcr7xDI/AAAAAAAABno/KmlFWRmzoto/Image34.png%5B3%5D_thumb.jpg?imgmax=800" width="385" height="369" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;When test-condition expression equals = false, the control jumps directly to Statement-X, after the IF-Block.             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;Example:              &lt;br /&gt;&lt;/u&gt;01&amp;#160; AIR-FARE PIC 9(5).             &lt;br /&gt;01&amp;#160; BAGGAGE-WEIGHT PIC 9(5).             &lt;br /&gt;01&amp;#160; MAXIMUM-ALLOWED PIC 9(5) VALUE 20.             &lt;br /&gt;01&amp;#160; DIFFERENCE PIC 9(5).             &lt;br /&gt;01&amp;#160; EXCESS-CHARGE PIC 9(5).             &lt;br /&gt;...             &lt;br /&gt;...             &lt;br /&gt;MOVE 1000 TO AIR-FARE             &lt;br /&gt;IF BAGGAGE-WEIGHT &amp;gt; MAXIMUM-ALLOWED THEN             &lt;br /&gt;&amp;#160;&amp;#160; COMPUTE DIFFERENCE = BAGGAGE-WEIGHT – MAXIMUM-ALLOWED             &lt;br /&gt;&amp;#160;&amp;#160; COMPUTE EXCESS-CHARGE = DIFFERENCE * 300;             &lt;br /&gt;&amp;#160;&amp;#160; COMPUTE AIR-FARE = AIR-FARE + EXCESS-CHARGE             &lt;br /&gt;END-IF             &lt;br /&gt;DISPLAY ‘AIR-FARE : ‘ AIR-FARE             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;Explanation:              &lt;br /&gt;&lt;/u&gt;In a flight, the maximum weight of luggage allowed = 20 kgs. The passengers have to pay a &lt;u&gt;Total fare = Basic Fare + Any extra charges for excess baggage above 20 kgs.&lt;/u&gt; How to code this logic in COBOL?             &lt;br /&gt;            &lt;br /&gt;First, the MOVE statement stores the value 1000 in AIR-FARE variable. Now, if the baggage-weight exceeds 20 kgs., then you got to pay extra for the excess baggage. The IF condition checks, whether the weight is greater than 20.             &lt;br /&gt;            &lt;br /&gt;Say, the baggage-weight = 24 kgs. Then, baggage-weight &amp;gt; 20, so difference = 24 – 20 = 4 kgs. The excess-charge would be 300 multiplied 4 times = Rs. 1200. So, the air-fare = 1000 + 1200 = 2200. Finally, the DISPLAY statement displays AIR-FARE=2200.             &lt;br /&gt;            &lt;br /&gt;Say, the baggage-weight = 18 kgs. Then, baggage-weight &amp;lt; 20, so the test-condition fails. Thus, the control directly to the DISPLAY statement after the IF-block, and the Air-Fare is displayed as Rs. 1000.&amp;#160; &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/SzRb5aHOrmI/AAAAAAAABnw/tlfkKMQ4xiI/s1600-h/Image35%5B1%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image35[1]" border="0" alt="Image35[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/SzRcLAfH72I/AAAAAAAABn4/hUh-k9GPkNg/Image35%5B1%5D_thumb.png?imgmax=800" width="777" height="388" /&gt;&lt;/a&gt;             &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/SzRchE4L_GI/AAAAAAAABoA/LoXAjN5eD4Y/s1600-h/Image36%5B1%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image36[1]" border="0" alt="Image36[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/SzRciESa-2I/AAAAAAAABoI/nBz5EWFpIVM/Image36%5B1%5D_thumb.png?imgmax=800" width="776" height="175" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;Upon running the above COBOL Program, you get the following output -&amp;#160; &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/SzRcitt-F6I/AAAAAAAABoQ/xcbFLtViTbk/s1600-h/Image37%5B1%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image37[1]" border="0" alt="Image37[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/SzRcjtSZzCI/AAAAAAAABoY/PIXrR-fHuX8/Image37%5B1%5D_thumb.png?imgmax=800" width="782" height="186" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. How do you use the IF-THEN ELSE construct in COBOL?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;The IF-THEN ELSE construct in COBOL, has the following syntax :            &lt;br /&gt;            &lt;br /&gt;IF &lt;strong&gt;&amp;lt;test-condition&amp;gt; &lt;/strong&gt;THEN             &lt;br /&gt;&amp;#160;&amp;#160; Statement-1             &lt;br /&gt;&amp;#160;&amp;#160; Statement-2             &lt;br /&gt;&amp;#160;&amp;#160; ...             &lt;br /&gt;ELSE             &lt;br /&gt;&amp;#160;&amp;#160; Statement-3             &lt;br /&gt;&amp;#160;&amp;#160; Statement-4             &lt;br /&gt;&amp;#160;&amp;#160; ...             &lt;br /&gt;END-IF             &lt;br /&gt;Statement-X             &lt;br /&gt;            &lt;br /&gt;The IF-THEN ELSE construct is simple – when the test-condition = true, the IF-part is performed. When the test-condition = false, the ELSE-part is performed. Thus, the IF part and ELSE part are mutually exclusive. Either one of them is performed, based on the truth or falsity of the condition.             &lt;br /&gt;            &lt;br /&gt;The statement-1/statement-2 could be a simple COBOL Statement, or it could be another IF Else block. One IF-ELSE Block can sit right inside another IF or ELSE. This is called as &lt;u&gt;Nested Conditional&lt;/u&gt;.             &lt;br /&gt;            &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;u&gt;Example:              &lt;br /&gt;&lt;/u&gt;Let’s study the working of a deeply nested conditional. The data in the program used are :             &lt;br /&gt;            &lt;br /&gt;&lt;/font&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/SzSs5toFs_I/AAAAAAAABpE/USvjMLyqQyU/s1600-h/Image41%5B1%5D%5B3%5D.png"&gt;&lt;font face="Courier New"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image41[1]" border="0" alt="Image41[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/SzSs7SKOhLI/AAAAAAAABpI/bhUcsSGSp78/Image41%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="771" height="202" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;font face="Courier New"&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;The logic used to calculate the RATE-OF-TAX is as follows -             &lt;br /&gt;            &lt;br /&gt;&lt;/font&gt;          &lt;table border="1" cellspacing="0" cellpadding="2" width="796"&gt;&lt;tbody&gt;             &lt;tr&gt;               &lt;td valign="top" width="265"&gt;&lt;font face="Courier New"&gt;&amp;#160;&lt;/font&gt;&lt;/td&gt;                &lt;td valign="top" width="265"&gt;&lt;strong&gt;&lt;font face="Courier New"&gt;Salary upto 20k&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;                &lt;td valign="top" width="265"&gt;&lt;strong&gt;&lt;font face="Courier New"&gt;Salary&amp;gt;20k&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="265"&gt;&lt;strong&gt;&lt;font face="Courier New"&gt;Salaried Employee&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;                &lt;td valign="top" width="265"&gt;&lt;font face="Courier New"&gt;08 percent&lt;/font&gt;&lt;/td&gt;                &lt;td valign="top" width="265"&gt;&lt;font face="Courier New"&gt;10 percent&lt;/font&gt;&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="265"&gt;&lt;strong&gt;&lt;font face="Courier New"&gt;Self-employed Professional&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;                &lt;td valign="top" width="265"&gt;&lt;font face="Courier New"&gt;20 percent&lt;/font&gt;&lt;/td&gt;                &lt;td valign="top" width="265"&gt;&lt;font face="Courier New"&gt;20 percent&lt;/font&gt;&lt;/td&gt;             &lt;/tr&gt;           &lt;/tbody&gt;&lt;/table&gt;          &lt;br /&gt;&lt;font face="Courier New"&gt;This decision-table is used to determine the rate of tax. You can implement this logic COBOL Code as follows -            &lt;br /&gt;            &lt;br /&gt;&lt;/font&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/SzSs8C9M9rI/AAAAAAAABpM/Ya7odvv2RMA/s1600-h/Image42%5B1%5D%5B3%5D.png"&gt;&lt;font face="Courier New"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image42[1]" border="0" alt="Image42[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/SzSs9EbherI/AAAAAAAABpQ/WCwfQgt-pcE/Image42%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="782" height="309" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;font face="Courier New"&gt;&amp;#160; &lt;br /&gt;            &lt;br /&gt;The data presented tells you, the Salary is 18000. The program starts with SET SALARIED TO TRUE, which turns on the SALARIED switch. Thus, the control goes to the next statement, IF SALARIED. When this condition is evaluated(as SALARIED switch is turned on), it returns true. So, control enters into the the IF Block. The control reaches &lt;strong&gt;IF SALARY &amp;gt; 2000&lt;/strong&gt;. Salary equals 18k, so             &lt;br /&gt;(SALARY &amp;gt; 20000) = false, the control goes to the ELSE part. The statement MOVE 08 to Rate is performed, which stores the value 08 in Rate. The Inner IF Block terminates. The control jumps to the DISPLAY statement, that displays the RATE = 08 percent.             &lt;br /&gt;&amp;#160; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. What are the Relational/Comparision Conditions?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;To compare two quantities, which is larger one, which is smaller amongst them, are the two quantities equal in magnitude, you would use &lt;u&gt;Relational Conditions&lt;/u&gt;. The different relational operators available in COBOL, are tabulated below :             &lt;br /&gt;            &lt;br /&gt;            &lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;               &lt;tr&gt;                 &lt;td valign="top" width="400"&gt;&lt;strong&gt;Relational Operator&lt;/strong&gt;&lt;/td&gt;                  &lt;td valign="top" width="400"&gt;&lt;strong&gt;Symbol&lt;/strong&gt;&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="400"&gt;IS LESS THAN&lt;/td&gt;                  &lt;td valign="top" width="400"&gt;&amp;lt;&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="400"&gt;IS EQUAL TO&lt;/td&gt;                  &lt;td valign="top" width="400"&gt;=&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="400"&gt;IS GREATER THAN&lt;/td&gt;                  &lt;td valign="top" width="400"&gt;&amp;gt;&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="400"&gt;IS LESS THAN OR EQUAL TO&lt;/td&gt;                  &lt;td valign="top" width="400"&gt;&amp;lt;=&lt;/td&gt;               &lt;/tr&gt;                &lt;tr&gt;                 &lt;td valign="top" width="400"&gt;IS GREATER THAN OR EQUAL TO&lt;/td&gt;                  &lt;td valign="top" width="400"&gt;&amp;gt;=&lt;/td&gt;               &lt;/tr&gt;             &lt;/tbody&gt;&lt;/table&gt;         &lt;/font&gt;&lt;font face="Courier New"&gt;           &lt;br /&gt;A relational condition would have the following form:             &lt;br /&gt;            &lt;br /&gt;data-item-1 &lt;strong&gt;relational-condition &lt;/strong&gt;data-item-2             &lt;br /&gt;            &lt;br /&gt;The data-items could be variables or literal constant values. Moreover, in &lt;strong&gt;relational conditions&lt;/strong&gt; you can use the &lt;u&gt;complete relational operator spelled out in words&lt;/u&gt;, or as an alternative the &lt;u&gt;symbolic representation&lt;/u&gt; for it. So, for example you may write 2 &lt;strong&gt;&amp;lt;&lt;/strong&gt; 3, or you may as well write 2 &lt;strong&gt;IS LESS THAN&lt;/strong&gt; 3.             &lt;br /&gt;            &lt;br /&gt;What happens, when you compare two data-items, which are non-numeric. In this case, the result of comparision depends on the &lt;u&gt;collating sequence&lt;/u&gt;.             &lt;br /&gt;&amp;#160; &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. Well in COBOL, how do you combine 2 or more conditions? Like, you wanna check if AGE &amp;gt;= 20 and AGE =&amp;lt; 35(Age lies in the range 20 to 35)?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;In COBOL, you can write a &lt;u&gt;simple condition&lt;/u&gt; or a &lt;u&gt;Complex Condition&lt;/u&gt;. Two or more simple conditions connected by Logical Operators give a &lt;u&gt;Complex condition&lt;/u&gt;. For example, you can use the Logical operator &lt;u&gt;AND&lt;/u&gt; to combine two conditions. For example, to check whether Age is in the range 20-35, you write             &lt;br /&gt;            &lt;br /&gt;IF (AGE &amp;gt;= 20) &lt;strong&gt;AND&lt;/strong&gt; (AGE &amp;lt;= 35)             &lt;br /&gt;&amp;#160; &amp;lt;condition-1&amp;gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;condition-2&amp;gt;             &lt;br /&gt;            &lt;br /&gt;The Logical Operators in COBOL, are briefly discussed below :             &lt;br /&gt;1. IF &lt;strong&gt;BALANCE&lt;/strong&gt; &lt;strong&gt;IS NEGATIVE&lt;/strong&gt; &lt;u&gt;AND&lt;/u&gt; &lt;strong&gt;DAYS-OVERDUE &amp;gt; 30              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/strong&gt;PERFORM 1100-SEND-OVERDUE-NOTICE             &lt;br /&gt;            &lt;br /&gt;In the above example, the PERFORM statement is executed, only when both the conditions &lt;strong&gt;balance is less than 0, &lt;/strong&gt;as well as, &lt;strong&gt;DAYS-OVERDUE exceeds 30&lt;/strong&gt; are satisfied&lt;strong&gt;. &lt;/strong&gt;The &lt;u&gt;AND&lt;/u&gt; operator returns true, only if both the conditions are true.             &lt;br /&gt;            &lt;br /&gt;2. IF &lt;strong&gt;PHONE-NUMBER IS NOT NUMERIC &lt;/strong&gt;&lt;u&gt;OR&lt;/u&gt;&lt;strong&gt; NAME-IS-MISSING              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PERFORM INVALID-DATA               &lt;br /&gt;              &lt;br /&gt;&lt;/strong&gt;In the above example, the PERFORM Statement is executed, when either the phone-number field is non-numeric or the name field is missing. Thus, the &lt;u&gt;OR&lt;/u&gt; Operator returns true, even if one of the conditions is true. If both the conditions are true, well and good, but even if one of them is true, &lt;u&gt;OR&lt;/u&gt; returns true.             &lt;br /&gt;            &lt;br /&gt;3. IF &lt;strong&gt;WEIGHT-1 &lt;/strong&gt;&lt;u&gt;NOT&lt;/u&gt;&lt;strong&gt; = WEIGHT-2              &lt;br /&gt;&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PERFORM INEQUAL-WEIGHTS             &lt;br /&gt;            &lt;br /&gt;In the above example, the PERFORM Statement is executed, when the first weight does &lt;strong&gt;NOT&lt;/strong&gt; equal the second weight. The &lt;u&gt;NOT&lt;/u&gt;&lt;strong&gt; &lt;/strong&gt;Operator is used to negate any condition. &lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. What are Class Conditions in COBOL?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;Class Conditions help determine, what type of data is present in a variable. Thus, it checks the contents stored in a variable, is it alphabetic, numeric or alpha-numeric... Suppose, you want to check, whether the name is alphabetic, or age of the person is numeric, then you should use Class Conditions. The general format for Class conditions is given below -            &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/SzXXDeamc2I/AAAAAAAABqU/9KzAB89IFpU/s1600-h/Image43%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image43[1]" border="0" alt="Image43[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/SzXXEObJM_I/AAAAAAAABqY/9EAQjeeBjCw/Image43%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="352" height="88" /&gt;&lt;/a&gt;             &lt;br /&gt;            &lt;br /&gt;Data is Alphabetic implies that it contains only characters from A-Z and/or blanks. Alphabetic data cannot contain numerals(0,1,2,...,9). On the other, when you say that data is numeric in COBOL, it can contain digits from 0-9, with/without a sign.             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;ALPHABETIC-LOWER&lt;/u&gt; and &lt;u&gt;ALPHABETIC-UPPER&lt;/u&gt; are the same as alphabetic, except that they also take the case into account; whether it is lower-case or upper-case. So, if the variable WS-TEXT contains ‘HELLO’, and you test IF WS-TEXT IS ALPHABETIC-UPPER, it returns true.             &lt;br /&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. Hey pal, how do you check if the data input in a COBOL Program is alphanumeric? Alphabetic is cool, numeric is awesome, but alphanumeric?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;Let’s assume, you want to check, if the ADDRESS-FIELD is alpha-numeric. To do this, take it one at a time, (i) First check, if ADDRESS-FIELD is alphabetic. (ii)Next check, if ADDRESS-FIELD is numeric.            &lt;br /&gt;            &lt;br /&gt;IF ADDRESS-FIELD IS NOT ALPHABETIC THEN             &lt;br /&gt;&amp;#160;&amp;#160; IF ADDRESS-FIELD IS NOT NUMERIC THEN             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PERFORM INVALID-ADDRESS             &lt;br /&gt;&amp;#160;&amp;#160; END-IF             &lt;br /&gt;END-IF&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. What are Condition-name conditions?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;Suppose the variable WS-GENDER stores the values ‘M’ for Male or ‘F’ for female. You may want to associate the values ‘M’ or ‘F’ with some meaningful names such as MALE or FEMALE. To do this, you use 88-Level Condition names. Consider the following :            &lt;br /&gt;            &lt;br /&gt;            &lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;               &lt;tr&gt;                 &lt;td bgcolor="#000000" valign="top" width="800"&gt;                   &lt;p&gt;&lt;font color="#00ff00"&gt;--1----+----2----+----3----+----4----+----5----+----6----+----7--                        &lt;br /&gt;DATA DIVISION.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;WORKING-STORAGE SECTION.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;01&amp;#160; GENDER&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PIC X.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; 88 MALE&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VALUE 'M'.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; 88 FEMALE&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VALUE 'F'.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;PROCEDURE DIVISION.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; SET MALE TO TRUE&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; IF MALE THEN&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; DISPLAY 'GENDER IS MALE'&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ELSE&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; DISPLAY 'GENDER IS FEMALE'&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; END-IF&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; STOP RUN.&lt;/font&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;                 &lt;/td&gt;               &lt;/tr&gt;             &lt;/tbody&gt;&lt;/table&gt;         &lt;/font&gt;&lt;font face="Courier New"&gt;           &lt;br /&gt;In the above code snippet, I have assigned the values ‘M’ and ‘F’, the symbolic names MALE and FEMALE respectively using 88-level entries. 88-Level entries act as flags. To turn the flag on, you use the SET Statement. SET MALE TO TRUE, turns MALE flag on, and ‘M’ is stored in GENDER variable. To check if the gender is male, you may write IF GENDER = ‘M’ or you could use the condition name -&amp;#160; IF MALE; both are equivalent.&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="798"&gt;&lt;strong&gt;&lt;font face="Courier New"&gt;Q. What are Sign-conditions?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="798"&gt;&lt;font face="Courier New"&gt;Sign conditions are used to find if a numeric quantity is positive(&amp;gt;0) or negative(&amp;lt;0). Thus, they are used to check for the sign of a numeric variable.            &lt;br /&gt;            &lt;br /&gt;The general syntax for Sign condition is given below -             &lt;br /&gt;            &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/SzZf3hnqwsI/AAAAAAAABqg/V3nAvwIL53k/s1600-h/Image44%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image44[1]" border="0" alt="Image44[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/SzZf5jNsmWI/AAAAAAAABqk/yH7b82x54xs/Image44%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="449" height="73" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;The quantity which is being test could be stored in a Variable, or it could also be the result of an expression. A variable is POSITIVE, if it is greater than &amp;gt; 0. On the other hand, the variable is NEGATIVE, if it is less than 0.             &lt;br /&gt;            &lt;br /&gt;&lt;u&gt;Example:&lt;/u&gt;            &lt;br /&gt;IF BALANCE IS NEGATIVE            &lt;br /&gt;&amp;#160;&amp;#160; PEFORM SEND-CREDIT-OVERLIMIT-NOTICE            &lt;br /&gt;END-IF&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-331179397565715928?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/6lQtj9_2132BLUH6Wa_wUUrUbpw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6lQtj9_2132BLUH6Wa_wUUrUbpw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/6lQtj9_2132BLUH6Wa_wUUrUbpw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6lQtj9_2132BLUH6Wa_wUUrUbpw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/u-DHH9PLCXQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/331179397565715928/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2009/12/decision-making-in-cobol.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/331179397565715928?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/331179397565715928?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/u-DHH9PLCXQ/decision-making-in-cobol.html" title="Decision Making in COBOL" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2009/12/decision-making-in-cobol.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0YASHY5cSp7ImA9WxBSGU0.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-5708914957688444559</id><published>2009-12-19T19:38:00.001+05:30</published><updated>2009-12-27T15:49:09.829+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-27T15:49:09.829+05:30</app:edited><title>COBOL Tutorial – USAGE Clause</title><content type="html">&lt;br /&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="808"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="806"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What is USAGE Clause? Could you cite an example, where one would employee USAGE Clause?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="806"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;USAGE Clause signifies, how the computer internally stores or represents DATA. &lt;u&gt;Memory space calculation is done by the computer, on looking at the USAGE Clause&lt;/u&gt;. Thus, USAGE Clause answers the question, &lt;b&gt;How much storage space does a data-item occupy? 1 byte, 2bytes, 4 bytes,… well how much?&lt;/b&gt; Depending upon the type of data – whether alphabetic or numeric, you should choose a USAGE(internal representation) that suits your purpose.               &lt;br /&gt;              &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;          &lt;table border="1" cellspacing="0" cellpadding="2" width="718"&gt;&lt;tbody&gt;             &lt;tr&gt;               &lt;td valign="top" width="204"&gt;                 &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;USAGE&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;               &lt;/td&gt;                &lt;td valign="top" width="509"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Purpose&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="207"&gt;&lt;font size="3" face="Courier New"&gt;DISPLAY&lt;/font&gt;&lt;/td&gt;                &lt;td valign="top" width="506"&gt;&lt;font size="3" face="Courier New"&gt;When you want to work with characters, manipulate them, work on textual string data&lt;/font&gt;&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="210"&gt;&lt;font size="3" face="Courier New"&gt;COMPUTATIONAL&lt;/font&gt;&lt;/td&gt;                &lt;td valign="top" width="504"&gt;&lt;font size="3" face="Courier New"&gt;More appropriate, when you want to perform arithmetic computations, specially on numbers – integers and fractional numbers&lt;/font&gt;&lt;/td&gt;             &lt;/tr&gt;           &lt;/tbody&gt;&lt;/table&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;When there is no explicit USAGE clause, it defaults to &lt;u&gt;USAGE IS DISPLAY&lt;/u&gt;.&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="806"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. How do computers internally store data?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="806"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;Computers store data in Binary digits 0 and 1. Thus, all the data you enter into the computer is represented as 0’s and 1’s. The computer is said to understand and speak &lt;u&gt;binary language&lt;/u&gt;.               &lt;br /&gt;              &lt;br /&gt;Text data such as ‘HELLO’, ‘I HOPE YOU ARE IN THE PINK OF HEALTH’,’QUASAR CHUNAWALA’ are stored using a &lt;u&gt;collating sequence&lt;/u&gt;(ASCII or EBCDIC). The collating sequence assigns a unique code number to each character. For example, A is assigned ASCII code 65, B = 66, C = 67, and so on. Now, when you type A on the computer, the computer interprets it as ASCII Code 65, which gets stored as 0100 0001.               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/Szbs-mjdbNI/AAAAAAAABq4/0HMrosqWj44/s1600-h/Image45%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image45[1]" border="0" alt="Image45[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/Szbs_BPNV6I/AAAAAAAABq8/o7ejdtBgBEA/Image45%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="745" height="128" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;Numeric data can be held as Text Digits(ASCII Digits), or as pure Binary numbers, or as Binary Coded Decimal(BCD), or as Real Numbers(IEEE Format).               &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="806"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What is the USAGE IS DISPLAY Clause?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="806"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;USAGE IS DISPLAY is mainly used with Text Data such as ‘HELLO’,’HOW ARE YOU’ and numeric data, which is not used in computation such as Street no. ‘2530’, phone numbers like ’17654094509’.              &lt;br /&gt;              &lt;br /&gt;Text-data(strings) are made up of several characters. For example, the text-string ‘HELLO’ is composed of the characters ‘H’,’E’,’L’,’L’ and ‘O’. &lt;u&gt;When you apply USAGE IS DISPLAY, the text-data is stored as ASCII/EBCDIC Characters&lt;/u&gt;.               &lt;br /&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;             &lt;br /&gt;Generally, when Text-data is stored on PC, the collating sequence used is ASCII. On Mainframes, Text-Data is stored in EBCDIC Format.               &lt;br /&gt;              &lt;br /&gt;&lt;u&gt;Example:                &lt;br /&gt;&lt;/u&gt;              &lt;br /&gt;01 WS-TEXT PIC X(5) VALUE ‘HELLO’ USAGE IS DISPLAY.&amp;#160; &lt;br /&gt;              &lt;br /&gt;Here, ‘H’, ‘E’, ‘L’, ‘L’ and ‘O’ are stored ASCII/EBCDIC Characters. A picture of how they look is shown below :               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/SzcIJ6u26WI/AAAAAAAABrU/1oYsls-NWbQ/s1600-h/Image46%5B2%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image46[2]" border="0" alt="Image46[2]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/SzcIKx4ncUI/AAAAAAAABrY/4HlGelqPTbQ/Image46%5B2%5D_thumb%5B2%5D.png?imgmax=800" width="763" height="537" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;              &lt;br /&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;Each ASCII/EBCDIC Character requires 1 byte. So, the text-data ‘HELLO’ occupies 5 bytes of storage.              &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="806"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. Is there any problem, if I store numeric data, which is used in computations with a USAGE IS DISPLAY?&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="806"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;             &lt;br /&gt;01 WS-VAR PIC 9 VALUE 2.&amp;#160; &lt;br /&gt;              &lt;br /&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;Since no USAGE clause is explicitly specified, it defaults to USAGE IS DISPLAY.              &lt;br /&gt;              &lt;br /&gt;When numeric data is specified with USAGE IS DISPLAY, these text-digits of the number are stored as ASCII/EBCDIC digits. Thus, the Text-digit 2 would be stored in computer memory as shown below -               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/Szc0kW901jI/AAAAAAAABr0/EGWEJeqgNPA/s1600-h/Image47%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image47[1]" border="0" alt="Image47[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/Szc0lYENPWI/AAAAAAAABr4/3NuM814Os10/Image47%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="714" height="155" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;              &lt;br /&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;Each text-digit is stored in ASCII/EBCDIC Form, so it will occupy 1 byte. Hence, if you store 12345.67 with USAGE IS DISPLAY, it will occupy 7 bytes.              &lt;br /&gt;              &lt;br /&gt;Imagine a scenario, where you want to read and process a data-file containing 1 million phone-numbers, each phone-number being a PIC 9(10). Each phone number occupies 10 bytes of storage.               &lt;br /&gt;              &lt;br /&gt;For processing 1 million phone numbers,               &lt;br /&gt;              &lt;br /&gt;1 MILLION x(multiplied by) 10 bytes for each phone number = 10 million bytes.               &lt;br /&gt;              &lt;br /&gt;This is quite &lt;b&gt;computationally expensive&lt;/b&gt; in terms of storage space, time and bandwidth. Reading and processing a file as large as 10 million bytes(10 MB) takes time. This is why, &lt;/font&gt;&lt;font size="3" face="Courier New"&gt;&lt;u&gt;USAGE IS DISPLAY is not good choice for storing numeric data&lt;/u&gt;.               &lt;br /&gt;              &lt;br /&gt;&lt;/font&gt;&lt;font size="3" face="Courier New"&gt;USAGE is DISPLAY, is more &lt;u&gt;suited to working on a character-by-character level&lt;/u&gt; on Text data-items. When you want to perform character-level manipulations, use DISPLAY.&lt;/font&gt; &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="806"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What is the USAGE IS COMP/COMPUTATIONAL/BINARY Clause?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="806"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;USAGE IS COMPUTATIONAL is more appropriate when you are dealing with &lt;b&gt;integer numbers&lt;/b&gt;. USAGE IS COMPUTATIONAL indicates that the data-item shall be stored as &lt;u&gt;pure binary numbers&lt;/u&gt;.               &lt;br /&gt;              &lt;br /&gt;&lt;u&gt;Example:&lt;/u&gt;               &lt;br /&gt;01&amp;#160; WS-NUMBER&amp;#160; PIC 9(04) VALUE 1327 &lt;u&gt;USAGE IS COMPUTATIONAL&lt;/u&gt;.               &lt;br /&gt;              &lt;br /&gt;USAGE IS COMPUTATIONAL indicates that 1327 is stored in pure binary form. A picture of how 1327 is stored, is given below :               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/Szc0l7jLGcI/AAAAAAAABr8/lc6NaA0QcMo/s1600-h/Image49%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image49[1]" border="0" alt="Image49[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/Szc0m28ufqI/AAAAAAAABsA/WnVYdzPv3X0/Image49%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="748" height="125" /&gt;&lt;/a&gt;&amp;#160;&amp;#160; &lt;br /&gt;              &lt;br /&gt;The pure binary equivalent of 1,327 occupies 2 bytes. &lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;The memory space calculation is done by the computer, as follows:&lt;/font&gt;&lt;/p&gt;          &lt;table border="1" cellspacing="0" cellpadding="2" width="652"&gt;&lt;tbody&gt;             &lt;tr&gt;               &lt;td valign="top" width="280"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Integer Number Range&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;                &lt;td valign="top" width="217"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;PICTURE Clause&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;                &lt;td valign="top" width="153"&gt;&lt;strong&gt;&lt;font size="3" face="Courier New"&gt;Storage Space&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="279"&gt;                 &lt;p&gt;&lt;font size="3" face="Courier New"&gt;-32,768 to +32,767&lt;/font&gt;&lt;/p&gt;               &lt;/td&gt;                &lt;td valign="top" width="216"&gt;&lt;font size="3" face="Courier New"&gt;S9(01) to S9(04)&lt;/font&gt;&lt;/td&gt;                &lt;td valign="top" width="155"&gt;&lt;font size="3" face="Courier New"&gt;2 Bytes&lt;/font&gt;&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="278"&gt;&lt;font size="3" face="Courier New"&gt;-2 billion to +2 billion&lt;/font&gt;&lt;/td&gt;                &lt;td valign="top" width="215"&gt;&lt;font size="3" face="Courier New"&gt;S9(05) to S9(09)&lt;/font&gt;&lt;/td&gt;                &lt;td valign="top" width="157"&gt;&lt;font size="3" face="Courier New"&gt;4 Bytes&lt;/font&gt;&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td valign="top" width="277"&gt;&lt;font size="3" face="Courier New"&gt;-1.8 x 10^19 to +1.8 x 10^19&lt;/font&gt;&lt;/td&gt;                &lt;td valign="top" width="216"&gt;&lt;font size="3" face="Courier New"&gt;S(09) to S9(18)&lt;/font&gt;&lt;/td&gt;                &lt;td valign="top" width="159"&gt;&lt;font size="3" face="Courier New"&gt;8 Bytes&lt;/font&gt;&lt;/td&gt;             &lt;/tr&gt;           &lt;/tbody&gt;&lt;/table&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;For numbers upto 32,767, 2 bytes of memory space is reserved. What if, you wanted to store an even larger integer number like 50,000? The pure binary equivalent of such numbers would then not fit into 16 bits(2 bytes). A 2-bytes bucket would not be large enough to accommodate it. They would spill over. They would need a big tumbler(say 4 bytes capacity). So, automatically 4 bytes of memory space would be reserved. What if, you store a mammoth number like a hundred billion? A hundred billion would have a picture clause S9(11), so it would occupy 8 bytes.&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;As you may observe on the table, based on the ranges, we can draw a correlation between the PICTURE Clause of the data-item and the Storage space. &lt;/font&gt;&lt;font size="3"&gt;&lt;font face="Courier New"&gt;&lt;i&gt;                 &lt;br /&gt;&lt;/i&gt;                &lt;br /&gt;Consider the following simple example, in which the variables WS-VAR-1 and WS-VAR-2 are declared as COMPUTATIONAL. As the USAGE IS COMPUTATIONAL, the numbers 10 and -12 are stored internally in binary format.                 &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/SyzeSlpjfKI/AAAAAAAABiY/tv-zwHX8PQ4/s1600-h/USAGE-1%5B2%5D%5B4%5D.png"&gt;&lt;font color="#000000"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="USAGE-1[2]" border="0" alt="USAGE-1[2]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/SyzeT5Rd9OI/AAAAAAAABic/0mfjgM4LqY4/USAGE-1%5B2%5D_thumb%5B2%5D.png?imgmax=800" width="775" height="412" /&gt;&lt;/font&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;            &lt;br /&gt;&lt;font size="3" face="Courier New"&gt;Upon the addition Of these two integers, 10 and -12, the COBOL Code shows the following output. 10 added to –12 gives a sum of –2. Note, that sign is stored as part of the rightmost digit. K stands for minus(-ve) 2. So, 1K means –12 and 0K means –2.              &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/SyzeUpROX_I/AAAAAAAABig/kLEtTLhRRGY/s1600-h/USAGE-2%5B2%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="USAGE-2[2]" border="0" alt="USAGE-2[2]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/SyzeVqOhtVI/AAAAAAAABik/dC75b3YSwfk/USAGE-2%5B2%5D_thumb%5B2%5D.png?imgmax=800" width="779" height="205" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="806"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What is the USAGE IS COMP-1/COMP-2 Clause?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="806"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;When you want to work with fractional numbers, numbers containing a decimal point, you must employ USAGE IS COMP-1. USAGE IS COMP-1 is used to store floating point numbers(real numbers). COMP-1 occupies 4 bytes of memory space. Floating point(real numbers) are divided into 2 parts : mantissa part and exponent. For example, 123.456 can be represented as mantissa = 123456 e -3. The mantissa part is occupies 3 bytes. The exponent part occupies 1 byte.&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;On the other hand, if you have an extremely huge number like a &lt;b&gt;googol,&lt;/b&gt; 1 e +100, you would need more space. Moreover, you a number 23 e -50 is a extremely tiny number(quite close to zero, but not zero), to store it require lot of precision and accuracy. For such numbers, you would use COMP-2. COMP-2 is used for real fractional numbers which are extremely large, and very small. COMP-2 occupies 8 bytes of memory space.              &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#808080" valign="top" width="806"&gt;&lt;font size="3" face="Courier New"&gt;&lt;strong&gt;Q. What is the USAGE IS COMP-3 Clause?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td bgcolor="#ffffff" valign="top" width="806"&gt;         &lt;p&gt;&lt;font size="3" face="Courier New"&gt;As most references quote, COMP-3 is used mainly for packed decimal values(BCD Format). I would say, on most computer systems, running COBOL Applications, COMP-3 is the general standard. The reason behind this is, COMP-3 packs, two digits in 1 single byte. This is really cool, and it saves a lot of space. &lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;Let me show ya, how COMP-3 achieves this remarkable feat. In the decimal number system, any digit can take a value ranging from 0-9, there are in all 10 possibilities. Thus, you can represent any digit with 4 bits(16 possibilities, 4 bits = 1 nibble). So, in COMP-3 format, each digit occupies only 4 bits. You must find the binary representation for each digit separately. For example, the number &lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;&amp;#160; 4&amp;#160;&amp;#160;&amp;#160; 5&amp;#160;&amp;#160;&amp;#160; 9&amp;#160;&amp;#160;&amp;#160; 8&amp;#160;&amp;#160;&amp;#160; 1&amp;#160;&amp;#160;&amp;#160; 2 .&amp;#160; 5&amp;#160;&amp;#160;&amp;#160; 6&amp;#160;&amp;#160; would be stored as              &lt;br /&gt;0100 0101 1001 1000 0001 0010 0101 0110.&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font size="3" face="Courier New"&gt;One can infer, in COMP-3 format, two digits are packed into a single byte. So, 459812.56, a number, which is composed of 8 digits would take only 4 bytes of computer storage. There’s a general formula for memory space calculation, in COMP-3 format -              &lt;br /&gt;S9(4) COMP-3 would occupy 2 bytes.               &lt;br /&gt;S9(6) COMP-3 would occupy 3 bytes.               &lt;br /&gt;S9(7) COMP-3 would occupy 4 bytes.               &lt;br /&gt;S9(n) COMP-3 would occupy (n+1)/2 bytes.&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-5708914957688444559?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Y1yVtvG46KfFaRGU8joj2OHTAag/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Y1yVtvG46KfFaRGU8joj2OHTAag/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Y1yVtvG46KfFaRGU8joj2OHTAag/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Y1yVtvG46KfFaRGU8joj2OHTAag/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/F6ruz_L55g4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/5708914957688444559/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2009/12/cobol-tutorial-usage-clause.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5708914957688444559?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5708914957688444559?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/F6ruz_L55g4/cobol-tutorial-usage-clause.html" title="COBOL Tutorial – USAGE Clause" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>1</thr:total><feedburner:origLink>http://www.mainframes360.com/2009/12/cobol-tutorial-usage-clause.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUAFSHw7fSp7ImA9WxBTFk4.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-2867432964224304041</id><published>2009-12-12T22:09:00.001+05:30</published><updated>2009-12-12T22:38:39.205+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-12T22:38:39.205+05:30</app:edited><title>VSAM Tutorial 04 – Loading Records in VSAM KSDS</title><content type="html">&lt;div class="scrollbox"&gt;   &lt;br /&gt;    &lt;table border="1" cellspacing="0" cellpadding="2" width="800"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="798"&gt;&lt;strong&gt;&lt;font size="2" face="Courier New"&gt;Q. How do you load data into VSAM KSDS Dataset?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="798"&gt;&lt;font size="2" face="Courier New"&gt;Storing data in a VSAM KSDS file, is known as &lt;strong&gt;Loading&lt;/strong&gt;. Initially, to begin with the KSDS File is empty, it doesn’t contain any records. Based on, the Control Interval Size, that you’d have specified, while creating the KSDS File, the MVS Operating System books and reserves empty Control Intervals of that size in the KSDS Cluster. These are yet to be filled up,populated with data-records.               &lt;br /&gt;              &lt;br /&gt;To actually load data-records into a VSAM KSDS file, you use IBM Supplied Utility &lt;strong&gt;IDCAMS&lt;/strong&gt;. Instruct the IDCAMs utility, what’s the task you would like to perform by providing an appropriate control statement(as instream data). The &lt;strong&gt;IDCAMS utility &lt;/strong&gt;picks up the Control Commands, and acts accordingly. So, the control command used to Load Data records in VSAM KSDS File is &lt;strong&gt;REPRO &lt;/strong&gt;Command. In this tutorial, effectively, you are going to &lt;em&gt;REPRO in &lt;/em&gt;the data records from a plain Sequential file into a KSDS Dataset. At the same time you’ll also learn, how to unload the contents KSDS Dataset back to a plain sequential file.               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/SyPHEWSPbqI/AAAAAAAABgw/zrAtmXCVekU/s1600-h/Image28%5B2%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image28[2]" border="0" alt="Image28[2]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/SyPHFiEofqI/AAAAAAAABg0/Xy-UaZDf5RU/Image28%5B2%5D_thumb%5B1%5D.png?imgmax=800" width="363" height="134" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;/font&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="798"&gt;&lt;strong&gt;&lt;font size="2" face="Courier New"&gt;Q. Hey, tell me what’s the syntax for the REPRO Command? How do I write a Batch Job/JCL with IDCAMS and REPRO Command?&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="798"&gt;&lt;font size="2" face="Courier New"&gt;The REPRO Command in it’s simplest form looks like this -              &lt;br /&gt;              &lt;br /&gt;REPRO INFILE(&lt;em&gt;input-ddname&lt;/em&gt;)               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; OUTFILE(&lt;em&gt;output-ddname&lt;/em&gt;)               &lt;br /&gt;              &lt;br /&gt;In the above syntax, the &lt;em&gt;input-ddname &lt;/em&gt;is DD Card for the Input Dataset, which happens to be the Physical Sequential(PS) Dataset, the source which currently holds the data-records. The &lt;em&gt;output-ddname&lt;/em&gt; is the DD Card for the Output Dataset, which should be the destination VSAM KSDS File. So, let me quickly put together an example, that’ll show how to load records in a dataset. I am going to create a KSDS Dataset, to store the data of Employees working in an Organisation. I would like to store their ENo, EName, Salary, JDate(Joining Date). Assume that, you’ve stored the following Employees Data in a sequential file -               &lt;br /&gt;              &lt;br /&gt;PS SEQUENTIAL FILE – AGY0157.SEQ.EMPLOYEE               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/SyPHGmFBfAI/AAAAAAAABg4/p20lEzKWu5E/s1600-h/Image30%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image30[1]" border="0" alt="Image30[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/SyPHIGJh9uI/AAAAAAAABg8/iwH-u83pcRs/Image30%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="782" height="182" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;As you can observe, all the data-records have a length = 23. Moreover, the Employee ID, is 2 digits. This can be used to uniquely identify each employee. Hence, this will acts as a Key in the VSAM KSDS Cluster. &lt;strong&gt;Note that all the Input Data Records are increasing(ascending) order of the Key(EMPLOYEE ID). &lt;/strong&gt;If the records are out of order, it will throw an error. When you load data records in KSDS Dataset, it should always be &lt;strong&gt;Sequential Load&lt;/strong&gt;.               &lt;br /&gt;              &lt;br /&gt;Given below is the definition of the VSAM KSDS File : AGY0157.KSDS.EMPLOYEE, which will be used to store the Employee Records -               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/SyPHJPRJNGI/AAAAAAAABhA/ZwAVis_Q_WM/s1600-h/Image31%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image31[1]" border="0" alt="Image31[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/SyPHLdk-jxI/AAAAAAAABhE/aVwhzlNT6qI/Image31%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="781" height="500" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;Notice, that the name of the VSAM KSDS Cluster is AGY0157.KSDS.EMPLOYEE. It has RECORDSIZE 23, and the Key values begin from column 0(offset) and are 2 columns wide. The word INDEXED is used to create KSDS.               &lt;br /&gt;              &lt;br /&gt;To load or &lt;em&gt;REPRO IN&lt;/em&gt; the Employee Data from PS Sequential File, AGY0157.SEQ.EMPLOYEE to VSAM KSDS File AGY0157.KSDS.EMPLOYEE, you would use the REPRO Command of the IDCAMS utility as follows :               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/SyPHM0_gcPI/AAAAAAAABhI/Sivx1YX_Vv8/s1600-h/Image32%5B2%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image32[2]" border="0" alt="Image32[2]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/SyPHOMZuYZI/AAAAAAAABhM/gI5WAQ_N8-A/Image32%5B2%5D_thumb%5B1%5D.png?imgmax=800" width="777" height="304" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;              &lt;br /&gt;Upon submitting this Job, the records are loaded successfully, and this can be verified by seeing the JOB SYSOUT Dataset.               &lt;br /&gt;              &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/SyPHPTdK4AI/AAAAAAAABhQ/j82U-ydr2S0/s1600-h/Image33%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image33[1]" border="0" alt="Image33[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/SyPHRy5kYLI/AAAAAAAABhU/7WX7XEj7ULY/Image33%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="783" height="280" /&gt;&lt;/a&gt;               &lt;br /&gt;              &lt;br /&gt;You can see in bold that the NUMBER OF RECORDS PROCESSED WAS 6. This implies all the 6 records were successfully loaded into the VSAM KSDS File with Maximum Condition Code 0.&lt;/font&gt;&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-2867432964224304041?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/yc8IJbkbc1a6aOQrrJUGOUwQi7k/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/yc8IJbkbc1a6aOQrrJUGOUwQi7k/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/yc8IJbkbc1a6aOQrrJUGOUwQi7k/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/yc8IJbkbc1a6aOQrrJUGOUwQi7k/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/wbgAl5fZRUQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/2867432964224304041/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2009/12/vsam-tutorial-04-loading-records-in.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/2867432964224304041?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/2867432964224304041?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/wbgAl5fZRUQ/vsam-tutorial-04-loading-records-in.html" title="VSAM Tutorial 04 – Loading Records in VSAM KSDS" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2009/12/vsam-tutorial-04-loading-records-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQMRn87eCp7ImA9WxBTFEo.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-5864727944522888634</id><published>2009-09-26T18:19:00.001+05:30</published><updated>2009-12-11T00:59:47.100+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-11T00:59:47.100+05:30</app:edited><title>COBOL Tutorial – Arithmetic Operators</title><content type="html">&lt;br /&gt;  &lt;div class="scrollbox"&gt;   &lt;table border="1" cellspacing="0" cellpadding="0" width="805"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="803"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. How do you perform Arithmetic in COBOL? For example, how do you write a simple program that calculates the Interest to be paid on a Principal p?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="803"&gt;&lt;font face="Courier New"&gt;You often need to do &lt;strong&gt;Math &lt;/strong&gt;in &lt;strong&gt;COBOL&lt;/strong&gt;. &lt;/font&gt;&lt;font face="Courier New"&gt;You can perform Arithmetic in COBOL using Arithmetic Operators. When you perform some arithmetic on two or more numeric quantities, such an expression is called an Arithmetic Expressions. There are 4 main Arithmetic Operators in COBOL – ADD, SUBTRACT, MULTIPLY and DIVIDE.              &lt;br /&gt;              &lt;br /&gt;You can even write complex arithmetic expressions by using the COMPUTE verb. I have written about the syntax of each operator, followed by examples and some results.               &lt;br /&gt;&lt;/font&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="803"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. How’z the ADD Operator used in COBOL. Show me some stuff...&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="803"&gt;           &lt;p&gt;&lt;font face="Courier New"&gt;The ADD operator can be used to add two or more quantities. In the assembly language, we write the instruction ADD A B to find the sum of A and B. The final sum is stored in A. On the same lines, the ADD Operator in COBOL has the following syntax :                &lt;br /&gt;                &lt;br /&gt;&lt;/font&gt;&lt;b&gt;&lt;u&gt;&lt;font face="Courier New"&gt;Syntax&lt;/font&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;            &lt;p&gt;&lt;b&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;            &lt;p&gt;&lt;font face="Courier New"&gt;ADD one-quantity TO second-quantity                &lt;br /&gt;                &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;The final sum result is stored in the second-variable. For example, if A=10, and I write                &lt;br /&gt;                &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;ADD 5 TO A&lt;/font&gt;&lt;/p&gt;            &lt;p&gt;&lt;font face="Courier New"&gt;After performing the above step, the computer adds 5 to the value of A, so A=15. Suppose a variable B=5, then I may also write                &lt;br /&gt;                &lt;br /&gt;ADD B TO A                 &lt;br /&gt;                &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;            &lt;p&gt;&lt;b&gt;&lt;u&gt;&lt;font face="Courier New"&gt;Syntax&lt;/font&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;            &lt;p&gt;&lt;b&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;            &lt;p&gt;&lt;font face="Courier New"&gt;ADD A B C TO SUM                &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;               &lt;br /&gt;In this case, all the three group of numbers A B and C, would be added to SUM. So, assuming A=10, B=15, and C=20, if initially RESULT = 100, after addition of A, B and C to SUM, the value of RESULT = 100 + (10+15+20) = 145.                 &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;                 &lt;br /&gt;Example&amp;#160; &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/Sx33lc0fP7I/AAAAAAAABWI/EFZEAimXmdA/s1600-h/Image12%5B1%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image12[1]" border="0" alt="Image12[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/Sx33rnUyOtI/AAAAAAAABWU/E-mMCYMRo8w/Image12%5B1%5D_thumb%5B2%5D.png?imgmax=800" width="793" height="372" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;                  &lt;br /&gt;Result&amp;#160; &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/Sx33sm27NTI/AAAAAAAABWg/qbKlr6iTmCk/s1600-h/Image13%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image13[1]" border="0" alt="Image13[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/Sx33txSOD8I/AAAAAAAABWs/2R8q1CYwYQ4/Image13%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="796" height="106" /&gt;&lt;/a&gt;                   &lt;br /&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;            &lt;p&gt;&lt;b&gt;&lt;u&gt;&lt;font face="Courier New"&gt;Syntax&lt;/font&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;            &lt;p&gt;&lt;b&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;            &lt;p&gt;&lt;font face="Courier New"&gt;ADD A B GIVING RESULT                &lt;br /&gt;                &lt;br /&gt;If you would like the final result of arithmetic to be stored in a separate resultant variable, you can always write a &lt;strong&gt;GIVING&lt;/strong&gt; clause at the end. Thus, if A=5 and B=10, the sum(addition of A and B), would yield 15. This sum 15 is stored in the RESULT Variable. &lt;em&gt;On omitting the GIVING Clause, the sum is stored in one of the operands being added. GIVING Clause allows you to specify a separate destination(receiving variable) which shall hold the final result of computation.                  &lt;br /&gt;                  &lt;br /&gt;&lt;/em&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Example                    &lt;br /&gt;&lt;/strong&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;em&gt;                   &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/Sx33vTmNNPI/AAAAAAAABW4/il79CSbsJe8/s1600-h/Image14%5B2%5D%5B3%5D.png"&gt;&lt;strong&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image14[2]" border="0" alt="Image14[2]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/Sx33x3yCxdI/AAAAAAAABXE/3COVleUeoCM/Image14%5B2%5D_thumb%5B1%5D.png?imgmax=800" width="795" height="334" /&gt;&lt;/strong&gt;&lt;/a&gt;                     &lt;br /&gt;&lt;/em&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font face="Courier New"&gt;&lt;font face="Courier New"&gt;                     &lt;br /&gt;&lt;strong&gt;Result                        &lt;br /&gt;                        &lt;br /&gt;&lt;/strong&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/Sx33zG7SCXI/AAAAAAAABXQ/h-vf1SpsADE/s1600-h/Image15%5B1%5D%5B3%5D.png"&gt;&lt;strong&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image15[1]" border="0" alt="Image15[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/Sx330YljfEI/AAAAAAAABXc/KzyYEYWB9TM/Image15%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="800" height="107" /&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;/font&gt; &lt;/font&gt;                &lt;p&gt;&lt;u&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;                &lt;p&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;                &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;ADD A B C GIVING D E                      &lt;br /&gt;                      &lt;br /&gt;&lt;/strong&gt;The GIVING Clause may also specify a list of destination/receiving variables. In that case, sum(addition) is copied to the each of the variables mentioned in the GIVING Clause. For example,                     &lt;br /&gt;Assume that A = 10, B = 15 and C=20.                     &lt;br /&gt;                    &lt;br /&gt;Now the sum of A B C = 10 + 15 + 20 = 45. The sum 45 is stored in each of the variables mentioned in the list(D, E). Thus,                     &lt;br /&gt;D = 45 and E = 45, after the above statement is executed.                     &lt;br /&gt;                    &lt;br /&gt;&lt;strong&gt;Example : &lt;/strong&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;                   &lt;br /&gt;                    &lt;br /&gt;&lt;/font&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/Sx331vaginI/AAAAAAAABXo/1TusI5zATVM/s1600-h/Image16%5B2%5D%5B3%5D.png"&gt;&lt;strong&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image16[2]" border="0" alt="Image16[2]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/Sx3334UiQVI/AAAAAAAABX0/LEWPmInmf70/Image16%5B2%5D_thumb%5B1%5D.png?imgmax=800" width="796" height="393" /&gt;&lt;/strong&gt;&lt;/a&gt;                   &lt;br /&gt;&lt;u&gt;                   &lt;br /&gt;&lt;/u&gt;Result :                   &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/Sx335R5sUeI/AAAAAAAABYA/aHO-BndZO0o/s1600-h/Image17%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image17[1]" border="0" alt="Image17[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/Sx336nH0QNI/AAAAAAAABYM/UEaZ50I9eH8/Image17%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="792" height="129" /&gt;&lt;/a&gt;                   &lt;br /&gt;&lt;u&gt;&lt;strong&gt;                     &lt;br /&gt;Comparing GIVING Clause with TO Clause :                       &lt;br /&gt;&lt;/strong&gt;&lt;/u&gt;                  &lt;br /&gt;&lt;strong&gt;Suppose RESULT = 100.                    &lt;br /&gt;                    &lt;br /&gt;ADD 10 20 GIVING RESULT.&amp;#160; &lt;br /&gt;After the operation, RESULT = 30 (Old value is overwritten with the new value)                     &lt;br /&gt;                    &lt;br /&gt;ADD 10 20 TO RESULT.                     &lt;br /&gt;After the operation, RESULT = 130 (Old value is merely added to the operands, to arrive at the new value)                     &lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;             &lt;/font&gt;&lt;/p&gt;            &lt;p&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="804"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. How does the SUBTRACT Operator work in COBOL?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="804"&gt;           &lt;p&gt;&lt;font face="Courier New"&gt;When you want to find the difference of two or more quantities in COBOL, you use the &lt;strong&gt;SUBTRACT &lt;/strong&gt;operator. The &lt;strong&gt;SUBTRACT &lt;/strong&gt;operator subtracts one quantity from another, and finds out the result. In its simplest form, &lt;strong&gt;SUBTRACT &lt;/strong&gt;has the following syntax :                 &lt;br /&gt;                &lt;br /&gt;&lt;/font&gt;&lt;b&gt;&lt;u&gt;&lt;font face="Courier New"&gt;Syntax                    &lt;br /&gt;                    &lt;br /&gt;&lt;/font&gt;&lt;/u&gt;&lt;/b&gt;&lt;font face="Courier New"&gt;SUBTRACT one-quantity FROM second-quantity                &lt;br /&gt;                &lt;br /&gt;For example,                 &lt;br /&gt;                &lt;br /&gt;SUBTRACT WS-VAR-2 FROM WS-VAR-1                 &lt;br /&gt;                &lt;br /&gt;Consider the variable WS-VAR-1 = 10, WS-VAR-2=30, subtracting WS-VAR-2 from WS-VAR-1 would result in the difference between 30 and 10. The answer is 20. This final result is stored in WS-VAR-2. SUBTRACT B FROM A is equivalent to the statement A = A – B.                 &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh5.ggpht.com/_sQvdFWqMlMg/Sxr5n1vnzAI/AAAAAAAABQo/KFlLDjIMNg0/s1600-h/Image03%5B2%5D%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image03[2]" border="0" alt="Image03[2]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/Sxr5p9YBIbI/AAAAAAAABQs/PG66SYP2myM/Image03%5B2%5D_thumb%5B2%5D.png?imgmax=800" width="777" height="101" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;                &lt;br /&gt;The example above is shown in the code snippet below :                 &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/Sxr5sMT_FQI/AAAAAAAABQw/9oQaELkAS3A/s1600-h/Image04%5B2%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image04[2]" border="0" alt="Image04[2]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/Sxr5vOyB_ZI/AAAAAAAABQ0/5owylTq6ytg/Image04%5B2%5D_thumb%5B3%5D.png?imgmax=800" width="782" height="218" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;The output of the above code snippet would look like this :                 &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/Sxr5woQS4DI/AAAAAAAABQ4/xA9Y0zTbtu8/s1600-h/Image05%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image05[1]" border="0" alt="Image05[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/Sxr5y1nG1vI/AAAAAAAABQ8/Edu0hJDg34s/Image05%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="793" height="136" /&gt;&lt;/a&gt;                 &lt;br /&gt;However, at times, you would like to store the difference between these two quantities in a separate third variable. To do so, you would put the following syntax to use :                 &lt;br /&gt;                &lt;br /&gt;&lt;/font&gt;&lt;b&gt;&lt;u&gt;&lt;font face="Courier New"&gt;Syntax                    &lt;br /&gt;                    &lt;br /&gt;&lt;/font&gt;&lt;/u&gt;&lt;/b&gt;&lt;font face="Courier New"&gt;SUBTRACT variable-1 FROM variable-2 GIVING variable-3&lt;/font&gt;&lt;font face="Courier New"&gt;                &lt;br /&gt;                &lt;br /&gt;For example, you would write SUBTRACT WS-VAR-1 FROM WS-VAR-2 GIVING WS-VAR-3, with WS-VAR-1=30, WS-VAR-2=10, you get WS-VAR-3 = WS-VAR-2 minus WS-VAR-1, i.e. WS-VAR-3 = 30 – 10 = 20.                 &lt;br /&gt;                &lt;br /&gt;Consider the code snippet given below :                 &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/SxyE7XkxexI/AAAAAAAABSc/S5zcjjw-Jgc/s1600-h/Image08%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image08[1]" border="0" alt="Image08[1]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/SxyE9eXhjxI/AAAAAAAABSg/wuvHp-aqhXM/Image08%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="789" height="102" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;                &lt;br /&gt;Upon running the above code snippet, you would get the following output :                 &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/SxyE-SiqyDI/AAAAAAAABSk/A14FCUQ5Saw/s1600-h/Image09%5B2%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image09[2]" border="0" alt="Image09[2]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/SxyE_eB25-I/AAAAAAAABSo/0Lo2g2oD6Q8/Image09%5B2%5D_thumb%5B1%5D.png?imgmax=800" width="794" height="90" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;                &lt;br /&gt;COBOL also gives you the facility to subtract a group of numbers from a given quantity. For example, let’s assume that you want to subtract a group of numbers 4 5 1 from a given sum 25. You compute the result as follows :                 &lt;br /&gt;25 - (4 + 5 + 1) = 15.                 &lt;br /&gt;In COBOL you would write it as,                 &lt;br /&gt;                &lt;br /&gt;SUBTRACT 4 5 1 FROM 25                 &lt;br /&gt;                &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Syntax&lt;/u&gt;&lt;/strong&gt;                 &lt;br /&gt;                &lt;br /&gt;SUBTRACT item-1 item-2 item-3&amp;#160; ... FROM SUM [GIVING OUTPUT]                 &lt;br /&gt;                &lt;br /&gt;The example below shows, how to use this syntax in COBOL                 &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/SxyFBL_Ce3I/AAAAAAAABSs/-hJCWxBr9xE/s1600-h/Image10%5B2%5D%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image10[2]" border="0" alt="Image10[2]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/SxyFDS57gLI/AAAAAAAABSw/iT4s-djlgeo/Image10%5B2%5D_thumb%5B3%5D.png?imgmax=800" width="790" height="325" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;The output of the above code-snippet, when you would run, should look like this -                 &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/SxyFECO3beI/AAAAAAAABS0/PK8GH2BTHmg/s1600-h/Image11%5B3%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image11[3]" border="0" alt="Image11[3]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/SxyFFHpS15I/AAAAAAAABS4/8wc2ImnOiS4/Image11%5B3%5D_thumb%5B1%5D.png?imgmax=800" width="793" height="122" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="804"&gt;           &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. How does MULTIPLY Verb compute the product of two numbers in COBOL?&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="804"&gt;           &lt;p&gt;&lt;font face="Courier New"&gt;The MULTIPLY Verb is used to multiply two quantities together, that results in a Product. Let us assume the following data-variables, that’ll help us to understand the example.                &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/Sx6uABnc2xI/AAAAAAAABcI/ljF2BQu7t8I/s1600-h/Image18%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image18[1]" border="0" alt="Image18[1]" src="http://lh4.ggpht.com/_sQvdFWqMlMg/Sx6uI8z-TzI/AAAAAAAABcU/IWFCMKiWeJ8/Image18%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="795" height="169" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;The general form of MULTIPLY Verb is :                 &lt;br /&gt;                &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Syntax:&lt;/u&gt;&lt;/strong&gt;                 &lt;br /&gt;                &lt;br /&gt;MULTIPLY number-1 BY number-2                 &lt;br /&gt;                &lt;br /&gt;This simple statement, multiplies the number-2 by number-1. For example, if A = 5, MULTIPLY 2 BY A, would result in A getting doubled, so the new value of A=10.                 &lt;br /&gt;                &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/Sx6uPucHphI/AAAAAAAABcg/i-xaTLUX7v4/s1600-h/Image19%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image19[1]" border="0" alt="Image19[1]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/Sx6uY1f0yUI/AAAAAAAABcs/c66WLPfP4EE/Image19%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="790" height="184" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;&lt;strong&gt;Result                  &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh4.ggpht.com/_sQvdFWqMlMg/Sx6ub6SS57I/AAAAAAAABc4/1bcWDZ8l9fk/s1600-h/Image22%5B3%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image22[3]" border="0" alt="Image22[3]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/Sx6ufwzxpBI/AAAAAAAABdE/1NPm3nql6ZY/Image22%5B3%5D_thumb%5B1%5D.png?imgmax=800" width="792" height="119" /&gt;&lt;/a&gt;                   &lt;br /&gt;&lt;/strong&gt;                &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;&lt;u&gt;Syntax:&lt;/u&gt;&lt;/strong&gt;                 &lt;br /&gt;                &lt;br /&gt;MULTIPLY number-1 BY number-2 GIVING result                 &lt;br /&gt;                &lt;br /&gt;As you know, the GIVING Clause specifies a separate destination or receiving variable. So, the product is stored in the GIVING Clause variable result. For example, if A = 10, B = 20, MULTIPLY A BY B GIVING C, results in                 &lt;br /&gt;10 x 20 = 200 getting stored in C.                 &lt;br /&gt;                &lt;br /&gt;&lt;strong&gt;Example                  &lt;br /&gt;                  &lt;br /&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/Sx6umpbmpdI/AAAAAAAABdQ/-9BrCJUqUog/s1600-h/Image20%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image20[1]" border="0" alt="Image20[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/Sx6uvSKFj6I/AAAAAAAABdc/IuOntPiuQ6A/Image20%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="799" height="209" /&gt;&lt;/a&gt; &lt;/strong&gt;                &lt;br /&gt;                &lt;br /&gt;&lt;strong&gt;Result                  &lt;br /&gt;                  &lt;br /&gt;&lt;/strong&gt;&lt;a href="http://lh6.ggpht.com/_sQvdFWqMlMg/Sx6uyKLHlCI/AAAAAAAABdo/8JUKp-RVLRY/s1600-h/Image%2025%5B1%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image%2025[1]" border="0" alt="Image%2025[1]" src="http://lh5.ggpht.com/_sQvdFWqMlMg/Sx6u2837lGI/AAAAAAAABd0/Qd7ohn5Axf8/Image%2025%5B1%5D_thumb%5B1%5D.png?imgmax=800" width="801" height="163" /&gt;&lt;/a&gt;                 &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;&lt;u&gt;Syntax:&lt;/u&gt;&lt;/strong&gt;                 &lt;br /&gt;                &lt;br /&gt;MULTIPLY A BY B C D&amp;#160; &lt;br /&gt;                &lt;br /&gt;This format of MULTIPLY Statement specifies that, A is to be multiplied each of the variables B, C and D, so that it results in the products A x B, A x C, A x D. The final resulting three products are stored in B, C and D itselves. If A = 10, and B = 2, C = 3 and D = 4, after the executing this MULTIPLY instruction, B, C and D become ten-folds, B = 20, C=30 and D=40.                 &lt;br /&gt;                &lt;br /&gt;&lt;strong&gt;Example                  &lt;br /&gt;                  &lt;br /&gt;&lt;/strong&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/Sx6u6hZa5NI/AAAAAAAABeA/m64L7SFPWsg/s1600-h/Image26%5B2%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image26[2]" border="0" alt="Image26[2]" src="http://lh3.ggpht.com/_sQvdFWqMlMg/Sx6u_ciTBDI/AAAAAAAABeM/kDhFO8ChEFc/Image26%5B2%5D_thumb%5B1%5D.png?imgmax=800" width="802" height="263" /&gt;&lt;/a&gt;                 &lt;br /&gt;                &lt;br /&gt;&lt;strong&gt;Result                  &lt;br /&gt;                  &lt;br /&gt;&lt;/strong&gt;&lt;a href="http://lh3.ggpht.com/_sQvdFWqMlMg/Sx6vDDEUjcI/AAAAAAAABeY/jyZA-SFEZbk/s1600-h/Image27%5B2%5D%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Image27[2]" border="0" alt="Image27[2]" src="http://lh6.ggpht.com/_sQvdFWqMlMg/Sx6vG-t8BVI/AAAAAAAABek/sdlwMSKfFQ0/Image27%5B2%5D_thumb%5B1%5D.png?imgmax=800" width="798" height="199" /&gt;&lt;/a&gt;                 &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;&lt;u&gt;                   &lt;br /&gt;Syntax:&lt;/u&gt;&lt;/strong&gt;                 &lt;br /&gt;                &lt;br /&gt;MULTIPLY A BY B C GIVING D E&amp;#160; &lt;br /&gt;                &lt;br /&gt;In this form of the MULTIPLY statement, as you would guess there would be 2 products : A x B (A times B) and                 &lt;br /&gt;A x C(A times C). These final products would be stored in separate receiving variables D and E, as specified by the GIVING Clause.                 &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="804"&gt;           &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Q. How does DIVIDE Verb divide a one operand by another? How do you find the remainder(what’s left over)? &lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="804"&gt;           &lt;p&gt;&lt;font face="Courier New"&gt;The DIVIDE verb in COBOL, is used compute the quotient, upon the division of two numbers. The DIVIDE Verb has several forms available.                &lt;br /&gt;                &lt;br /&gt;DIVIDE A INTO B                &lt;br /&gt;                &lt;br /&gt;Here, the DIVIDE Operator is used to perform simple Division. You divide B into ‘A’ equal parts, how many parts do you get? In other words, this statement calculates the fraction B/A. Assume that you have a chocolate that’s 100&amp;#160; length. If you were to divide it into 5 cm long bars, you would get 100/5 = 20 bars to eat. To do this you would write,                &lt;br /&gt;                &lt;br /&gt;DIVIDE 5 INTO 100                &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;               &lt;br /&gt;DIVIDE A INTO B C                &lt;br /&gt;                &lt;br /&gt;You may also divide the multiple dividends(operands) by the same divisor, using a single statement. Suppose A=2, and B=58,C=156. Then, DIVIDE A INTO B C would mean that you are trying to divide 2 into 58 and 156. So, both 58 and 156 would be halved to 29 and 78.                &lt;br /&gt;                &lt;br /&gt;DIVIDE A INTO B C GIVING D E                &lt;br /&gt;                &lt;br /&gt;GIVING Clause can be used optionally to specify separate receiving/destination variables for storing the results.                &lt;br /&gt;                &lt;br /&gt;DIVIDE B BY A GIVING C                &lt;br /&gt;                &lt;br /&gt;You can also use the BY Clause to specify the dividend first and then the divisor.                &lt;br /&gt;                &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-5864727944522888634?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/qJGaelmMd76jVFTdpmXky_9s4fs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qJGaelmMd76jVFTdpmXky_9s4fs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/qJGaelmMd76jVFTdpmXky_9s4fs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qJGaelmMd76jVFTdpmXky_9s4fs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/3NpMi4IvLTw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/5864727944522888634/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2009/09/cobol-tutorial-arithmetic-operators.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5864727944522888634?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5864727944522888634?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/3NpMi4IvLTw/cobol-tutorial-arithmetic-operators.html" title="COBOL Tutorial – Arithmetic Operators" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.mainframes360.com/2009/09/cobol-tutorial-arithmetic-operators.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8DQHY_eyp7ImA9Wx5TEE8.&quot;"><id>tag:blogger.com,1999:blog-5079547514004526903.post-5391321940999236660</id><published>2009-09-02T08:50:00.001+05:30</published><updated>2010-07-25T07:24:31.843+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-25T07:24:31.843+05:30</app:edited><title>REDEFINES Clause, RENAMES Clause</title><content type="html">&lt;br /&gt;  &lt;table border="1" cellspacing="0" cellpadding="0" width="400"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="400"&gt;         &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;Contents&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;          &lt;ol&gt;           &lt;li&gt;&lt;strong&gt;&lt;font face="Courier New"&gt;&lt;a href="http://www.mainframes360.com/2009/09/cobol-tutorial-data-division-part-iv.html#label1"&gt;REDEFINES Clause&lt;/a&gt;&lt;/font&gt;&lt;/strong&gt; &lt;strong&gt;&lt;font face="Courier New"&gt;&lt;a href="http://www.mainframes360.com/2009/08/cobol-tutorial-data-division-part-i.html#label3"&gt;&lt;/a&gt;&lt;/font&gt;&lt;/strong&gt;              &lt;ol&gt;               &lt;li&gt;&lt;strong&gt;&lt;font face="Courier New"&gt;&lt;a href="#1.1"&gt;Simple Program to show how REDEFINES Works&lt;/a&gt;&lt;/font&gt;&lt;/strong&gt; &lt;/li&gt;             &lt;/ol&gt;           &lt;/li&gt;            &lt;li&gt;&lt;strong&gt;&lt;font face="Courier New"&gt;&lt;a href="#2"&gt;RENAMES Clause&lt;/a&gt;&lt;/font&gt;&lt;/strong&gt;               &lt;ol&gt;               &lt;li&gt;&lt;strong&gt;&lt;font face="Courier New"&gt;&lt;a href="#2.1"&gt;Simple Program to show how RENAMES Clause works&lt;/a&gt;&lt;/font&gt;&lt;/strong&gt; &lt;/li&gt;             &lt;/ol&gt;           &lt;/li&gt;         &lt;/ol&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;/p&gt;  &lt;br /&gt;  &lt;table border="1" cellspacing="0" cellpadding="0" width="679"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="677"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;&lt;a name="label1"&gt;&lt;/a&gt;Q. What is the REDEFINES Clause in COBOL? Why is it used?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="677"&gt;         &lt;p&gt;&lt;font face="Courier New"&gt;REDFINES Clause can be used to define two group data-items which point to the same storage area. You can use both the data-items in the same COBOL Program.&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font face="Courier New"&gt;Suppose, we have a storage area defined in the Working Storage section as&lt;/font&gt;&lt;/p&gt;          &lt;p&gt;&lt;font face="Courier New"&gt;01 EMPLOYEE-DETAILS.              &lt;br /&gt;&amp;#160;&amp;#160; 02 EMP-NAME PIC X(30).               &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; 02 EMP-NAME-DETAILS REDEFINES EMP-NAME.              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 03 EMP-FNAME PIC X(10).               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 03 EMP-MNAME PIC X(10).               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 03 EMP-LNAME PIC X(10).&lt;/font&gt;&amp;#160; &lt;br /&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; 02 EMP-ADDRESS PIC X(26).              &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; 02 EMP-ADDRESS-DETAILS REDEFINES EMP-ADDRESS.              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 03 EMP-STREET PIC X(10).               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 03 EMP-CITY PIC X(10).               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 03 EMP-PINCODE PIC X(6).               &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160; 02 EMP-CONTACT PIC X(20).              &lt;br /&gt;              &lt;br /&gt;&amp;#160;&amp;#160; 02 EMP-CONTACT-DETAILS REDEFINES EMP-CONTACT.               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 03 EMP-PHONE1 PIC 9(10).               &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 03 EMP-PHONE2 PIC 9(10).               &lt;br /&gt;              &lt;br /&gt;Note that :               &lt;br /&gt;1) In the above example, EMP-NAME has been redefined as EMP-NAME-DETAILS, EMP-ADDRESS is redefined as EMP-ADDRESS-DETAILS and EMP-CONTACT is redefined as               &lt;br /&gt;EMP-CONTACT-DETAILS. So, EMP-NAME occupies 30 bytes of storage area. The same 30-byte storage area is also pointed to by EMP-NAME-DETAILS, and it provides a breakup into FNAME, MNAME and LNAME. This is a common and typical use of &lt;b&gt;REDEFINES &lt;/b&gt;clause.               &lt;br /&gt;              &lt;br /&gt;2) One cannot use the REDFINES clause with 01-level(root-level) data-items in the &lt;b&gt;FILE SECTION&lt;/b&gt;. It also should not be used 66-level(renames clause) and 88-level(condition names).               &lt;br /&gt;              &lt;br /&gt;3) The data-item which you want to redefine should not have a OCCURS Clause.               &lt;br /&gt;              &lt;br /&gt;4) Note that, the original data-items and redefined ones both refer to the same memory location in storage area. Hence, in the above example, the total space occupied by EMPLOYEE-DETAILS still remains the same = 30+26+20 = 76.               &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="677"&gt;         &lt;p&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;&lt;a name="1.1"&gt;&lt;/a&gt;Q. Show me a COBOL Program that demonstrates how to use the REDEFINES Clause&lt;/strong&gt;.&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="677"&gt;         &lt;p&gt;&lt;font face="Courier New"&gt;Given below is a COBOL Program that shows a practical use of REDEFINES.              &lt;br /&gt;              &lt;br /&gt;&lt;img src="http://lh3.ggpht.com/_sQvdFWqMlMg/Sp3fN3rKFtI/AAAAAAAABN0/FZ3dn5UDBPo/s800/COBOL 1.23.png" /&gt;               &lt;br /&gt;&lt;img src="http://lh4.ggpht.com/_sQvdFWqMlMg/Sp3fN5GrpjI/AAAAAAAABN4/fZO6C0PjVJY/s800/COBOL 1.24.png" /&gt;               &lt;br /&gt;&lt;img src="http://lh4.ggpht.com/_sQvdFWqMlMg/Sp3fNzLjqkI/AAAAAAAABN8/ujKn4Fnj-yc/s800/COBOL 1.25.png" /&gt;&amp;#160; &lt;br /&gt;              &lt;br /&gt;Upon running the above COBOL Program LOAD, we get the following output in the SYSOUT Dataset -               &lt;br /&gt;              &lt;br /&gt;&lt;img src="http://lh4.ggpht.com/_sQvdFWqMlMg/Sp3fN6QjVKI/AAAAAAAABOA/WAOn1JyJjNo/s800/COBOL 1.26.png" /&gt;               &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="677"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;&lt;a name="2"&gt;&lt;/a&gt;Q. What is the RENAMES Clause? Is it a good practice to use the RENAMES Clause?&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="677"&gt;         &lt;p&gt;&lt;font face="Courier New"&gt;The RENAMES clause is used to regroup data-items. The RENAMES Clause entry always must have level no. 66. You can take existing Data-items, and re-group them, and create a new copy in the memory under a new data-name. Note, that both the copies – the memory locations always remain in sync. While using the RENAMES clause, one must follow certain rules in COBOL. They are as follows :              &lt;br /&gt;              &lt;br /&gt;1) RENAMES clause has the following syntax               &lt;br /&gt;              &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;66 &lt;i&gt;new-data-name &lt;/i&gt;RENAMES &lt;i&gt;data-item-1 &lt;/i&gt;THRU &lt;/strong&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;i&gt;&lt;strong&gt;data-item-2                  &lt;br /&gt;&lt;/strong&gt;&lt;/i&gt;2) The 66 level RENAMES entry should immediately follow data-items 1 and 2.               &lt;br /&gt;              &lt;br /&gt;3) The Data-Items 1 and 2 should not be 01-Level record entries.               &lt;br /&gt;              &lt;br /&gt;4) The Data-Items 1 and 2 should be contiguous.               &lt;br /&gt;              &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;5) The new-data name should be one logical level higher than the data-item-1 and data-item-2.              &lt;br /&gt;              &lt;br /&gt;6) The use of RENAMES Clause has often been debated in COBOL, and its considered a malpractice to use the RENAMES Clause now-a-days. Instead, one must opt for REDEFINES Clause.               &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="677"&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;&lt;a name="2.1"&gt;&lt;/a&gt;Q. Show me a simple working example of the RENAMES Clause..&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="677"&gt;         &lt;p&gt;&lt;font face="Courier New"&gt;Given below is a basic COBOL Program, that shows how to use the RENAMES Clause.              &lt;br /&gt;              &lt;br /&gt;              &lt;br /&gt;&lt;img src="http://lh4.ggpht.com/_sQvdFWqMlMg/Sp3izrE8nrI/AAAAAAAABOI/Bec1kTPHZLU/s800/COBOL 1.27.png" /&gt;               &lt;br /&gt;&lt;img src="http://lh6.ggpht.com/_sQvdFWqMlMg/Sp3izjEODxI/AAAAAAAABOM/zrg2JKuNjZI/s800/COBOL 1.28.png" /&gt;               &lt;br /&gt;&lt;/font&gt;            &lt;br /&gt;&lt;font face="Courier New"&gt;In the above example, there are two copies of FIELD-B, one in record-1 and another in record-3. Note that both copies of FIELD-B will always contain the same value/contents. Any changes to FIELD-B will affect record-1 as well as record-3. Note that, unlike REDEFINES clause, RENAMES clause occupies actual physical storage space. Upon submitting the above COBOL Program LOAD, we get the following output in the SYSOUT Dataset.              &lt;br /&gt;              &lt;br /&gt;&lt;img src="http://lh3.ggpht.com/_sQvdFWqMlMg/Sp3iz9TekXI/AAAAAAAABOQ/0NpDqRiFWe4/s800/COBOL 1.29.png" /&gt;               &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5079547514004526903-5391321940999236660?l=www.mainframes360.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/FIFkNkCQNW9Wrym7xtAZxgxjLlQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FIFkNkCQNW9Wrym7xtAZxgxjLlQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/FIFkNkCQNW9Wrym7xtAZxgxjLlQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FIFkNkCQNW9Wrym7xtAZxgxjLlQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~4/8Elb_L0B7Wk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.mainframes360.com/feeds/5391321940999236660/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.mainframes360.com/2009/09/cobol-tutorial-data-division-part-iv.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5391321940999236660?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5079547514004526903/posts/default/5391321940999236660?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MainframesTutorialJclTutorialVsamTutorialCobolTutorialDb2TutorialCics/~3/8Elb_L0B7Wk/cobol-tutorial-data-division-part-iv.html" title="REDEFINES Clause, RENAMES Clause" /><author><name>Quasar</name><uri>http://www.blogger.com/profile/08678298971703810516</uri><email>quasar.chunawalla@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="10894076515714785841" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_sQvdFWqMlMg/Sp3fN3rKFtI/AAAAAAAABN0/FZ3dn5UDBPo/s72-c/COBOL" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://www.mainframes360.com/2009/09/cobol-tutorial-data-division-part-iv.html</feedburner:origLink></entry></feed>
