View previous topic :: View next topic |
Author |
Message |
Dhananjay G. Khandekar Beginner
Joined: 25 Nov 2004 Posts: 1 Topics: 1 Location: Pune India
|
Posted: Thu Nov 25, 2004 2:15 am Post subject: How to create an arrary or a table in CLIST? |
|
|
Hi,
In CLIST following code is in loop till end of file is reached:
GETFILE MASTFILE
SET PROJARRAY&COUNTADD = &SUBSTR(1:17,&MASTFILE)
WRITE PROJARRAY&COUNTADD &PROJARRAY&COUNTADD &SUBSTR(1:17,&MASTFILE)
SET COUNTADD = &COUNTADD + 1
But the array is not stored and the out put is as below:
PROJARRAY1 1 00000000000000000
PROJARRAY2 2 HBAP0000000000000
PROJARRAY3 3 HBHK0000000000000
PROJARRAY4 4 HBMX0000000000000
PROJARRAY5 5 99999999999990000
Can you please let me know where I am going wrong? The similar logic is given in the manuals but it is not working in my CLIST.
I want to define an array and store the file keys into it.
Please, help!! _________________ Regards, Dhananjay |
|
Back to top |
|
|
Maton_Man Beginner
Joined: 30 Jan 2004 Posts: 123 Topics: 0
|
Posted: Thu Nov 25, 2004 8:02 pm Post subject: |
|
|
This CLIST will demonstrate what you want. It will print the numbers from 0 - 98 that are stored in variables which resolve to the name ARRAY1, ARRAY2, etc...
PROC 0
SET INDEX = 0
SET VALUE = 0
SET VARIABLE = &&ARRAY&INDEX
HERE: SET ARRAY&INDEX = &VALUE
SET ARRAYVAL = &&ARRAY&INDEX
WRITE &ARRAYVAL
SET INDEX = &INDEX + 1
SET VALUE = &VALUE + 2
IF &VALUE < 100 THEN GOTO HERE
EXIT: EXIT
If I was you I'd forget CLIST and learn Rexx. For a short learning curve you will get a massive benefit. CLIST is a dead language and that only reason it is still around is to support people who refuse to stop using it. _________________ My opinions are exactly that. |
|
Back to top |
|
|
|
|