Tuesday, January 26, 2021
  • PRESS RELEASE
  • ADVERTISE
  • CONTACT
No Result
View All Result
Tech News, Magazine & Review WordPress Theme 2017
  • Home
  • Technology

    Spotify launches collection of audiobooks as it tests yet another market

    Corsair K95 RGB Platinum Reviews

    Apple has a new head of hardware engineering in latest executive shuffle

    How AI can make the world more fair for ‘gifted’ kids

    Plan for the big game: Order your party staples online

    The future of social networks might be audio

  • Science

    How Two Masks Block Covid-19 Coronavirus Better Than One

    In Israel, Infections Drop Sharply After One Shot of Vaccine

    The places where Americans aren’t wearing masks

    Why cats and dogs may need their own COVID-19 vaccines

    ‘Blade Runner: 2029’ exclusive: Ash returns to the rain-soaked streets of future Los Angeles

    Covid-19 news: Moderna vaccine appears to work against new variants

  • Medical/Pharmacology

    Circulating antiphospholipid antibodies drive endothelial cell activation in COVID-19

    Air pollution linked to heightened risk of progressive and irreversible sight loss (AMD)

    How Biden will restore the ACA: 4 potential changes

    Our Favorite Baby Bouncer

    FDA approves new DES system for large, proximal vessels

    In a major setback, Merck to stop developing its Covid-19 vaccines

    Trending Tags

    • Playstation 4 Pro
    • iOS 10
    • iPhone 7
    • Sillicon Valley
  • Cloud Computing

    Top 10 Cloud Security Best Practices for All Enterprises

    Bridging the datacenter and edge dichotomy

    IT Infrastructure Management Model That Codifies Everything

    We need a new way to think about open source

    4 reasons customers are asking service partners for Azure Lighthouse | Azure Blog and Updates

    Assessing AWS’ softening stance on multi-cloud – with Amazon ECS Anywhere and EKS Anywhere

  • Data Center

    Technology Company Saves $262K Annually

    F5 Networks completes Volterra acquisition

    Efficiency Slashes Data Center Energy Impact

    Japanese tech firm NTT acquires 6-acre land in Greater Noida to set up data centre, IT News, ET CIO

    Wistron & Kalray unveil data centre storage appliance

    Optus partners with Google Cloud to improve customer support capabilities

  • Software Development

    Tech Stacks and Website Longevity

    Consistent Hashing Using Fibonacci Encoding allows O(log(n)) for all operations including adding and removing nodes instead of O(k/n+log(n)). : programming

    Recreating Frontier Development Lab’s Sun in Three.js

    Project Manager job offer in Barcelona

    Ray tracing using ASCII : programming

    C++ Program: Matrix Multiplication – Tutorial And Example

  • The Quotes Of The Day
  • Home
  • Technology

    Spotify launches collection of audiobooks as it tests yet another market

    Corsair K95 RGB Platinum Reviews

    Apple has a new head of hardware engineering in latest executive shuffle

    How AI can make the world more fair for ‘gifted’ kids

    Plan for the big game: Order your party staples online

    The future of social networks might be audio

  • Science

    How Two Masks Block Covid-19 Coronavirus Better Than One

    In Israel, Infections Drop Sharply After One Shot of Vaccine

    The places where Americans aren’t wearing masks

    Why cats and dogs may need their own COVID-19 vaccines

    ‘Blade Runner: 2029’ exclusive: Ash returns to the rain-soaked streets of future Los Angeles

    Covid-19 news: Moderna vaccine appears to work against new variants

  • Medical/Pharmacology

    Circulating antiphospholipid antibodies drive endothelial cell activation in COVID-19

    Air pollution linked to heightened risk of progressive and irreversible sight loss (AMD)

    How Biden will restore the ACA: 4 potential changes

    Our Favorite Baby Bouncer

    FDA approves new DES system for large, proximal vessels

    In a major setback, Merck to stop developing its Covid-19 vaccines

    Trending Tags

    • Playstation 4 Pro
    • iOS 10
    • iPhone 7
    • Sillicon Valley
  • Cloud Computing

    Top 10 Cloud Security Best Practices for All Enterprises

    Bridging the datacenter and edge dichotomy

    IT Infrastructure Management Model That Codifies Everything

    We need a new way to think about open source

    4 reasons customers are asking service partners for Azure Lighthouse | Azure Blog and Updates

    Assessing AWS’ softening stance on multi-cloud – with Amazon ECS Anywhere and EKS Anywhere

  • Data Center

    Technology Company Saves $262K Annually

    F5 Networks completes Volterra acquisition

    Efficiency Slashes Data Center Energy Impact

    Japanese tech firm NTT acquires 6-acre land in Greater Noida to set up data centre, IT News, ET CIO

    Wistron & Kalray unveil data centre storage appliance

    Optus partners with Google Cloud to improve customer support capabilities

  • Software Development

    Tech Stacks and Website Longevity

    Consistent Hashing Using Fibonacci Encoding allows O(log(n)) for all operations including adding and removing nodes instead of O(k/n+log(n)). : programming

    Recreating Frontier Development Lab’s Sun in Three.js

    Project Manager job offer in Barcelona

    Ray tracing using ASCII : programming

    C++ Program: Matrix Multiplication – Tutorial And Example

  • The Quotes Of The Day
