|
View previous topic :: View next topic
|
| Author |
Message |
maridawson
New User

Joined: 24 Jun 2008 Posts: 59 Location: chennai
|
|
|
|
hi ,
i have written a ispf macro. that macro is for copying specific set of lines from a dataset and to store those lines in some variables. so that i can write these variables to another result dataset.
the problem here is, for the following loop,
COUNT=1
DO RLINE = FIRST TO LAST BY 1
"ISREDIT (JP."COUNT") = LINE "RLINE
COUNT=COUNT+1
END
FIRST and LAST are the line numbers.....
i could not define the variable is jp.count because it is saying... the syntax is wrong ...... how can i define a variable to get all the lines of that dataset into the variables. |
|
| Back to top |
|
 |
maridawson
New User

Joined: 24 Jun 2008 Posts: 59 Location: chennai
|
|
|
|
i have also tried like without '.' ........ like jp"count" ...... but i couldnt get the values back .... since i cannot form a loop for getting the values of
jp1
jp2
jp3
jp4
since if i give jpcount ...... it will be considered as a single variable..... |
|
| Back to top |
|
 |
Marso
REXX Moderator

Joined: 13 Mar 2006 Posts: 1356 Location: Israel
|
|
|
|
Do it the easy way:
| Code: |
COUNT=1
DO RLINE = FIRST TO LAST BY 1
"ISREDIT (LI) = LINE "RLINE
JP.COUNT = LI
COUNT=COUNT+1
END |
|
|
| Back to top |
|
 |
Pedro
Global Moderator

Joined: 01 Sep 2006 Posts: 2624 Location: Silicon Valley
|
|
|
|
I prefer starting with zero, otherwise the count is one too many.
| Code: |
COUNT=0
DO RLINE = FIRST TO LAST BY 1
"ISREDIT (LI) = LINE "RLINE
COUNT=COUNT+1
JP.COUNT = LI
END |
|
|
| Back to top |
|
 |
Pedro
Global Moderator

Joined: 01 Sep 2006 Posts: 2624 Location: Silicon Valley
|
|
|
|
| You might also try using the CUT macro statement followed later by a macro that uses PASTE. |
|
| Back to top |
|
 |
maridawson
New User

Joined: 24 Jun 2008 Posts: 59 Location: chennai
|
|
|
|
thanks marso and pedro...... i got it ..... that was very simple .... how come i didnt get that idea .......  |
|
| Back to top |
|
 |
|
|