how to convert an ARRAY into Linklist.



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

how to convert an ARRAY into Linklist.

Postby vikkysharma » Tue Apr 16, 2013 5:07 pm

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
vikkysharma
 
Posts: 14
Joined: Sun Jan 20, 2013 4:01 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to convert an ARRAY into Linklist.

 

Re: how to convert an ARRAY into Linklist.

Postby Robert Sample » Tue Apr 16, 2013 5:29 pm

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.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: how to convert an ARRAY into Linklist.

Postby vikkysharma » Tue Apr 16, 2013 5:35 pm

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.
vikkysharma
 
Posts: 14
Joined: Sun Jan 20, 2013 4:01 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to convert an ARRAY into Linklist.

Postby Robert Sample » Tue Apr 16, 2013 5:51 pm

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?
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: how to convert an ARRAY into Linklist.

Postby BillyBoyo » Tue Apr 16, 2013 6:04 pm

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?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: how to convert an ARRAY into Linklist.

Postby enrico-sorichetti » Tue Apr 16, 2013 6:13 pm

a simple googling with cobol linked lists returned a link to
http://mck9web.com/cobol/tech/linklist.html
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: how to convert an ARRAY into Linklist.

Postby dick scherrer » Wed Apr 17, 2013 1:37 am

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
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: how to convert an ARRAY into Linklist.

Postby vikkysharma » Thu Apr 18, 2013 11:52 am

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.
vikkysharma
 
Posts: 14
Joined: Sun Jan 20, 2013 4:01 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to convert an ARRAY into Linklist.

Postby NicC » Thu Apr 18, 2013 12:26 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: how to convert an ARRAY into Linklist.

Postby Robert Sample » Thu Apr 18, 2013 2:33 pm

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)?
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post