Infinity CS News
No Result
View All Result

COBOL Arrays – Tutorial And Example

Superuser by Superuser
January 11, 2021
Home Software Development
Share on FacebookShare on Twitter


COBOL RANGES

  • Rather of specifying the very same kind of information numerous times that might fall under the very same classification or group, COBOL supplies us with an effective function called as range
  • To enhance the use and home of components, these components of the very same type and behaviour can be organized in the internal table, and described as range.
  • The records/data, which are to be saved in a range should include comparable homes, i.e., PHOTO STIPULATION.
  • Varieties are divided in the kind of rows and columns.
  • A selection can be of various types; 1– dimensional, 2-dimensional.

INTERNAL TABLE COMMAND OR RANGES

FOR INSTANCE,

Expect we need to specify the days of the week, either we can represent declarations like this.

01 WEEK

05 DAY01 PHOTO X( 9) WORTH ‘ MONDAY’

05 DAY02 PHOTO X( 9) WORTH ‘ TUESDAY’

05 DAY03 PHOTO X( 9) WORTH ‘ WEDNESDAY’

05 DAY04 PHOTO X( 9) WORTH ‘ THURSDAY’

05 DAY05 PHOTO X( 9) WORTH ‘ FRIDAY’

05 DAY06 PHOTO X( 9) WORTH ‘ SATURDAY’

05 DAY07 PHOTO X( 9) WORTH ‘ SUNDAY’

Rather of doing this, we can merely specify internal table week and later on input these components in a single group making it simple for us to control information.

01 WEEK– TABLE

05 DAY– NAME PHOTO X( 9) TAKES PLACE 7 TIMES

OR

01 WEEK– TABLE

05 DAY– NAME TAKES PLACE 7 TIMES PHOTO X( 9)

HAPPEN STIPULATION:

  • The take place Claus is utilized to specify the variety of events of a component in a table or range.
  • Occur Claus need to be utilized for group or primary information products just.
  • Depending upon the kind of range, i.e., one dimensional or two-dimensional, we can have numerous take place Claus.
  • To access the components of the table, we can utilize index or subscript.
  • One dimensional range consists of one OCCUR provision, and the two-dimensional range consists of 2 OCCUR Claus.

REFERRING ASPECTS IN AN SELECTION:

There are 2 methods to describe the components in a range:

1) INDEX:-

It describes the displacement position of number from the starting of a range, likewise referred to as balanced out. We utilize the” INDEX BY” provision to state index, and we do not specify index in the working storage area.

SYNTAX =>>

01 TABLE– WEEK

05 NAME– DAY PHOTO X( 09) TAKES PLACE 7 TIMES

[ ASCENDING / DESCENDING KEY IS key–1 . . . ]

[ INDEXED BY index–name ]

EXAMPLE => > utilizing the above syntax

NAME– DAY( 1) has a displacement of 0

NAME– DAY( 2) has a displacement of 9

NAME– DAY( 1) has a displacement of 18 and so on

If we increase the index by 1, the length gets increased by the length specified in the PHOTO provision.

How to appoint a worth to the index?

The SET STIPULATION is utilized to start INDEX or to set the worth of the INDEX.

EXAMPLE =>>

a) SET index-1 to index-2

b) SET index-1 to 1

c) SET index-1 UP BY 1

d) SET index-1 DOWN BY 1

