View previous topic :: View next topic
|
Author |
Message |
karthi_ind
Active User
Joined: 24 Feb 2004 Posts: 131 Location: Chennai
|
|
|
|
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 |
|
|
meetsrk
New User
Joined: 13 Jun 2004 Posts: 85
|
|
|
|
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 |
|
|
meetsrk
New User
Joined: 13 Jun 2004 Posts: 85
|
|
|
|
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 |
|
|
mcmillan
Site Admin
Joined: 18 May 2003 Posts: 1210 Location: India
|
|
|
|
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 |
|
|
jagdishmudiraj
New User
Joined: 25 Apr 2007 Posts: 7 Location: gurgaon
|
|
|
|
Subscrip------ its an occurence
whereas
Index---------- its an displacement from the starting position |
|
Back to top |
|
|
|