Re: INITILAIZE COST
On Mon, 11 Aug 2014 20:37:05 -0500 Ron Thomas ron5...@gmail.com wrote: :We have a array like this , what would be best way to initlaize this array in terms of performance ? :01 EXAMPLE-TABLE. :05 MY-TABLE. :10 TABLE-ENTRY OCCURS TIMES. :15 FIRST-NAME PIC X(15). :15 LAST-NAME PIC X(15). :15 SEX-CODE PIC X. :15 DOB. :20 DOB- PIC 9(4). :20 DOB-MM PIC 99. :20 DOB-DD PIC 99. :15 SSNPIC 9(9). :15 SALARY PIC S9(9)V99 COMP-3. What would you initialize it to? Why must it be initialized? Most efficient would be to not initialize it. -- Binyamin Dissen bdis...@dissensoftware.com http://www.dissensoftware.com Director, Dissen Software, Bar Grill - Israel Should you use the mailblocks package and expect a response from me, you should preauthorize the dissensoftware.com domain. I very rarely bother responding to challenge/response systems, especially those from irresponsible companies. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: INITILAIZE COST
At 20:01 -0700 on 08/11/2014, Duffy Nightingale, SS wrote about Re: INITILAIZE COST: Heavy emphasis on that last sentence. Just had a customer who didn't keep track of the number of entries in his COBOL table while adding new ones. Ended up adding entries way beyond the end of his table leading to altering the fields following the table to wrong values leading to very strange scary looking dumps that seemed to point to big problems in unsupported code! But, nope, simple, his table got bigger than the definition. I thought the code spotted an attempt to go beyond the end of the table by exceeding the OCCURS value or am I thinking of PL/I which would catch this error? -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: INITILAIZE COST
At 21:08 -0600 on 08/11/2014, Steve Comstock wrote about Re: INITILAIZE COST: Well, of course, we don't really know what the OP wanted. In terms of performance, you want to code a VALUE clause on each elementary item. This results in the whole table being initialized (assuming COBOL 4.2 (I think) or later) in the load module / program object so the table is initialized at the time the program is loaded. The disadvantage is that the LM/PO size is larger and includes the already initialized table. OTOH: The load time for the large module is much smaller than the execute time it would take to fill in the table at execute time. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: INITILAIZE COST
On Tue, Aug 12, 2014 at 5:01 AM, Robert A. Rosenberg hal9...@panix.com wrote: At 20:01 -0700 on 08/11/2014, Duffy Nightingale, SS wrote about Re: INITILAIZE COST: Heavy emphasis on that last sentence. Just had a customer who didn't keep track of the number of entries in his COBOL table while adding new ones. Ended up adding entries way beyond the end of his table leading to altering the fields following the table to wrong values leading to very strange scary looking dumps that seemed to point to big problems in unsupported code! But, nope, simple, his table got bigger than the definition. I thought the code spotted an attempt to go beyond the end of the table by exceeding the OCCURS value or am I thinking of PL/I which would catch this error? COBOL _can_ do that. But you must: (1) compile with the SSRANGE option; and (2) run with the SSRANGE turned on. Most shops avoid these options like the plague because, at least in the past, the CPU overhead was horrendous. IIRC, it is even worse if you use OCCURS DEPENDING ON because the range can't be determined at compile time. It ranks right u there with DISPLAY ... UPON CONSOLE as anathema. I also hate programmers who leave their debugging DISPLAY ... UPON SYSOUT in the production code. We have some programs that produce 1,000 lines of report output and 2 million lines of debug output. Code review! you say? Too much time and effort! is the reply. And management keeps saying: Who cares? The mainframe is going away soon! -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! John McKown -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: INITILAIZE COST
On Tue, 12 Aug 2014 06:01:52 -0400, Robert A. Rosenberg wrote: At 20:01 -0700 on 08/11/2014, Duffy Nightingale, SS wrote about Re: INITILAIZE COST: Heavy emphasis on that last sentence. Just had a customer who didn't keep track of the number of entries in his COBOL table while adding new ones. Ended up adding entries way beyond the end of his table leading to altering the fields following the table to wrong values leading to very strange scary looking dumps that seemed to point to big problems in unsupported code! But, nope, simple, his table got bigger than the definition. I thought the code spotted an attempt to go beyond the end of the table by exceeding the OCCURS value or am I thinking of PL/I which would catch this error? It's a COBOL compiler option. The default is NO. http://www-01.ibm.com/support/knowledgecenter/api/content/SS6SG3_5.1.0/com.ibm.cobol511.ent.doc/custom/igycch257.html Norbert Friemel -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: INITILAIZE COST
Initializing this way could be better than just INITIALIZE MOVE SPACES TO MY-TABLE INITIALIZE MY-TABLE REPLACING NUMERIC BY ZEROES. On Tuesday, 12 August 2014 4:16 PM, Binyamin Dissen bdis...@dissensoftware.com wrote: On Mon, 11 Aug 2014 20:37:05 -0500 Ron Thomas ron5...@gmail.com wrote: :We have a array like this , what would be best way to initlaize this array in terms of performance ? :01 EXAMPLE-TABLE. : 05 MY-TABLE. : 10 TABLE-ENTRY OCCURS TIMES. : 15 FIRST-NAME PIC X(15). : 15 LAST-NAME PIC X(15). : 15 SEX-CODE PIC X. : 15 DOB. : 20 DOB- PIC 9(4). : 20 DOB-MM PIC 99. : 20 DOB-DD PIC 99. : 15 SSN PIC 9(9). : 15 SALARY PIC S9(9)V99 COMP-3. What would you initialize it to? Why must it be initialized? Most efficient would be to not initialize it. -- Binyamin Dissen bdis...@dissensoftware.com http://www.dissensoftware.com Director, Dissen Software, Bar Grill - Israel Should you use the mailblocks package and expect a response from me, you should preauthorize the dissensoftware.com domain. I very rarely bother responding to challenge/response systems, especially those from irresponsible companies. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: INITILAIZE COST
-Original Message- From: IBM Mainframe Discussion List On Behalf Of Robert A. Rosenberg At 20:01 -0700 on 08/11/2014, Duffy Nightingale, SS wrote about Re: INITILAIZE COST: Heavy emphasis on that last sentence. Just had a customer who didn't keep track of the number of entries in his COBOL table while adding new ones. Ended up adding entries way beyond the end of his table leading to altering the fields following the table to wrong values leading to very strange scary looking dumps that seemed to point to big problems in unsupported code! But, nope, simple, his table got bigger than the definition. I thought the code spotted an attempt to go beyond the end of the table by exceeding the OCCURS value or am I thinking of PL/I which would catch this error? Depends on compile-time option SSRANGE / NOSSRANGE. http://www-01.ibm.com/support/knowledgecenter/SS6SG3_5.1.0/com.ibm.cobol511.ent.doc/custom/igycch257.html?lang=en -jc- ** Information contained in this e-mail message and in any attachments thereto is confidential. If you are not the intended recipient, please destroy this message, delete any copies held on your systems, notify the sender immediately, and refrain from using or disclosing all or any part of its content to any other person. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: INITILAIZE COST
01 EXAMPLE-TABLE. 05 MY-COUNT PIC S9(9) COMP VALUE 0. 05 MY-TABLE. On Mon, Aug 11, 2014 at 8:37 PM, Ron Thomas ron5...@gmail.com wrote: Hello. We have a array like this , what would be best way to initlaize this array in terms of performance ? 01 EXAMPLE-TABLE. 05 MY-TABLE. 10 TABLE-ENTRY OCCURS TIMES. 15 FIRST-NAME PIC X(15). 15 LAST-NAME PIC X(15). 15 SEX-CODE PIC X. 15 DOB. 20 DOB- PIC 9(4). 20 DOB-MM PIC 99. 20 DOB-DD PIC 99. 15 SSNPIC 9(9). 15 SALARY PIC S9(9)V99 COMP-3. Thanks Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- Mike A Schwab, Springfield IL USA Where do Forest Rangers go to get away from it all? -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
INITILAIZE COST
Hello. We have a array like this , what would be best way to initlaize this array in terms of performance ? 01 EXAMPLE-TABLE. 05 MY-TABLE. 10 TABLE-ENTRY OCCURS TIMES. 15 FIRST-NAME PIC X(15). 15 LAST-NAME PIC X(15). 15 SEX-CODE PIC X. 15 DOB. 20 DOB- PIC 9(4). 20 DOB-MM PIC 99. 20 DOB-DD PIC 99. 15 SSNPIC 9(9). 15 SALARY PIC S9(9)V99 COMP-3. Thanks Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: INITILAIZE COST
On 8/11/2014 7:37 PM, Ron Thomas wrote: Hello. We have a array like this , what would be best way to initlaize this array in terms of performance ? 01 EXAMPLE-TABLE. 05 MY-TABLE. 10 TABLE-ENTRY OCCURS TIMES. 15 FIRST-NAME PIC X(15). 15 LAST-NAME PIC X(15). 15 SEX-CODE PIC X. 15 DOB. 20 DOB- PIC 9(4). 20 DOB-MM PIC 99. 20 DOB-DD PIC 99. 15 SSNPIC 9(9). 15 SALARY PIC S9(9)V99 COMP-3. Thanks Ron T Put a VALUE clause on each elementary item. -Steve Comstock -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: INITILAIZE COST
Don't. Use occurs depending on or keep track of number of entries in a separate variable. Populate entries as needed. All valid entrIes are initialized when populated. Restrict subsequent operations to number of rows in table. On Aug 11, 2014 6:37 PM, Ron Thomas ron5...@gmail.com wrote: Hello. We have a array like this , what would be best way to initlaize this array in terms of performance ? 01 EXAMPLE-TABLE. 05 MY-TABLE. 10 TABLE-ENTRY OCCURS TIMES. 15 FIRST-NAME PIC X(15). 15 LAST-NAME PIC X(15). 15 SEX-CODE PIC X. 15 DOB. 20 DOB- PIC 9(4). 20 DOB-MM PIC 99. 20 DOB-DD PIC 99. 15 SSNPIC 9(9). 15 SALARY PIC S9(9)V99 COMP-3. Thanks Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: INITILAIZE COST
Heavy emphasis on that last sentence. Just had a customer who didn't keep track of the number of entries in his COBOL table while adding new ones. Ended up adding entries way beyond the end of his table leading to altering the fields following the table to wrong values leading to very strange scary looking dumps that seemed to point to big problems in unsupported code! But, nope, simple, his table got bigger than the definition. Duffy Nightingale Sound Software Printing, Inc. du...@soundsoftware.us www.soundsoftware.us Phone: 360.385.3456 Fax: 973.201.8921 The information in this e-mail, and any attachment therein, is confidential and for use by the addressee only. If you are not the intended recipient, please return the e-mail to the sender and delete it from your computer. Although Sound Software Printing, Inc. attempts to sweep e-mail and attachments for viruses, it does not guarantee that either are virus-free and accepts no liability for any damage sustained as a result of viruses. On Aug 11, 2014, at 6:43 PM, Sam Siegel s...@pscsi.net wrote: Don't. Use occurs depending on or keep track of number of entries in a separate variable. Populate entries as needed. All valid entrIes are initialized when populated. Restrict subsequent operations to number of rows in table. On Aug 11, 2014 6:37 PM, Ron Thomas ron5...@gmail.com wrote: Hello. We have a array like this , what would be best way to initlaize this array in terms of performance ? 01 EXAMPLE-TABLE. 05 MY-TABLE. 10 TABLE-ENTRY OCCURS TIMES. 15 FIRST-NAME PIC X(15). 15 LAST-NAME PIC X(15). 15 SEX-CODE PIC X. 15 DOB. 20 DOB- PIC 9(4). 20 DOB-MM PIC 99. 20 DOB-DD PIC 99. 15 SSNPIC 9(9). 15 SALARY PIC S9(9)V99 COMP-3. Thanks Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: INITILAIZE COST
On 8/11/2014 7:43 PM, Sam Siegel wrote: Don't. Use occurs depending on or keep track of number of entries in a separate variable. Populate entries as needed. All valid entrIes are initialized when populated. Restrict subsequent operations to number of rows in table. Well, of course, we don't really know what the OP wanted. In terms of performance, you want to code a VALUE clause on each elementary item. This results in the whole table being initialized (assuming COBOL 4.2 (I think) or later) in the load module / program object so the table is initialized at the time the program is loaded. Of course, all the entries will be the same. So what was the OP after? An advantage of doing this also allows you to re-initialize the table with the INITIALIZE verb. But, of course, maybe the data the OP wants to put into the table is from an external file or data base. We don't really know. -Steve Comstock On Aug 11, 2014 6:37 PM, Ron Thomas ron5...@gmail.com wrote: Hello. We have a array like this , what would be best way to initlaize this array in terms of performance ? 01 EXAMPLE-TABLE. 05 MY-TABLE. 10 TABLE-ENTRY OCCURS TIMES. 15 FIRST-NAME PIC X(15). 15 LAST-NAME PIC X(15). 15 SEX-CODE PIC X. 15 DOB. 20 DOB- PIC 9(4). 20 DOB-MM PIC 99. 20 DOB-DD PIC 99. 15 SSNPIC 9(9). 15 SALARY PIC S9(9)V99 COMP-3. Thanks Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: INITILAIZE COST
On Mon, Aug 11, 2014 at 8:37 PM, Ron Thomas ron5...@gmail.com wrote: Hello. We have a array like this , what would be best way to initlaize this array in terms of performance ? 01 EXAMPLE-TABLE. 05 MY-TABLE. 10 TABLE-ENTRY OCCURS TIMES. 15 FIRST-NAME PIC X(15). 15 LAST-NAME PIC X(15). 15 SEX-CODE PIC X. 15 DOB. 20 DOB- PIC 9(4). 20 DOB-MM PIC 99. 20 DOB-DD PIC 99. 15 SSNPIC 9(9). 15 SALARY PIC S9(9)V99 COMP-3. Thanks Ron T If you want to initialize it only once, just use the VALUE clause and put it in WORKING-STORAGE. If it is in a subroutine and you want it reinitialized every time the subroutine is CALL'ed, then use a VALUE clause but put it in the LOCAL-STORAGE. WORKING-STORAGE is initialized once per run-unit whereas LOCAL-STORAGE is initialized every time the program is executed (via a CALL). I don't recommend doing the following, but it will probably be the fastest way, assuming you want to initialize it multiple times. 01 EXAMPLE-TABLE. 05 MY-TABLE. 10 TABLE-ENTRY OCCURS TIMES. 15 FIRST-NAME PIC X(15). 15 LAST-NAME PIC X(15). 15 SEX-CODE PIC X. 15 DOB. 20 DOB- PIC 9(4). 20 DOB-MM PIC 99. 20 DOB-DD PIC 99. 15 SSNPIC 9(9). 15 SALARY PIC S9(9)V99 COMP-3. * 01 EXAMPLE-TABLE-I.. 05 MY-TABLE-I. 10 TABLE-ENTRY-I OCCURS TIMES. 15 FIRST-NAME-I PIC X(15) VALUE SPACES. 15 LAST-NAME-I PIC X(15) VALUE SPACES. 15 SEX-CODE -I PIC X VALUE SPACES 15 DOB-I. 20 DOB--I PIC 9(4) VALUE ZERO. 20 DOB-MM-I PIC 99 VALUE ZERO. 20 DOB-DD -IPIC 99 VALUE ZERO. 15 SSN-I PIC 9(9) VALUE ZERO. 15 SALARY-I PIC S9(9)V99 COMP-3. VALUE ZERO. IF LENGTH OF EXAMPLE-TABLE IS NOT EQUAL TO LENGTH OF EXAMPLE-TABLE-I THEN DISPLAY 'PROGRAM DEFINITION ERROR FOR EXAMPLE-TABLE.' UPON SYSOUT DISPLAY 'PROGRAM ABORTING. KILL THE PROGRAMMER!' UPON SYSOUT MOVE +16 TO RETURN-CODE STOP RUN. END-IF MOVE EXAMPLE-TABLE-I TO EXAMPLE-TABLE END-MOVE. Of course, this has many drawbacks. The biggest being that you must keep the EXAMPLE-TABLE and EXAMPLE-TABLE-I in sync. If you don't want this worry, then use the VALUE clause like I showed above. And use the sentence: INITIALIZE EXAMPLE-TABLE to reinitialize the table. From what I have read, this is not CPU efficient. I don't know why. -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! John McKown -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN