Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Gods Of COBOL

Gods Of COBOL

Scheduled Pinned Locked Moved The Lounge
comperformancequestion
61 Posts 40 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Xiangyang Liu

    You may want to call AARP[^], I am pretty sure 90% of cobol programmers are members. :)

    My .NET Business Application Framework     My Younger Son & His "PET"

    H Offline
    H Offline
    Hired Mind
    wrote on last edited by
    #33

    HAHA! Funny you should say that - I just took a job to completely re-write a suite of COBOL programs in .Net that run every aspect of a utility company. And the reason they hired me? Their COBOL programmer just retired. (Thankfully he's on retainer as a consultant) To the OP: Sorry - I know very little COBOL, but if you ask again in a couple months I could probably help :)

    1 Reply Last reply
    0
    • S Sean Cundiff

      Chris Losinger wrote:

      01 MEMORY-AREA-ONE PIC X(2816).

      Allocate a block of memory 2816 bytes in size and fill with 'X'. Name the block of memory 'MEMORY-AREA-ONE'.

      Chris Losinger wrote:

      01 REDEFINES MEMORY-AREA-ONE.
      05 K01-1 OCCURS 37 TIMES
      INDEXED BY K01-1-X PIC 9(04) COMP-5.
      05 K02-1 OCCURS 1369 TIMES
      INDEXED BY K02-1-X PIC 9(04) COMP-5.

      Reallocate the array for a different purpose. K01-1 is an array that contains 37 elements. The index to the array is K01-1-X. Each element is a 4-byte numeric. 'PIC 9(04)' Each element is stored as a 2's complement big-endian number in machine-dependant format. 'COMP-5' When I say big-endian I mean that when the number is displayed it will be displayed as 4 digits from left to right with most significant to least significant order. Whether it's big-endian in memory depends on the implementation. K02-1 is a 1369 element array with similar properties. K01-1-X and K02-1-X are the variables used to index the arrays. Each one belongs to it's respective array and can't be used for the other one. p-code example: for K01-1-X in {1 .. 37} do something with K01-1[K01-1-X]

      -Sean ---- Fire Nuts

      modified on Friday, April 9, 2010 6:58 PM

      M Offline
      M Offline
      Mark_Wallace
      wrote on last edited by
      #34

      PIC simply sets the output type. PIC X is alphanumeric, and PIC 9 is numeric, so PIC X(2816) is 2816 alphanumeric characters (in this case used to reserve contiguous space -- a common trick in COBOL, where you're not supposed to worry about things like memory allocation), and PIC 9(4) is four numeric digits.

      I wanna be a eunuchs developer! Pass me a bread knife!

      1 Reply Last reply
      0
      • C Chris Losinger

        anybody here know COBOL ? what does this do?

           01 MEMORY-AREA-ONE                           PIC X(2816).
        
           01  REDEFINES MEMORY-AREA-ONE.          
              05 K01-1 OCCURS 37 TIMES             
                       INDEXED BY K01-1-X               PIC 9(04) COMP-5.
              05 K02-1 OCCURS 1369 TIMES           
                       INDEXED BY K02-1-X               PIC 9(04) COMP-5.
        

        i thought i understood what redefine and occurs meant, but i can't figure out what this declaration does. (funny answers are welcome!)

        image processing toolkits | batch image processing

        T Offline
        T Offline
        the SPOF
        wrote on last edited by
        #35

        01 MEMORY-AREA-ONE PIC X(2816) Declares a variable of 2816 chars, same as C char[2816]. The REDEFINE statement means that the next structure will occupy the same physical memory as MEMORY-AREA-ONE - much like a C UNION. Each 'PIC 9(04) COMP' is a 4 byte numeric optimised for computation, this is the same as a C UINT. If 'COMP' had been ommitted then the each of these variables would be able to store anything from 0 to 9999 and these would be stored as ASCII numeric digits which isnt efficient for computation but is how COBOL was designed to be used by 'non programmers' who didnt need to understand computer internals. This structure is typically used for low level data manipulation like encryption or compression because its the only way you could have a sequence of numbers and be able to address bytes at any offset within a structure - the char[2816] is effectively used as a char*. OCCURS is just an array count. Hope that answers your questions.

        1 Reply Last reply
        0
        • S Sean Cundiff

          Douglas Troy wrote:

          Pic 9(04) COMP-5 is a 4 byte numeric stored in machine independent format

          Machine-dependent format if I'm not mistaken. COMP-4 is machine independent.

          -Sean ---- Fire Nuts

          T Offline
          T Offline
          tonosuk
          wrote on last edited by
          #36

          From my COBOL days numerous years ago, then comp-5 was machine dependant, so on an intel 8086 would be stored in reverse binary and wouldn't require the bit swapping by the compiler that defining as 'comp' would require. I remember a comp-x format too that was machine independant. We would also define a pic 9(04) comp-5 fields as pic x(02) comp-5 to make it more obvious that the field took 2 bytes of storage. That was based on Micro Focus compilers with syntax targetted at pc-only runtime environment where writing presentation manager apps in COBOL was the last word in chic and guaranteed many a dinner party invitation! I seem to remember that the indexed by declaration came in useful during iterations or using the Search verb, maybe, perhaps. Tony

          1 Reply Last reply
          0
          • C Chris Losinger

            anybody here know COBOL ? what does this do?

               01 MEMORY-AREA-ONE                           PIC X(2816).
            
               01  REDEFINES MEMORY-AREA-ONE.          
                  05 K01-1 OCCURS 37 TIMES             
                           INDEXED BY K01-1-X               PIC 9(04) COMP-5.
                  05 K02-1 OCCURS 1369 TIMES           
                           INDEXED BY K02-1-X               PIC 9(04) COMP-5.
            

            i thought i understood what redefine and occurs meant, but i can't figure out what this declaration does. (funny answers are welcome!)

            image processing toolkits | batch image processing

            R Offline
            R Offline
            redware
            wrote on last edited by
            #37

            Not a COBOL programmer, but here goes nothing: Comp-5 is a "native" binary format. Equivalent of "comp" type. pic 9(4) comp-5 is a two-byte unsigned binary 0 - 65535. Roughly in 'C, you are looking at: union { unsigned char buffer[2816] ; struct { unsigned short k01[37] ; unsigned short k02[1369]; } a ; } mem_area_one ; The layout of the two-bytes is platform specific ("native"), so if the COBOL is running on a PC platform, the two-bytes are stored in memory reversed (value of 12 decimal is stored as 0x0c00 in byte order).

            1 Reply Last reply
            0
            • C Chris Losinger

              anybody here know COBOL ? what does this do?

                 01 MEMORY-AREA-ONE                           PIC X(2816).
              
                 01  REDEFINES MEMORY-AREA-ONE.          
                    05 K01-1 OCCURS 37 TIMES             
                             INDEXED BY K01-1-X               PIC 9(04) COMP-5.
                    05 K02-1 OCCURS 1369 TIMES           
                             INDEXED BY K02-1-X               PIC 9(04) COMP-5.
              

              i thought i understood what redefine and occurs meant, but i can't figure out what this declaration does. (funny answers are welcome!)

              image processing toolkits | batch image processing

              N Offline
              N Offline
              Norm Powroz
              wrote on last edited by
              #38

              As previously pointed out, MEMORY-AREA-ONE is a string of 2816 characters [PIC X(...) is the method by which character data is reserved/declared, and space assigned for it]. The REDEFINES... is a common COBOL method for permitting memory/data to be accessed in multiple ways. The C/C++ equivalent would be a "struct" definition with a "union" component -- you can access the memory using either elements of the struct, or elements of the union. Most "COMP-xx" data definitions are implementor-defined, so you will need the specific COBOL documentation for the machine upon which this code was implemented. IBM was a big user of COMP-xx declarations, and had several flavours of them, so you could have true floating-point, or packed-decimal data in a COBOL program by using their COMP-xx datatypes. Without the specific documentation, it is impossible to say exactly how the redefined data mask would lay out over the original character space. These kinds of implementor-defined situations always made conversions from one mainframe machine architecture to another somewhat interesting. The INDEXED BY clauses instruct the compiler to reserve specific indexes for iterating through the array created by the OCCURS clause. The assignment of an index usually translated (at the machine hardware level) into the use of a reserved index register. This was done for performance, rather than using a memory-based byte/word for storage of the array index value. As such, you don't need to be too worried about the INDEXED BY clause, as it's more a compiler instruction than anything else. Hope this helps. Norm Powroz Former member, CODASYL COBOL Committee (the people who designed the language) Former Member, ISO COBOL Experts Group Former Member, CSA COBOL Working Group ...and I'm not retired yet ;)

              1 Reply Last reply
              0
              • C Chris Losinger

                anybody here know COBOL ? what does this do?

                   01 MEMORY-AREA-ONE                           PIC X(2816).
                
                   01  REDEFINES MEMORY-AREA-ONE.          
                      05 K01-1 OCCURS 37 TIMES             
                               INDEXED BY K01-1-X               PIC 9(04) COMP-5.
                      05 K02-1 OCCURS 1369 TIMES           
                               INDEXED BY K02-1-X               PIC 9(04) COMP-5.
                

                i thought i understood what redefine and occurs meant, but i can't figure out what this declaration does. (funny answers are welcome!)

                image processing toolkits | batch image processing

                T Offline
                T Offline
                tam462
                wrote on last edited by
                #39

                COBOL pre-allocates memory for everything in the code at runtime. All variables used are created in the WORKING STORAGE section. Nothing is dynamically created or destroyed in a garbage collection sweep. PIC X is a byte of memory, so PIC X(2816) is a block of memory taking 2816 bytes. By default, "PIC" will use the translation base of the machine, e.g. EBCDIC on a mainframe or ASCII on most anything else. "COMP" data types are a way to pack numeric values into a smaller number of bytes, much like INT and FLOAT. PIC 9 is a numeric data type. PIC 9(4) uses 4 bytes of memory to contain the number. PIC 9(4) COMP-5 in particular is a 32-bit signed float. "OCCURS" is used to create an array. "INDEXED BY" also creates the index to the array at the same time. "REDEFINES" means "uses the same memory space as". Putting it all together: 01 MEMORY-AREA-ONE is simply a block of memory using 2816 bytes. Inside that block of memory, there are two float arrays, one called K01-1 with 37 elements, and the other called K02-1 with 1369 element. To reference a given element in an array, you first assign a value to the index, then you can get what you need from the array. e.g. "MOVE 1 TO KO1-1-X." followed by "ADD K01-1 (KO1-1-X) TO TOTAL." I don't know why you use a REDEFINES for a bunch of floats, unless you needed to dump all of them to an output file for some reason, then it's only 1 line of code, rather than writing the loop logic. (I'm a 2nd-gen coder. The old man taught me this stuff when I was 14. His lab classes when he was in school were "paper-tape in, oscilloscope out" and they programmed in binary. He used to quote "Assembler was a godsend." I'm attending the VS 2010 launch in 15 minutes.) Good luck.

                1 Reply Last reply
                0
                • D Douglas Troy

                  This is nothing more than a string (alphanumeric) 2816 characters

                  Chris Losinger wrote:

                  01 MEMORY-AREA-ONE PIC X(2816).

                  that second section

                  Chris Losinger wrote:

                  01 REDEFINES MEMORY-AREA-ONE. 05 K01-1 OCCURS 37 TIMES INDEXED BY K01-1-X PIC 9(04) COMP-5. 05 K02-1 OCCURS 1369 TIMES INDEXED BY K02-1-X PIC 9(04) COMP-5.

                  Pic 9(04) COMP-5 is a 4 byte numeric stored in machine independent format Essentially, those two lines redefine the space originally defined by MEMORY-AREA-ONE into two blocks of unsigned 16-bit integers. I cannot recall what the INDEXED allows you to do anymore ... Not sure any of that helps you ... [edit] You might also considering hitting up the COBOL User Groups[^] for help with this, and/or other COBOL related issues you might have. Just a thought.


                  :..::. Douglas H. Troy ::..
                  Bad Astronomy |VCF|wxWidgets|WTL

                  modified on Friday, April 9, 2010 5:51 PM

                  N Offline
                  N Offline
                  ntrceptr
                  wrote on last edited by
                  #40

                  Dougs' replay was the closest thing to correct so far. 01 MEMORY-AREA-ONE PIC X(2816). This just defines a 2816 byte vaariable and the PIC X means it's alphanumeric 01 REDEFINES MEMORY-AREA-ONE This says your going to redefine that chunk of data into a different structure/layout 05 K01-1 OCCURS 37 TIMES INDEXED BY K01-1-X PIC 9(04) COMP-5. These 2 lines make an array of 37 four digit numbers (0000-9999) and gives you a subscript named K01-1-X to reference entries 1-37 remember COBOL subscripts start at 1 not zero. This K01-1 array actually exists in the first 74 bytes of MEMORY-AREA-ONE The COMP-5 or any COMP in COBOL basicall says to save space by representing the numbers in memory (like they should) in a binary format. COBOL will basically use a string for numbers is you don't use COMP (1 byte for each digit) 05 K02-1 OCCURS 1369 TIMES INDEXED BY K02-1-X PIC 9(04) COMP-5. This is basically the same except it uses bytes 75-2812 of MEMORY-AREA-ONE to define and array of 1369 four digit numbers and gives you subscript K02-1-X to reference it. I'd say the original author didn't quite understand COBOL either as you dont need to define extra space in the MEMORY-AREA-ONE for the subscripts. if it was 01 MEMORY-AREA-ONE PIC X(2812) it would have worked the same.

                  1 Reply Last reply
                  0
                  • C Chris Losinger

                    anybody here know COBOL ? what does this do?

                       01 MEMORY-AREA-ONE                           PIC X(2816).
                    
                       01  REDEFINES MEMORY-AREA-ONE.          
                          05 K01-1 OCCURS 37 TIMES             
                                   INDEXED BY K01-1-X               PIC 9(04) COMP-5.
                          05 K02-1 OCCURS 1369 TIMES           
                                   INDEXED BY K02-1-X               PIC 9(04) COMP-5.
                    

                    i thought i understood what redefine and occurs meant, but i can't figure out what this declaration does. (funny answers are welcome!)

                    image processing toolkits | batch image processing

                    P Offline
                    P Offline
                    pimpaler
                    wrote on last edited by
                    #41

                    This does not appear like a valid definition. Since "9(04) COMP-5" represents a 2-byte integer number and (37 + 1369) * 2 = 2812 and not 2816, you are certainly missing some further variable definitions or the COBOL program itself does not compile (or, if it does, it is not a very well made program). "INDEXED BY" just means that the tables defined by names K01-1 and K02-1 can be searched for values using built-in SEARCH function(s).

                    1 Reply Last reply
                    0
                    • C Chris Losinger

                      anybody here know COBOL ? what does this do?

                         01 MEMORY-AREA-ONE                           PIC X(2816).
                      
                         01  REDEFINES MEMORY-AREA-ONE.          
                            05 K01-1 OCCURS 37 TIMES             
                                     INDEXED BY K01-1-X               PIC 9(04) COMP-5.
                            05 K02-1 OCCURS 1369 TIMES           
                                     INDEXED BY K02-1-X               PIC 9(04) COMP-5.
                      

                      i thought i understood what redefine and occurs meant, but i can't figure out what this declaration does. (funny answers are welcome!)

                      image processing toolkits | batch image processing

                      A Offline
                      A Offline
                      asherw0202
                      wrote on last edited by
                      #42

                      MEMORY-AREA-ONE is defining an alph-numeric space of 2816 bytes aligned to a work boundary The redefines is overlaying the mapping ( similar to a C union ) with two arrays of compresses numeric ( check your compiler doc regarding how these are represented internally ). The punch line is that 9(04) COMP-5 takes two bytes. My math may be off, but it looks like the original space has four extra bytes

                      C 1 Reply Last reply
                      0
                      • A asherw0202

                        MEMORY-AREA-ONE is defining an alph-numeric space of 2816 bytes aligned to a work boundary The redefines is overlaying the mapping ( similar to a C union ) with two arrays of compresses numeric ( check your compiler doc regarding how these are represented internally ). The punch line is that 9(04) COMP-5 takes two bytes. My math may be off, but it looks like the original space has four extra bytes

                        C Offline
                        C Offline
                        Chris Losinger
                        wrote on last edited by
                        #43

                        asherw0202 wrote:

                        My math may be off, but it looks like the original space has four extra byte

                        that's what it looked like to me, too. and that's really the primary reason i asked the question - why define an overlay/alias that doesn't fit the original memory ? is that intentional but sloppy, or is there some tricky COBOL thing that explains it?

                        image processing toolkits | batch image processing

                        1 Reply Last reply
                        0
                        • C Chris Losinger

                          anybody here know COBOL ? what does this do?

                             01 MEMORY-AREA-ONE                           PIC X(2816).
                          
                             01  REDEFINES MEMORY-AREA-ONE.          
                                05 K01-1 OCCURS 37 TIMES             
                                         INDEXED BY K01-1-X               PIC 9(04) COMP-5.
                                05 K02-1 OCCURS 1369 TIMES           
                                         INDEXED BY K02-1-X               PIC 9(04) COMP-5.
                          

                          i thought i understood what redefine and occurs meant, but i can't figure out what this declaration does. (funny answers are welcome!)

                          image processing toolkits | batch image processing

                          B Offline
                          B Offline
                          Bob work
                          wrote on last edited by
                          #44

                          I took a programming class years ago. Fortran & Cobol were all the rage for undergrds. The languages of the future... Something about formatted/organized/parsing clicked. From:http://www.cse.ohio-state.edu/~sgomori/314/langref.html#occurs[^] Occurs Occurs is used to define a table. It is followed by the number of elements in the table. COBOL does not support dynamic tables - the size must be specified. 01 WS-TABLE. 05 WS-ELEMENT OCCURS 100 TIMES PIC 9(5). Defines a table with 100 elements Index Subscripts and indexes are the two tools used to reference individual elements of a table. ... An index is created automatically by the system if it is directed to do so and only has limited availability to the programmer. Sounds like Memory area one is to be treated as tabular data and accessible by a column/row indexing scheme. Maybe.

                          -Bob

                          1 Reply Last reply
                          0
                          • C Chris Losinger

                            anybody here know COBOL ? what does this do?

                               01 MEMORY-AREA-ONE                           PIC X(2816).
                            
                               01  REDEFINES MEMORY-AREA-ONE.          
                                  05 K01-1 OCCURS 37 TIMES             
                                           INDEXED BY K01-1-X               PIC 9(04) COMP-5.
                                  05 K02-1 OCCURS 1369 TIMES           
                                           INDEXED BY K02-1-X               PIC 9(04) COMP-5.
                            

                            i thought i understood what redefine and occurs meant, but i can't figure out what this declaration does. (funny answers are welcome!)

                            image processing toolkits | batch image processing

                            M Offline
                            M Offline
                            MichaelBlane
                            wrote on last edited by
                            #45

                            INDEXED BY means that K01-1 is an array that uses K01-1-X as the array subscript. Information on the PIC 9(04) COMP-5 found at http://www-01.ibm.com/software/awdtools/cobol/os390/about/ : Data items declared with the new USAGE COMP-5 data type are represented in storage as binary data and can contain values of magnitude up to the capacity of the native binary representation (2, 4, or 8 bytes). With USAGE COMP-5, data values are no longer limited to the value implied by the number of 9s in the picture for the item. These enhancements help your COBOL applications to exploit the open, network-computing environment, making COBOL a more powerful application development tool. From what I remember of COBOL, K0x numbers were normally used as database keys. This particular piece of code probably has around it a SCHEMA SECTION that defines the database that this memory area becomes the KeyIDs for. K01 and K02 are most likely lookup tables for some information found elsewhere in the code. Where did you find the vacuum tube that held this?

                            C 1 Reply Last reply
                            0
                            • M MichaelBlane

                              INDEXED BY means that K01-1 is an array that uses K01-1-X as the array subscript. Information on the PIC 9(04) COMP-5 found at http://www-01.ibm.com/software/awdtools/cobol/os390/about/ : Data items declared with the new USAGE COMP-5 data type are represented in storage as binary data and can contain values of magnitude up to the capacity of the native binary representation (2, 4, or 8 bytes). With USAGE COMP-5, data values are no longer limited to the value implied by the number of 9s in the picture for the item. These enhancements help your COBOL applications to exploit the open, network-computing environment, making COBOL a more powerful application development tool. From what I remember of COBOL, K0x numbers were normally used as database keys. This particular piece of code probably has around it a SCHEMA SECTION that defines the database that this memory area becomes the KeyIDs for. K01 and K02 are most likely lookup tables for some information found elsewhere in the code. Where did you find the vacuum tube that held this?

                              C Offline
                              C Offline
                              Chris Losinger
                              wrote on last edited by
                              #46

                              USAmab wrote:

                              Where did you find the vacuum tube that held this?

                              the US govt...

                              image processing toolkits | batch image processing

                              M 1 Reply Last reply
                              0
                              • C Chris Losinger

                                USAmab wrote:

                                Where did you find the vacuum tube that held this?

                                the US govt...

                                image processing toolkits | batch image processing

                                M Offline
                                M Offline
                                MichaelBlane
                                wrote on last edited by
                                #47

                                Funny, that's who I work for. Which DIVISION and SECTION is this piece of code in?

                                C 1 Reply Last reply
                                0
                                • M MichaelBlane

                                  Funny, that's who I work for. Which DIVISION and SECTION is this piece of code in?

                                  C Offline
                                  C Offline
                                  Chris Losinger
                                  wrote on last edited by
                                  #48

                                  am i allowed to say ? :) it's a NCOA thing, for the USPS.

                                  image processing toolkits | batch image processing

                                  M 1 Reply Last reply
                                  0
                                  • C Chris Losinger

                                    am i allowed to say ? :) it's a NCOA thing, for the USPS.

                                    image processing toolkits | batch image processing

                                    M Offline
                                    M Offline
                                    MichaelBlane
                                    wrote on last edited by
                                    #49

                                    I work for a contractor. The DIVISION and SECTION that the code is in would be helpful, as the code would have a different function depending on where it is located. If in the SCHEMA SECTION, this is most likely a set of Key lookup tables. If in the LINKAGE SECTION, this could be a subroutine pass from another programming language. If this is in the WORKING-STORAGE SECTION, it's possible that the original programmer was trying to write a piece of code in Assembler and have it called as a binary routine. If this is the case, there will be a LOADING paragraph in the PROCEDURE DIVISION.

                                    C 1 Reply Last reply
                                    0
                                    • M MichaelBlane

                                      I work for a contractor. The DIVISION and SECTION that the code is in would be helpful, as the code would have a different function depending on where it is located. If in the SCHEMA SECTION, this is most likely a set of Key lookup tables. If in the LINKAGE SECTION, this could be a subroutine pass from another programming language. If this is in the WORKING-STORAGE SECTION, it's possible that the original programmer was trying to write a piece of code in Assembler and have it called as a binary routine. If this is the case, there will be a LOADING paragraph in the PROCEDURE DIVISION.

                                      C Offline
                                      C Offline
                                      Chris Losinger
                                      wrote on last edited by
                                      #50

                                      ah... that section/division (still learning the COBOL lingo). it's in the data division, working-storage section. it's a temp in-memory table. the full def'n is actually:

                                         01 MEMORY-AREA-ONE                           PIC X(2816).
                                      
                                         01  REDEFINES MEMORY-AREA-ONE.
                                             05 MEM-ONE-CHUNK OCCURS 11  TIMES
                                                INDEXED BY MEM-ONE-X                  PIC X(256).
                                      
                                         01  REDEFINES MEMORY-AREA-ONE.
                                            05 K01-1 OCCURS 37 TIMES
                                                     INDEXED BY K01-1-X               PIC 9(04) COMP-5.
                                            05 K02-1 OCCURS 1369 TIMES
                                                     INDEXED BY K02-1-X               PIC 9(04) COMP-5.
                                      

                                      it looks like that MEM_ONE_CHUNK thing only used to initialize the entire buffer.

                                             MOVE LOW-VALUES TO MEM-ONE-CHUNK(1)
                                             PERFORM VARYING MEM-ONE-X FROM 2 BY 1
                                              UNTIL(MEM-ONE-X > 11)
                                              MOVE MEM-ONE-CHUNK(1) TO MEM-ONE-CHUNK(MEM-ONE-X)
                                             END-PERFORM
                                      

                                      that's the only place that particular redefine is used. seems like an odd way to do things.

                                      image processing toolkits | batch image processing

                                      M 2 Replies Last reply
                                      0
                                      • C Chris Losinger

                                        ah... that section/division (still learning the COBOL lingo). it's in the data division, working-storage section. it's a temp in-memory table. the full def'n is actually:

                                           01 MEMORY-AREA-ONE                           PIC X(2816).
                                        
                                           01  REDEFINES MEMORY-AREA-ONE.
                                               05 MEM-ONE-CHUNK OCCURS 11  TIMES
                                                  INDEXED BY MEM-ONE-X                  PIC X(256).
                                        
                                           01  REDEFINES MEMORY-AREA-ONE.
                                              05 K01-1 OCCURS 37 TIMES
                                                       INDEXED BY K01-1-X               PIC 9(04) COMP-5.
                                              05 K02-1 OCCURS 1369 TIMES
                                                       INDEXED BY K02-1-X               PIC 9(04) COMP-5.
                                        

                                        it looks like that MEM_ONE_CHUNK thing only used to initialize the entire buffer.

                                               MOVE LOW-VALUES TO MEM-ONE-CHUNK(1)
                                               PERFORM VARYING MEM-ONE-X FROM 2 BY 1
                                                UNTIL(MEM-ONE-X > 11)
                                                MOVE MEM-ONE-CHUNK(1) TO MEM-ONE-CHUNK(MEM-ONE-X)
                                               END-PERFORM
                                        

                                        that's the only place that particular redefine is used. seems like an odd way to do things.

                                        image processing toolkits | batch image processing

                                        M Offline
                                        M Offline
                                        MichaelBlane
                                        wrote on last edited by
                                        #51

                                        What is the definition line in the WORKING-STORAGE SECTION for "LOW-VALUES"? It's probably an "01" or "77" line. If it's a "77" line, it will not have anything underneath it that subdivides it like the "01" lines do. Because of the ">" in the PERFORM statement, you are using a "newer" version of COBOL (the older - COBOL 68, 74 standards forced the relationals to be written out "IS GREATER THAN"). Not that that's helpful at this point, but you may be able to find the "newer" COBOL manual(s). Are there any COMMENTS in the IDENTIFICATION DIVISION that tell you what this program is supposed to do? I also wonder, does this program have a LINKAGE SECTION in it? If so, this code could be called from another program.

                                        L 1 Reply Last reply
                                        0
                                        • C Chris Losinger

                                          ah... that section/division (still learning the COBOL lingo). it's in the data division, working-storage section. it's a temp in-memory table. the full def'n is actually:

                                             01 MEMORY-AREA-ONE                           PIC X(2816).
                                          
                                             01  REDEFINES MEMORY-AREA-ONE.
                                                 05 MEM-ONE-CHUNK OCCURS 11  TIMES
                                                    INDEXED BY MEM-ONE-X                  PIC X(256).
                                          
                                             01  REDEFINES MEMORY-AREA-ONE.
                                                05 K01-1 OCCURS 37 TIMES
                                                         INDEXED BY K01-1-X               PIC 9(04) COMP-5.
                                                05 K02-1 OCCURS 1369 TIMES
                                                         INDEXED BY K02-1-X               PIC 9(04) COMP-5.
                                          

                                          it looks like that MEM_ONE_CHUNK thing only used to initialize the entire buffer.

                                                 MOVE LOW-VALUES TO MEM-ONE-CHUNK(1)
                                                 PERFORM VARYING MEM-ONE-X FROM 2 BY 1
                                                  UNTIL(MEM-ONE-X > 11)
                                                  MOVE MEM-ONE-CHUNK(1) TO MEM-ONE-CHUNK(MEM-ONE-X)
                                                 END-PERFORM
                                          

                                          that's the only place that particular redefine is used. seems like an odd way to do things.

                                          image processing toolkits | batch image processing

                                          M Offline
                                          M Offline
                                          MichaelBlane
                                          wrote on last edited by
                                          #52

                                          Chris, check your "image processing toolkit" support email address. I've sent you an email for offline help.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups