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
M

Member 3240213

@Member 3240213
About
Posts
2
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Microsoft Needs to Stop Making Browsers.
    M Member 3240213

    IE DOES have AdBlock. Logged in here from Windows 7 with IE11 (old system!), and running AdBlock Plus. Log in to www.adblockplus.org and on the right-hand side it offers links for Firefox, Chrome, Android, Opera, Internet Explorer, Safari, Yandex, Maxthon AND Microsoft Edge. So lack of AdBlock is not the only reason for not using IE?!?

    The Lounge

  • Gods Of COBOL
    M Member 3240213

    What the code means depends upon the flexibility or otherwise of the compiler used, and the specifics of the machine it was supposed to run on. In general terms the '01' prefix defines a word/byte aligned ares of memory. The use of 'redefines' means what it says - the two definitions map to the same area of memory. Generally a forgiving compiler won't be worried anout what other people have said, that one definition appears 'longer' than the other I'm intrigued by the 'PIC 9(04) COMP-5' definitions though - as far as I remember 'COMP-5' refers to binary data, not necessarily byte or word-aligned. So ignoring all that..... The user has declared a chunk of memory, nominally 2816 CHARACTERS long (the use of 'PIC X(..)' indicates a character field). The memory starts at a word/byte boundary (depends on the target hardware implementation). I would assume a word boundary myself... The memory area has been (alternatively) defined as two smaller 'tables' - or ARRAYS if you will. The first contains 37 items (each named K01-1), the second 1368 items (each named K02-1). These items will normally be referred to in the code using an index variable or literal (i.e K01-1(1) to K01-1(37), K02-1(1) to K02-1(1369) or K01-1(index variable name). COBOL compilers could generate run-time checks on the index values used to ensure that only valid ranges were used, and COBOL uses '1' as the lowest index value, rather than zero. Specifying the names K01-1-X and K02-1-X implies that later in the code the user will be using these items as the 'normal' way of addressing each (array) element. COBOL would let you mix and match whether you used literals, index variables, or integer data items to index the data. Use of the 'INDEXED BY...' allows the use in the code of statements such as:

    SET index-name-variable TO n.
    SET index-name-variable UP (or DOWN) BY n.

    Otherwise you would normally define an integer data item and use that as an index value i.e.

    01 ITEM-PTR PIC 9(4) COMP SYNC RIGHT.

    and later

    MOVE n TO ITEM-PTR.
    ADD n to K02-1 (ITEM-PTR).
    ...etc.

    You could also write things such as:

    PERFORM suroutine-name VARYING K02-1-X FROM 1 BY 1 UNTIL K02-1-X EQUALS 1369.

    The only downside of COBOL was that the arrays were of fixed size (up to 3 dimensions), and you had to know at the time of compiling the code what the maximum index values were for each dimension. In practise this wasn't hard as you had to design the table (array) to suit your requ

    The Lounge com performance question
  • Login

  • Don't have an account? Register

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