KEEP IN MIND:- SET is likewise utilized to set the worth of switch to ON/ OFF. It can likewise be utilized to appoint REAL/ FALSE to a conditional declaration.

2) SUBSCRIPT:-

  • An important information product that explains the variety of event of components in a range.
  • Subscript describes the memory place of a specific information product and where it lives. It suggests the assigned memory is not the real memory; rather points towards the position of the information product.
  • The subscripts are specified in the working storage area with

‘ PHOTO a9( 04) COMPENSATION ‘.

  • To initialize the subscript, we need to utilize the RELOCATION declaration.
  • Subscript begins with number 1 and later on 1 is increased each time with the aid of ADD function.

EXAMPLE =>>

— To refer a component one in the last example, we need to provide NAME-DAY( 1 )

— In order to choose component 2 in the last example, we need to do the following

NAME– DAY (2) and so on …

SAMPLE PROGRAM–

This is a demonstration program to find out and comprehend the principle of one-dimensional range and how to appoint worths to range.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

DEVELOPING 1 DIMENSIONAL SELECTION

RECOGNITION DEPARTMENT

PROGRAM– ID ONE– D– ARR

DATA DEPARTMENT

WORKING– STORAGE AREA

01 WS– STR– TABLE

05 WS– PRD TAKES PLACE 3 TIMES PHOTO X( 10)

TREATMENT DEPARTMENT

RELOCATION ” SOAP “ TO WS– PRD( 1)

RELOCATION ” CLEANING AGENT “ TO WS– PRD( 2)

RELOCATION ” HAIR SHAMPOO “ TO WS– PRD( 3)

DISPLAY SCREEN ” I AM EXAMPLE OF ONE DIMENSIONAL SELECTION”

DISPLAY SCREEN ” ITEM 1: “ WS– PRD( 1)

DISPLAY SCREEN ” ITEM 2: “ WS– PRD( 2)

DISPLAY SCREEN ” ITEM 3: “ WS– PRD( 3)

STOP RUN

THE OUTPUT WILL BE

I AM EXAMPLE OF ONE DIMENSIONAL SELECTION

ITEM 1 : SOAP

ITEM 2 : CLEANING AGENT

ITEM 3 : HAIR SHAMPOO

Here in this program, we have actually designated a couple of variables with various worths and later on controlled the output utilizing various homes of a range to make you clear about the various ideas connected to ONE DIMENSIONAL SELECTION. With this program and output, you will have the ability to comprehend how practical and simple selections are.

SAMPLE PROGRAM–

This is a demonstration program to find out and comprehend the principle of two-dimensional range and how to appoint worths to range.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

DEVELOPING 2 DIMENSIONAL SELECTION

RECOGNITION DEPARTMENT

PROGRAM– ID 2– D– ARR

DATA DEPARTMENT

WORKING– STORAGE AREA

01 WS– SHOP– PROD– TABLE

05 WS– SHOP– ID TAKES PLACE 3 TIMES

10 WS– ITEM TAKES PLACE 5 TIMES PHOTO 9( 08)

01 WS– TIME PHOTO 9( 08)

01 I PHOTO 9( 01)

01 J PHOTO 9( 01)

TREATMENT DEPARTMENT

ACCEPT WS– TIME FROM TIME

DISPLAY SCREEN ” I AM EXAMPLE OF 2 DIMENSIONAL SELECTION”

PERFORM ITEM– PARA DIFFERING I FROM 1 BY 1 UNTIL I >> 3

AFTER J FROM 1 BY 1 UNTIL J >> 5.

STOP RUN

ITEM– PARA

RELOCATION WS– TIME TO WS– ITEM( I, J)

DISPLAY SCREEN ” ITEM” I “,” J

WS– ITEM( I, J)

ADD 1 TO WS– TIME

THE OUTPUT WILL BE

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

I AM EXAMPLE OF 2 DIMENSIONAL SELECTION

PRODUCT1 , 114350661

PRODUCT1 , 214350662

PRODUCT1 , 314350663

PRODUCT1 , 414350664

PRODUCT1 , 514350665

PRODUCT2 , 114350666

PRODUCT2 , 214350667

PRODUCT2 , 314350668

PRODUCT2 , 414350669

PRODUCT2 , 514350670

PRODUCT3 , 114350671

PRODUCT3 , 214350672

