View previous topic :: View next topic
|
Author |
Message |
hazard84414 Warnings : 1 New User
Joined: 20 May 2006 Posts: 4
|
|
|
|
Hi, everyone:
Could you give me a sample which declare a array and how to use it ? |
|
Back to top |
|
|
banu
New User
Joined: 09 Aug 2005 Posts: 8 Location: Chennai
|
|
|
|
DCL
NAME(3) CHAR(1) INIT(' ');
/* NAME -> Array */
Get List (Name); /* Get the Input */
Do I = 1 to Hbound(Name,1); /* Hbound -> Highest limit of the array */
Put list (Name(i)); /* Display the Output */
End;
-- I Hope this is what you required... |
|
Back to top |
|
|
banu
New User
Joined: 09 Aug 2005 Posts: 8 Location: Chennai
|
|
|
|
In my previous example, I forgot to give declaration for the variable 'I'. |
|
Back to top |
|
|
chan2004
New User
Joined: 28 Mar 2007 Posts: 16 Location: India
|
|
|
|
How do you get the hbound of an array of structures?
I am getting IBM1641I error.
Thanks,
C |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you provide more complete info (i.e. your code so far). . .
Also, you have replied to a topic that has been inactive for almost 4 years. . . |
|
Back to top |
|
|
donateeye Warnings : 2 New User
Joined: 01 Jun 2007 Posts: 62 Location: chennai
|
|
|
|
Well.. Could anyone just explain with a simple example on homw hbound work? and dimension too.. please... |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
donateeye wrote: |
Well.. Could anyone just explain with a simple example on homw hbound work? and dimension too.. please... |
RTFM! Enter HBOUND in the text-box and press F3 repeatedly (aka 7 times) until you see what you need! |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
DIMENSION returns a FIXED BINARY(31,0) value specifying the current extent of dimension y of x.
|
Quote: |
LBOUND returns a FIXED BINARY (31,0) value specifying the current lower bound of dimension y of x. |
Quote: |
HBOUND returns a FIXED BINARY(31,0) value specifying the current upper bound of dimension y of x.
|
everything seems pretty clear to me...
what is that You do not understand ??
c /extent/cardinality
c /dimension/index |
|
Back to top |
|
|
donateeye Warnings : 2 New User
Joined: 01 Jun 2007 Posts: 62 Location: chennai
|
|
|
|
SO, if I have an array a(100)
then DIM(a) is 100,
LBOUND(a) is 0
and HBOUND(a) is 100
Is that right...? |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
donateeye wrote: |
SO, if I have an array a(100)
then DIM(a) is 100,
LBOUND(a) is 0
and HBOUND(a) is 100
Is that right...? |
No, LBOUND is 1.
DCL A(-3:3, 77:99)
DIM(A, 1) = 7
DIM(A, 2) = 23
LBOUND(A, 1) = -3
HBOUND(A, 1) = 3
LBOUND(A, 2) = 77
HBOUND(A, 2) = 99 |
|
Back to top |
|
|
donateeye Warnings : 2 New User
Joined: 01 Jun 2007 Posts: 62 Location: chennai
|
|
|
|
Thats the one I am looking for... Prino... you are a star |
|
Back to top |
|
|
|