IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Diff b/w INDEX & SUBSCRIPT, Use of FILLER Clause


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
karthi_ind

Active User


Joined: 24 Feb 2004
Posts: 131
Location: Chennai

PostPosted: Mon Jun 14, 2004 3:01 pm
Reply with quote

hi to all


my question is


1) What is the diff. b/w index and subscript?

2) what r diff. types of divisions. I saw in a book that thr
are 6 division. i know only 4 div. id div,en div,data div,proc div
what are all the other two div.

3) whatz the use of filler clause?
Back to top
View user's profile Send private message
meetsrk

New User


Joined: 13 Jun 2004
Posts: 85

PostPosted: Mon Jun 14, 2004 7:39 pm
Reply with quote

hi karthik_ind,

for question...
1. difference b/w index and subscript is
Index is defined in occurs clause i.e for example,

02 LETTER REDEFINES TABLEVAL.
03 LETVAL PIC X OCCURS 26 TIMES INDEXED BY LTIDX.
...
...
add 1 to LTIDX. ===> cannot be done. yields to error

so here, LETVAL array can only be accesed by LTIDX
ie LETVAL(LTIDX). you cannot use any other integer variable.
LTIDX is called the index. and it initialized using SET verb. also we cannot use index variable for any arithmatic operation.


whereas,
Subscript is a normal variable used for accessing the array.
for e.g,

working-storage section.
77 i pic 9.
77 a pic x occurs 26 times.
...
...
...
procedure division.
...
...
add 1 to i. ===> can be done
display a(i).
...
...

so here, I is the subscript, here u can use that variable 'i' for any function, ie we can increment, decrement etc.


2. let me check it out and later answer it.
Back to top
View user's profile Send private message
meetsrk

New User


Joined: 13 Jun 2004
Posts: 85

PostPosted: Mon Jun 14, 2004 7:45 pm
Reply with quote

for question..
3. Filler clause is used where we need some data that should not be assigned to the variables.

for e.g, to display a heading for a report like

ABC Company


eq. code is,

01 header.
02 filler pic x(75) value 'ABC COMPANY'.
...
...
...
....
display header.
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1210
Location: India

PostPosted: Tue Jun 15, 2004 12:22 pm
Reply with quote

Quote:
1) What is the diff. b/w index and subscript?


Index variables access the array element using the displacement (memory address), while subscript access the array using occurance number (position). Indixes are more faster and can be used to search the table.

Quote:
2) what r diff. types of divisions. I saw in a book that thr
are 6 division. i know only 4 div. id div,en div,data div,proc div
what are all the other two div.


There are 4 divisions only in COBOL. I beleive, you misunderstand with the 6 sections in data division.


Quote:
3) whatz the use of filler clause?


Used to initialize an undeclared element.
Used to reserve memory for future use
Used to declare constants
Used to save memory area
Used to initialize a table
Back to top
View user's profile Send private message
jagdishmudiraj

New User


Joined: 25 Apr 2007
Posts: 7
Location: gurgaon

PostPosted: Wed Jun 20, 2007 6:51 pm
Reply with quote

Subscrip------ its an occurence
whereas
Index---------- its an displacement from the starting position
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Cobol file using index COBOL Programming 2
No new posts To search DB2 table based on Conditio... DB2 1
No new posts Finding faulty logic Subscript out of... COBOL Programming 5
No new posts DL/I status code AK for GU call using... IMS DB/DC 1
No new posts Need to add field to copybook, proble... COBOL Programming 14
Search our Forums:

Back to Top