PRODUCT3 , 314350673

PRODUCT3 , 414350674

PRODUCT3 , 514350675

Here in this program, we have actually designated a couple of variables with various worths and later on controlled the output utilizing various homes of a range to make you clear about the various ideas connected to TWO-DIMENSIONAL SELECTION. With this program and output, you will have the ability to comprehend how practical and simple multi-dimensional selections are.

COBOL Arrays

SAMPLE PROGRAM–

This is a demonstration program to find out and comprehend the principle of index by home of a range and how to appoint worths to range.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

RECOGNITION DEPARTMENT

PROGRAM– ID INDEXBY

DATA DEPARTMENT

WORKING – STORAGE AREA

01 WS – SHOP

05 WS – ITEM TAKES PLACE 3 TIMES INDEXED BY IDX

10 WS – PRODUCT – CODE PHOTO 9( 05)

01 WS – PRODUCT – VAL PHOTO 9( 05) WORTH 12345

TREATMENT DEPARTMENT

SET IDX TO 1

PERFORM PROD– INFORMATION UNTIL IDX >> 3

STOP RUN

PROD – INFORMATION

RELOCATION WS – PRODUCT – VAL TO WS – PRODUCT – CODE( IDX)

DISPLAY SCREEN ” ITEM “ WS – PRODUCT – CODE( IDX)

ADD 1 TO WS – PRODUCT – VAL

SET IDX UP BY 1.

THE OUTPUT WILL BE

ITEM 12345

ITEM 12346

ITEM 12347

Here in this program, we have actually designated a couple of variables with various worths and later on controlled the output utilizing various homes of a range to make you clear about the various ideas connected to INDEX BY home of a RANGE.

COBOL Arrays

SAMPLE PROGRAM–

This is a demonstration program to find out and comprehend the principle of subscript home of a range and how to appoint worths to range.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

RECOGNITION DEPARTMENT

PROGRAM– ID SUBSCR

DATA DEPARTMENT

WORKING– STORAGE AREA

01 WS– SHOP

05 WS– ITEM TAKES PLACE 3 TIMES INDEXED BY IDX

10 WS– PRODUCT– CODE PHOTO 9( 05)

01 WS– PRODUCT– VAL PHOTO 9( 05) WORTH 12345.

01 WS– SUB PHOTO 9( 01) WORTH 01.

TREATMENT DEPARTMENT

RELOCATION 1 TO WS– SUB

PERFORM PROD– INFORMATION UNTIL WS– SUB >> 3.

STOP RUN

PROD– INFORMATION

RELOCATION WS– PRODUCT– VAL TO WS– PRODUCT– CODE( IDX)

DISPLAY SCREEN ” ITEM “ WS– SUB ” “ WS– PRODUCT– CODE( IDX)

ADD 1 TO WS– PRODUCT– VAL

ADD 1 TO WS– SUB

SET IDX UP BY 1.

THE OUTPUT WILL BE

ITEM 1 12345

ITEM 2 12346

ITEM 3 12347

COBOL Arrays

Here in this program, we have actually designated a couple of variables with various worths and later on controlled the output utilizing various homes of a range to make you clear about the various ideas connected to the SUBSCRIPT home of a RANGE.

DISTINCTION BETWEEN INDEX AND SUBSCRIPT

As we are currently mindful, both index and subscript are effective tools in COLOB shows and mainly do the very same job, however still, there’s a substantial distinction that we will be talking about.

INDEX =>>

  • Describes the balanced out or displacement in the starting of a range.
  • We utilize INDEX BY Claus to start the worth.
  • INDEX is much quicker compared to SUBSCRIPT as it describes the memory place, so it has relatively much better and faster efficiency.
  • INDEX is not specified in the working storage area and is initialized by the SET operation.

SUBSCRIPT =>>

  • It describes the range components’ event, and we do not utilize the INDEX BY provision to start.
  • SUBSCRIPT is much slower compared to INDEX, as it does not describe memory place.
  • We need to specify SUBSCRIPT in the working storage area and is initialized by WORTH or RELOCATION declarations.

SEARCH AND SEARCH ALL

In specific scenarios, we need to look for a specific record or worth present in a table. We will browse all the information by hand, discovering specific information, however that is not that simple. Rather, we can utilize commands like search or browse all t o quickly filter the total information and discover our wanted outcome.

