Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
What is the Syntax of the Two Dimensional Arry in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sakthivel janarthanan
Currently Banned

New User


Joined: 01 Mar 2007
Posts: 6
Location: Chennai

PostPosted: Thu Mar 01, 2007 1:09 am    Post subject: What is the Syntax of the Two Dimensional Arry in COBOL
Reply with quote

Hi All,

What is the Syntax of the Two Dimensional Arry in COBOL ? if Possible Please show me Simple Program.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Mar 01, 2007 1:47 am    Post subject:
Reply with quote

Hello,

Code:

77  the-hour      pic 9(3) comp-3 value 1.
77  the-minute   pic 9(3) comp-3 value 1.

01  two-dimension-table.
     05 hours-dim occurs 24 times.
         10 mins-dim   occurs 60 times.
             15  a-counter  pic 9(7) comp-3.
             


Let's say you had "something" that could happen multiple times a minute and you want to count how many times it happened for each hour/minute for some period of time (the input is NOT in hour/minute sequence). You could use the hour and minute to point to the "counter" for that time and add to it as appropriate.

The arrays need to be initialized to zeros before processing starts.

In the program, the "hour and minute" are moved/calculated from the input to the 2 corresponding 77-level fields.

Your code would then be:
Code:
add 1 to a-counter(the-hour, the-minute).


When the input has all been processed, a loop could be used to process all of the a-counter entries for all of the hours/minutes.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us