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.
  • 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
    PIEBALDconsult
    wrote on last edited by
    #6

    Chris Losinger wrote:

    MEMORY-AREA-ONE

    Nah, I forgot. :-D

    1 Reply Last reply
    0
    • J Jim Crafton

      That's a program fragment? It looks like the results a program run as opposed to actual syntax. Bizarre. Glad I never had to deal with COBOL. Makes FORTRAN look absolutely svelte in comparison!

      ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

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

      yeah, it's amazingly verbose. i have to translate a bunch into C/C++ and i'm learning as i go. but this bit makes no sense to me.

      image processing toolkits | batch image processing

      P 1 Reply Last reply
      0
      • A Andy Brummer

        I'm guessing that is a buffer for a transfer protocol or a binary file format. I had to deal with such things ages ago when I had to interface with a tandem mainframe. (1369+37)*2 = 2812 so I think it is a bunch of 2 byte integers with 4 bytes left over.

        I can imagine the sinking feeling one would have after ordering my book, only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon

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

        Andy Brummer wrote:

        a bunch of 2 byte integers with 4 bytes left over

        hmm... yeah, i suppose that could be it. the 'leftover bytes' feels stupid and wrong, but maybe i should just get over that... i'll give it a try!

        image processing toolkits | batch image processing

        modified on Friday, April 9, 2010 4:38 PM

        S J 2 Replies 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

          I Offline
          I Offline
          Ian Shlasko
          wrote on last edited by
          #9

          Chris Losinger wrote:

          anybody here know COBOL ?

          I'd learn it, but... well... Some things just aren't meant to be done without large amounts of illegal drugs, and I'm not into that.

          Proud to have finally moved to the A-Ark. Which one are you in?
          Author of the Guardians Saga (Sci-Fi/Fantasy novels)

          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

            J Offline
            J Offline
            Joe Woodbury
            wrote on last edited by
            #10

            My eyes keep glazing over while trying to read this. I tried sending it through Babel Fish, but it didn't do any good. I'll just guess that it means:

            int main()
            {
            puts("Hello World");
            }

            1 Reply Last reply
            0
            • C Chris Losinger

              yeah, it's amazingly verbose. i have to translate a bunch into C/C++ and i'm learning as i go. but this bit makes no sense to me.

              image processing toolkits | batch image processing

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #11

              Chris Losinger wrote:

              yeah, it's amazingly verbose.

              Invented by a woman, don't you know? I'm just saying, that's all.

              "WPF has many lovers. It's a veritable porn star!" - Josh Smith

              As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

              My blog | My articles | MoXAML PowerToys | Onyx

              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
                Pete OHanlon
                wrote on last edited by
                #12

                As far as I can tell, it means that the chances of you using COBOL to stop the nuclear countdown in 24 is going to be slim. Jack Bauer: "Dammit Chloe. I need aerial surveilance now." Chloe: "I'm trying Jack. I'm still only halfway through the declaration section."

                "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                My blog | My articles | MoXAML PowerToys | Onyx

                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

                  J Offline
                  J Offline
                  Jeremy Falcon
                  wrote on last edited by
                  #13

                  Might be worthwhile running it through a COBOL to C translator. Then maybe you can make sense of the C code.

                  Jeremy Falcon

                  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

                    D Offline
                    D Offline
                    Douglas Troy
                    wrote on last edited by
                    #14

                    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

                    C S N A 4 Replies 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

                      L Offline
                      L Offline
                      Luc Pattyn
                      wrote on last edited by
                      #15

                      Hi Chris, you are aware there are a couple of .NET COBOL compilers around? you might be lucky and have a look at the IL your source generates; and reflector might be willing to show you equivalent C# or VB.NET code. And maybe you don't need to translate it after all, just run it... :)

                      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                      Getting an article published on CodeProject should be easier and faster for Bronze and Silver authors.


                      C C 2 Replies 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

                        C Offline
                        C Offline
                        CPallini
                        wrote on last edited by
                        #16

                        No cookie for you: COBOL is the only computer language invented by the Etrurians. :)

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                        [My articles]

                        1 Reply Last reply
                        0
                        • L Luc Pattyn

                          Hi Chris, you are aware there are a couple of .NET COBOL compilers around? you might be lucky and have a look at the IL your source generates; and reflector might be willing to show you equivalent C# or VB.NET code. And maybe you don't need to translate it after all, just run it... :)

                          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                          Getting an article published on CodeProject should be easier and faster for Bronze and Silver authors.


                          C Offline
                          C Offline
                          CPallini
                          wrote on last edited by
                          #17

                          Luc Pattyn wrote:

                          you are aware there are a couple of .NET COBOL compilers around?

                          Their authors should be flamed, immediately. :rolleyes:

                          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                          [My articles]

                          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

                            S Offline
                            S Offline
                            Steve Mayfield
                            wrote on last edited by
                            #18

                            Isn't that part of the start up code for Cylons...oh wait, that's "Lords of Kobol" :laugh:

                            Steve _________________ I C(++) therefore I am

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

                            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
                              martin_hughes
                              wrote on last edited by
                              #19
                               01 SORRY-CHRIS                                          PIC YOUR-NAME(LANCELOT).
                               
                               01 I-DON'T-KNOW.
                                 05 IDK OCCURS 100 TIMES
                                        INDEXED BY I-REALLY-DON'T-KNOW                 PIC A-COLOUR(BLUE).
                                 05 IDK-2 OCCURS 1520 TIMES
                                        INDEXED BY WHAT-IS-THE-CAPITAL-OF-ASSYRIA      I-DON'T-KNOW-THAT(NONE).  
                              

                              Output is apparently "Arrrrrrrrrrrrrggggggggggghhhhhhhhhhhhhhhhhh!"

                              Books written by CP members

                              C 1 Reply Last reply
                              0
                              • C Chris Losinger

                                Andy Brummer wrote:

                                a bunch of 2 byte integers with 4 bytes left over

                                hmm... yeah, i suppose that could be it. the 'leftover bytes' feels stupid and wrong, but maybe i should just get over that... i'll give it a try!

                                image processing toolkits | batch image processing

                                modified on Friday, April 9, 2010 4:38 PM

                                S Offline
                                S Offline
                                Steve Mayfield
                                wrote on last edited by
                                #20

                                4 bytes left over Maybe the 4 extra bytes are for the array index variables (K01-1-X & K02-1-X)

                                Steve _________________ I C(++) therefore I am

                                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

                                  S Offline
                                  S Offline
                                  Steve Mayfield
                                  wrote on last edited by
                                  #21

                                  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.

                                  maybe becomes :confused:

                                  union {
                                  {
                                  PIC MEMORY-AREA-ONE X[2816];
                                  struct {
                                  PIC K01-1-X;
                                  PIC K01-1[37];
                                  PIC K02-1-X;
                                  PIC K02-1[1369];
                                  } COMP-5
                                  };

                                  Steve _________________ I C(++) therefore I am

                                  1 Reply Last reply
                                  0
                                  • C Chris Losinger

                                    Andy Brummer wrote:

                                    a bunch of 2 byte integers with 4 bytes left over

                                    hmm... yeah, i suppose that could be it. the 'leftover bytes' feels stupid and wrong, but maybe i should just get over that... i'll give it a try!

                                    image processing toolkits | batch image processing

                                    modified on Friday, April 9, 2010 4:38 PM

                                    J Offline
                                    J Offline
                                    JimmyRopes
                                    wrote on last edited by
                                    #22

                                    Chris Losinger wrote:

                                    'leftover bytes' feels stupid

                                    COBOL programmers were never known to be sticklers for programming best practices. COBOL, like VB, allows non-programmers to think they can program. I have many years of experience in technical support (we programmed in assembler on IBM mainframes) supporting COBOL shops, and I have the scars to prove it.

                                    Simply Elegant Designs JimmyRopes Designs
                                    Think inside the box! ProActive Secure Systems
                                    I'm on-line therefore I am. JimmyRopes

                                    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

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

                                      Douglas Troy wrote:

                                      I cannot recall what the INDEXED allows you to do anymore ..

                                      i think that defines an iterator/pointer that's initialized to the start of the subgroup.

                                      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

                                        S Offline
                                        S Offline
                                        Sean Cundiff
                                        wrote on last edited by
                                        #24

                                        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

                                        C M 2 Replies 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

                                          S Offline
                                          S Offline
                                          Sean Cundiff
                                          wrote on last edited by
                                          #25

                                          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 A 2 Replies 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