IDMS

 View Only
  • 1.  Trawling through dictionary structures

    Posted Mar 21, 2025 06:23 AM

    Dear all,

    It's been about 5 months since I started my journey into IDMS land, and oh have I learned a lot, and mostly I've learned how much more there is to learn also!

    I now have an interesting task that I would appreciate any feedback on from the real experts here.

    I have a COBOL program that reads the IDMSNWKA database processing several record types to produce a list of AREAs, RECORDs and SETs.  What I am trying to do is alter/extend this program to retrieve a list of RECORDs, SETs, INDEX AREAs and SUBAREAs when given a starting point of a single AREA.  I don't know if this is possible, but I've been able to hack my original program to simply return a list or RECORDs and SETs associated with an AREA.  Given what the program already did, this was relatively trivial - but I would like to do it more efficiently, as well as retrieving as much information from the system catalog as possible at the same time.

    Here's a rough outline of how my current program does what it does:

    For starters, these are the records used:

    S-010
    SOR-046
    SMR-052
    SAM-056
    RCDSYN-079
    SRCD-113

    We start with checking that the SCHEMA matches what we've been asked for from S-010 and then walk the set of S-SRCD processing all records.

    For each record in this set we obtain an Owner from RCDSYN-SRCD.  From that Owner we then:

    Obtain the list of its AREAs from SRCD-SAM.
    Get any sets it owns from SRCD-SOR, and for these get their members from SOR-SMR and associated AREAs via their owner in SRCD-SMR.
    Get a list of its members from SOR-SMR.
    And member sets from SRCD-SMR via owners in either SOR-SMR or SRCD-SOR.

    The logic is convoluted and confusing to a noob such as me, and I admit struggling to understand how this is working.  I may also have not represented the logic correctly here, apologies if that's the case.

    So, my question(s) really could be summed up as:

    Given an AREA, which IDD catalog records and sets do I need to traverse to discover the RECORDs and SETs within that AREA.  And then, can I get from the AREA to a list of Index AREA's for these?  And finally, is there a record linking SUBAREA's with AREA's within the IDD catalog?

    Thanks all for taking a look!  Happy Friday!

    Cheers - Mike, noob IDMS systems programmer.



  • 2.  RE: Trawling through dictionary structures

    Posted Mar 21, 2025 09:23 AM

    To get from the area to the index area, you would need to go via the records in the data area to find the indexes and then the areas for those indexes.  You can find the relevant junction records in the Dictionary Structure Reference manual.  Sometimes, it's not a straight forward path.

    Getting sub-areas may require access to the primary dictionary rather than the application dictionary, so a second run-unit for that may be needed.  This is when there are external references in the schema (offset and displacement).
    Record/area S-010, SA018, SAM-056, SRCD-113, RCDSYN 
    Record/set S-010, SRCD-113, SMR-052(member), SOR-046(owner)
    I suggest that you use OLQ or CULPRIT to navigate the sets between the records and find out how they are tied together.


    For the area/subarea you will need AREA-1026, SYMBOL-1048, I have never used sub-areas so not sure if more is needed.  There is no direct connection between the AREA in the segment/dmcl and the area in the schema, except a logical relationship based on area-name.



    ------------------------------
    Tommy Petersen
    ------------------------------



  • 3.  RE: Trawling through dictionary structures

    Posted 22 days ago

    Hi Mike,

    Welcome to the IDMS family!

    To navigate from an area to the records and to look up the sets of those records we use the same paths as Tommy already described. Once you are there (record SOR-046) you can find the name of the index area you are also looking for in the element SA-NAM-046. This element is only filled in when you are dealing with a system-owned index set.

    Kind regards, Johan.




  • 4.  RE: Trawling through dictionary structures

    Posted 18 days ago

    Thanks very much for the pointers and the welcome Tommy & Johan.

    With your help I've made some progress, but this raises more questions I hope you're able to provide some pointers for.  So far, I've done two different things to try and find the information I'm after.  First, based on your suggested walk-through of the IDD records (DDLDML), I now have a COBOL program that when given the name of an AREA (and a SubSchema) returns me a list of Records and Sets.  Outline of the code is:

    Locate the AREA within SA-018
    Use SA-SAM to locate the Records within this AREA (SAM-056), loop through these
    For each Record access it via Calc in SSR-032
    For each SSR-032 locate Sets using SSR-SSOR

    I have to apply some tests: if a Record has an SSR-SSOR (SSOR-034) but not an SSR-SSMR (SSMR-068), don't use it.  And if it does have an SSR-SSMR, only use this Record if the SET-NAM-068 is NE to CALC.  These tests may be unique to my use case, which is to build a valid SubSchema from the resulting Areas, Records and Sets.

    On a second separate front, I have another COBOL program that uses the DDLCAT to traverse the AREA-1026 & SYMBOL-1048 records retrieving a list of all AREAs in the Schema together with Symbols where an AREA has them (as far as my limited knowledge is able to tell).  This was developed in an attempt to see if I could use the DDLCAT records to locate the Indexes that were associated with Records discovered in an AREA.

    So to my questions now:

    To Johan, from your suggestion, I am able to locate Indexes via their naming convention within the SOR-046 records (I use DMLO for this), but I am struggling to find a way to link these back to the Records that they index.  For our installation, I can see the naming convention makes this connection between the Index name and the Record being indexed, but I see no database links that I could reliably follow in program logic where the naming convention might not be 100% consistent.  Here's an example SOR-046 DMLO output anonymised below - here the associated Record would be AANNNN and this is its second Index (X2):

    04/04/25........................RECORD : SOR-046...........
    02 SET-NAM-046..............................A  AANNNN-X2   
    02 SET-ORD-046..............................H  +00001      
    02 NXT-DBK-046..............................H  +00002      
    02 PRI-DBK-046..............................H  +00003      
    02 SOR-ID-046...............................H  +00007      
    02 DELETION-046.............................H  +00000      
    02 ORD-046..................................H  +00000      
    02 SORT-046.................................H  +00000      
    02 S-NAME-046...............................G              
     03 S-NAM-046...............................A  SCHEMA1     
     03 S-SER-046...............................H  +00500      
    02 SET-MODE-046.............................H  +00021      
    02 INDEX-MEMBERS-046........................H  +00000      
    02 INDEX-DISP-046...........................H  +00000      
    02 SYMBOL-INDEX-046.........................A  S-AANNNN-X2 
    02 PAGE-OFFSET-PERCENT-046..................H  -00001      
    02 PAGE-COUNT-PERCENT-046...................H  -00001      
    02 PAGE-OFFSET-046..........................F  -0000000001 
    02 PAGE-COUNT-046...........................F  -0000000001 
    02 SUBAREA-046..............................A  SA-AANNNN-X2
    02 SA-NAM-046...............................A  AXANNNN     
    02 INDEXID-046..............................H  +00000      
    02 SET-TYPE-046.............................H  +00000      
    02 PK-NAME-046..............................A              
    02 FILLER#010...............................A    

    I can see the link back to the AREA name in SA-NAM-046, but apart from the naming convention I don't see how to link this with a record derived from my walk through the SAM-056 set.

    And to Tommy, from the DDLCAT processing in my second piece of COBOL I am able to obtain the names of Index AREA and SubArea synonyms, which was one of my original goals.  The question is though, can I combine queries against both DDLDML and DDLCAT into a single program?  Was this what you eluded to with a reference to a 'second run-unit' above?

    Thanks again gents, wishing everyone a lovely weekend coming up.  Cheers - Mike 




  • 5.  RE: Trawling through dictionary structures

    Posted 18 days ago

    Hi Mike,

    If you know the name of the index set and you want to look up what the member record of this index set is ('the Record being indexed') then I would do that in OLQ as follows:

      GET ALL SEQUENTIAL SOR-046
        WHERE SET-NAM-046 = '<index set name>'
          AND S-NAM-046 = '<schema name>'
          AND S-SER-046 = <schema version>

      GET ALL SMR-052 WITHIN SOR-SMR

      GET OWNER IN SRCD-SMR

      GET OWNER IN RCDSYN-SRCD

    Element RSYN-NAME-079 will then show you the name of the record you're looking for.

    Kind regards, Johan.




  • 6.  RE: Trawling through dictionary structures

    Posted 18 days ago

    Hi Mike,

    Yes, that is what I meant.   The easy solution is to call a program that binds the run-unit to the database and subschema for the catalog, call once to do the binds, then a call for the AREA information, and then finally call to finish the run-unit, if you do just one area at a time you can do it all in one call.

    Subschema IDMSNWKG may have all the records from the catalog and the dictionary, and you could possibly use that in a single program.  You would need a database name that combines the segments for the application dictionary and the system catalog.



    ------------------------------
    Tommy Petersen
    ------------------------------



  • 7.  RE: Trawling through dictionary structures

    Posted 6 days ago

    Hi Michael,

    I think I may have a program that goes after these records.  Let me see if I can find it.  I'll also see what paths you need to get your records.

    Give me a few to track it down.

    Maggie




  • 8.  RE: Trawling through dictionary structures

    Posted 5 days ago

    Hi Michael,

    I wrote the code to retrieve everything but it can be modified to be more selective.  Also, record SAM-056 would have to be in a separate query since it doesn't relate to the other members of SRCD-113.

    I've also attached a sample program which can be modified to use the records you need.

     


    Attachment(s)

    txt
    MAPEXTR_PRO.txt   491 KB 1 version
    docx
    DICT-RETR-PSEUDO.docx   48 KB 1 version


  • 9.  RE: Trawling through dictionary structures

    Posted 6 days ago

    Hi Michael,

    Do you have a record layout or a list of elements that you're trying to retrieve?

    There are multiple paths that can be used depending on the elements needed.

    Many elements are used in multiple records so where you get the element from can determine the path of retrieval.

    You can get the information you're looking for.  First you need to determine what elements you want and what you're keying off of, such as area or program.

    One thing about accessing the dictionary is that you have to be very mindful of your currency.  Because of the multiple relationships between records there are lots of many-to-many database record relationships.  

    I've attached the IDD Bachman and the Manual that describes the dictionary components.

    if you have any questions you can access me directly at maggie@divadino.com.


    Attachment(s)



  • 10.  RE: Trawling through dictionary structures

    Posted 5 days ago
    Edited by Michael Cairns 5 days ago

    Thanks Maggie, and Tommy and Johan - your responses and the insights contained here have been invaluably helpful.  I just wanted to update anyone interested on my progress so far.

    First, given Johans advice regarding:  "if you know the name of the index set and you want to look up what the member record of this index set is ('the Record being indexed')" - my task was to do this from the other direction.  I.E. given the name of a Record, locate the Index Set or Sets within which the record is being indexed.  And in fact, I started with the AREA, and navigate to the Record from there first (something I've already described above).  But given this walkthrough by Johan I was able to navigate in the opposite direction and achieve my desired result.  While Johan uses OLQ (which I've not yet managed to get working here) I am using DMLO, which makes it easier for me to translate my working queries directly into a COBOL program as the DMLO commands are pretty much the IDMS COBOL directives word for word.

    My program does the following now:

    Check that the AREA I am passed as a starting point exists, in Record SA-018.
    Loop through a the list of Records in this AREA from SRCD-SAM (Record SAM-056).
    For each Record, start with SSR-032 and from there use SSR-SSOR to obtain Sets (Record SSOR-034) and for each Set use SSR-SSMR to obtain Members within the Set (Record SSMR-068).
    (this next part is inspired by Johans walkthrough)
    I then go back to the Record, and look it up in RCDSYN-079. 
    From RCDSYN-079, I use RCDSYN-SRCD to obtain the Record SRCD-113 looping through these until I find the one where the schema matches the schema I am processing.  I then use SRCD-SMR (Record  SMR-052) to get other Set(s) (or possibly 'CALC', which I ignore). 
    For each Set retrieved this way, I lookup its owner in SOR-SMR (Record SOR-046) and here I find the AREA name, the Subarea and Symbolic-Index (if used).

    In the time I took to write this update, I see that Maggie has added a COBOL example in her next response, thank you!  I will take a look into this next.

    Thank to everyone and seasons greetings for the holiday this weekend if you're enjoying one.

    Regards - Mike