SEARCH =>>

It is a direct or consecutive search and is mainly utilized in tables and range where information is not arranged.

SYNTAX =>>

SEARCH TABLE – NAME [ VARYING { identifier1 / index1 } ]

[ AT END Statement ]

{ WHEN ConditionPass

{ declaration / NEXT SENTENCE / CONTINUE } . }

END – SEARCH

SEARCH ALL =>>

It is a kind of binary search and is mainly utilized when selections and tables are currently arranged.

SYNTAX =>>

SEARCH ALL TABLE – NAME

[ AT END Statement ]

{ WHEN ConditionPass

{ declaration / NEXT SENTENCE / CONTINUE } . }

END – SEARCH

DISTINCTION IN BETWEEN SEARCH AND SEARCH ALL

SEARCH =>>

  • SEARCH is utilized to discover a component or record present in a direct way, likewise referred to as consecutive search.
  • We can code the SEARCH command for the tables and selections that have record either arranged or unsorted, however we mainly utilize look for unsorted tables.
  • In this kind of search, the index should be initialized.
  • There is no principle for rising and coming down type in SEARCH.

SEARCH ALL =>>

  • SEARCH ALL is utilized to discover components or record present in BINARY format, likewise referred to as BINARY search.
  • We can code the SEARCH ALL command for the tables and selections that have actually arranged records.
  • In this kind of search, the index does not need to be initialized.
  • Rising and coming down essential need to be specified in a range while utilizing the SEARCH ALL command.

SAMPLE PROGRAM–

This is a demonstration program to find out and comprehend the principle of search all home of a range and how to appoint worths to range.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

RECOGNITION DEPARTMENT

PROGRAM– ID SEARCH

DATA DEPARTMENT

WORKING– STORAGE AREA

01 WS– SHOP

05 WS– ITEM TAKES PLACE 3 TIMES ASCENDING SECRET IS

WS– PRODUCT– CODE INDEXED BY IDX

10 WS– PRODUCT– CODE PHOTO 9( 05)

01 WS– PRODUCT– VAL PHOTO 9( 05) WORTH 12345.

TREATMENT DEPARTMENT

SET IDX TO 1.

PERFORM PROD– INFORMATION UNTIL IDX >> 3.

PERFORM SEARCH– ALL– PARA

STOP RUN

PROD– INFORMATION

RELOCATION WS– PRODUCT– VAL TO WS– PRODUCT– CODE( IDX)

DISPLAY SCREEN ” ITEM “ WS– PRODUCT– CODE( IDX)

ADD 1 TO WS– PRODUCT– VAL

SET IDX UP BY 1.

SEARCH– ALL– PARA

SEARCH ALL WS– ITEM

AT END DISPLAY SCREEN ” RECORD NOT FOUND”

WHEN WS– PRODUCT– CODE( IDX) = 12346

DISPLAY SCREEN ” RECORD FOUND”

DISPLAY SCREEN WS– PRODUCT– CODE( IDX)

END– SEARCH

THE OUTPUT WILL BE

ITEM 12345

ITEM 12346

ITEM 12347

RECORD FOUND

12346

Here in this program, we have actually designated a couple of variables with various worths and later on controlled the output utilizing various homes of a range to make you clear about the various ideas connected to the SEARCH ALL home of a RANGE.

COBOL Arrays



Source link

Tags: ArraysCOBOLTutorial
Superuser

Superuser

Next Post

COBOL Indexed File - Tutorial And Example

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Infinity CS News

Get the latest news and follow the coverage of Tech updates, science, breakthrough research news and more from the top trusted sources.

Categories

  • Cloud Computing
  • Data Center
  • Medical / Pharmacology
  • Science
  • Software Development
  • Technology
  • The Quotes Of The Day

Recent Posts

  • How Two Masks Block Covid-19 Coronavirus Better Than One
  • Circulating antiphospholipid antibodies drive endothelial cell activation in COVID-19
  • Spotify launches collection of audiobooks as it tests yet another market
  • Home
  • Disclaimer
  • DMCA
  • Privacy Policy
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact

Copyright © 2021 Infiniti CS News

No Result
View All Result
  • Home
  • Technology
  • Science
  • Medical/Pharmacology
  • Cloud Computing
  • Data Center
  • Software Development
  • The Quotes Of The Day

Copyright © 2021 Infiniti CS News