Page 1 of 2

how to convert an ARRAY into Linklist.

PostPosted: Tue Apr 16, 2013 5:07 pm
by vikkysharma
my code is reading an VSAM file and load into below table .

01  WST-MX-TEXT-POINT-TABLE.                                 
    05  WST-TXT-MX-COUNT        PIC  9(08)      VALUE 0.     
    05  WST-TXT-MX-MAX          PIC  9(08)      VALUE 70000.
    05  WST-MX-TXT-DETAIL   OCCURS 0 TO 70000 TIMES         
                            DEPENDING ON WST-TXT-MX-COUNT   
                            ASCENDING KEY IS WST-TXT-MX-MMX 
                            INDEXED BY TXTMXI.               
        10  WST-TXT-MX-KEY.                                 
            15  WST-TXT-MX-MMX  PIC  X(3).                   
            15  WST-TXT-MX-LINE PIC  X(4).                   
            15  WST-TXT-MX-INTL PIC  X(1).             

i want to replace this table from Link-list structure .
please provide suggestions.

Code'd

Re: how to convert an ARRAY into Linklist.

PostPosted: Tue Apr 16, 2013 5:29 pm
by Robert Sample
IBM defines a link list as
LNKLST concatenation is a group of system and user defined libraries which form part of the system search order for load modules
So you're going to turn a table into a load module? Have you discussed this plan with your site support group? If not, you need to do so since it is rare for a site to permit an application programmer to make any changes to a link list due to the potential problems of such changes.

Re: how to convert an ARRAY into Linklist.

PostPosted: Tue Apr 16, 2013 5:35 pm
by vikkysharma
hi Robert,

this is part of cobol program , where a file is loading to an internal cobol table, i want to replace that internal table logic with Link-list data structure logic.

Re: how to convert an ARRAY into Linklist.

PostPosted: Tue Apr 16, 2013 5:51 pm
by Robert Sample
I think you do not understand what a linklist is. There is no such thing as a "(l)ink-list data structure" -- the link list consists of program load libraries (both system and application) which are used to locate a load module if the load module is not located in the STEPLIB or JOBLIB. As such, there CANNOT be a "link-list data structure" since the linklist is nothing but a sequence of load libraries.

Perhaps rather than deciding upon your solution and asking questions about it that really make no sense, why don't you go back to the beginning and tell us what your problem is (such as batch? CICS? IMS? DB2?) and let us suggest solutions?

Re: how to convert an ARRAY into Linklist.

PostPosted: Tue Apr 16, 2013 6:04 pm
by BillyBoyo
You mean you want a "linked-list". A data-structure when one item points to the next item in the array (and the previous, as well).

Why do you want to do this?

Re: how to convert an ARRAY into Linklist.

PostPosted: Tue Apr 16, 2013 6:13 pm
by enrico-sorichetti
a simple googling with cobol linked lists returned a link to
http://mck9web.com/cobol/tech/linklist.html

Re: how to convert an ARRAY into Linklist.

PostPosted: Wed Apr 17, 2013 1:37 am
by dick scherrer
Hi Bill,

You mean you want a "linked-list". A data-structure when one item points to the next item in the array (and the previous, as well).

Why do you want to do this?
We often did this to link/chain entries so we could move forward and backward thru the entries quickly. Especially if there were multiple starting/ending points.

All of the early database systems i worked with (or developed<g>) used this to manage the data on dasd. The 2-way linked-list was our friend ;)

It would be interesting to hear what this particular implementation is to support.

d

Re: how to convert an ARRAY into Linklist.

PostPosted: Thu Apr 18, 2013 11:52 am
by vikkysharma
i want to optimize my code and my strobe's report showing that table I/O is taking maximum CPU, i just want to try linklist in the place of internal table.
hope it will works and get to optimize my code.

Re: how to convert an ARRAY into Linklist.

PostPosted: Thu Apr 18, 2013 12:26 pm
by NicC
Tables and linked lists have nothing to do with I/O time - a record will take as long to read into/write from a linked list as it would from a table. Linked lists and tables are held in memory - not on DASD.
If your strobe report was showing a long time doing table processing then you could look at linked lists - if they were a viable alternative way of holding the data.

Re: how to convert an ARRAY into Linklist.

PostPosted: Thu Apr 18, 2013 2:33 pm
by Robert Sample
vikkysharma, let's go back to the beginning. Terminology is critical in IT where similar terms may mean very different things. A linked list is a data structure that can be implemented in COBOL; a linklist is an IBM mainframe term for a way to access programs without having to specify where they are and cannot, under any circumstances, be implemented in a COBOL program. You keep using the second term but the context you are using indicates you mean the first term. So figure out which you want and use the right term.

Next, you need to explain things more clearly. By "table I/O" do you mean STROBE is indicating that accessing a DB2 (or other data base) table is using the most time? If so, then linked lists will not likely help you. If not, then you need to explain what you mean since STROBE will NOT show I/O into COBOL tables -- STROBE merely shows overall I/O.

You also need to define your environment -- are you dealing with a batch program? CICS program? IMS program? How much data are you reading / writing? What is the STROBE report showing (a peak of 7% program time on one statement implies different things than a peak of 70% of the program time on one statement)?