Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

dynamic occurs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • dynamic occurs

    Trevor, This is from the ILE COBOL for AS/400 Reference manual at V5R1: The OCCURS DEPENDING ON clause may not be specified as subordinate to another OCCURS clause. As far as solving your storage problem, you might try a fixed block of storage, user spaces, etc. Terry

  • #2
    dynamic occurs

    Yes, I found that too; but I also found this: Complex OCCURS DEPENDING ON is supported as an extension to the COBOL 85 Standard. The basic forms of complex ODO permitted by the compiler are: .- .- .A data item described by an OCCURS clause with the DEPENDING ON option is nested within another data item described by an OCCURS clause with the DEPENDING ON option (table with variable-length elements). So I thought it might be possible somehow. If I have to do it, I'll use them serially. Trevor

    Comment


    • #3
      dynamic occurs

      Trevor, You might also try posting your question over in the "other" COBOL forum (you may have to sign-up http://www.iseriesnetwork.com/isnforums/ Sometimes the Rochester COBOL guy drops in (Chris Tandy) and he could provide a definitive answer as to whether the extension to the standard is supported. Also, some of the regular folks over there may have some ideas for you... Good Luck, Terry

      Comment


      • #4
        dynamic occurs

        I missed this example the last time I looked. It does a dynamic allocate of memory which goes part of the way to what I need. http://www.iseriesnetwork.com/resour...e/cbldynam.zip To keep this dynamic thing working as we increase our record layout is too complex, I think. So I'll just stay within the constraints of the language. Trevor

        Comment


        • #5
          dynamic occurs

          Try making your table as follows . . . 05 RH_DataLength PIC X(05). 10 NUM-VENDORS pic s9(4) comp-4. 10 VENDOR-RELATIONS occurs 1 to 20 depending on NUM-VENDORS indexed by VEND-IDX. 15 VENDOR-ID PIC X(12). 15 VENDOR-SRC-ST PIC X(02). . . . yadda yadda yadda Just make sure that NUM-VENDORS never is less that 1 or greater than 20. HTH Phil

          Comment


          • #6
            dynamic occurs

            I'm attempting to build a dynamic structure where there are a variable number of (variable number of occurances). See example below. Initially I tried the imbedded occurs as "occurs depending on NUM-ADDRESS" but the compiler blew and looped. So I changed the embedded occurs to a static 10 and it compiled. How can I make the structure dynamic? OR is this not possible? Trevor example follows: WORKING-STORAGE SECTION. 01 RESPONSE-HDR. 05 Version PIC X(02). 05 ErrorRC PIC X(04). 05 RH_DataLength PIC X(05). 10 NUM-VENDORS INDEX. 10 VENDOR-RELATIONS occurs 1 to 20 depending on NUM-VENDORS 15 VENDOR-ID PIC X(12). 15 VENDOR-SRC-ST PIC X(02). 15 SOURCE-TYPE PIC X(02). 15 SOURCE-FIRST-NAME PIC X(15). 15 SOURCE-MID-NAME PIC X(15). 15 NUM-ADDRESS INDEX. * doesn't like this? The compile blows * 15 VENDOR-address occurs 1 to 10 * depending on NUM-ADDRESS. * so lets try a static occurance 15 VENDOR-address occurs 10. 20 SOURCE-STR-1 PIC X(22). 20 SOURCE-ADR-STR-NBR PIC X(06). 20 SOURCE-ADR-STR-DIR PIC X(05). 20 SOURCE-ADR-LIN2 PIC X(22).

            Comment


            • #7
              dynamic occurs

              There is no true dynamic Cobol table, even in the most recent Microfocus Net Express Cobol. The closest you can get is what the other person suggested with the occurs 1 to x depending clause. You can just never exceed x. I was always hoping for another way in cobol to handle dynamic table structures. Kathy

              Comment

              Working...
              X