|
View previous topic :: View next topic
|
| Author |
Message |
Punki
New User
Joined: 31 Oct 2006 Posts: 12
|
|
|
|
Hi together,
I'm struggling with the folowed REXX code. It should give all DSNAMEs
from a given VOLSER. And I'll save these information into a file.
The first volser works... but the secound Volser didn't work. i can't find
the error.
Hope you can help me.
| Quote: |
DROP vl.
cnt = 0
do i = 1 to vol.0
volume = strip(vol.i)
say volume
cnt = cnt + 1
vl.0 = cnt
vl.cnt = volume
drop ct2
ct2 = 0
address ispexec ("LMDINIT LISTID("LID") VOLUME("volume")")
say 'LOC 1:' RC
if RC > 8 then exit 8
address ispexec ("LMDLIST LISTID("LID") DATASET(DSNAME) STATS(YES)")
say lid
say 'LOC 2:' RC
do while RC = 0
ct2 = ct2 + 1
cnt = cnt + 1
vl.0 = cnt
vl.cnt = VOLUME!!" "!!ct2 !!" "!!dsname
address ispexec ("LMDLIST LISTID("LID") DATASET(DSNAME) STATS(YES)
say 'LOC 3:' RC
end /* END DO WHILE */
address ISPEXEC("LMDFREE LISTID("LID")")
say 'LOC 4:' RC
end
|
Thanks alot
OlliP |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1441 Location: Bamberg, Germany
|
|
|
|
| Use, if possible, an IDCAMS DCOLLECT as input. Makes more sense to me. |
|
| Back to top |
|
 |
Willy Jensen
Active Member

Joined: 01 Sep 2015 Posts: 774 Location: Denmark
|
|
|
|
| Off the top of my head, I think that the statement LMDINIT LISTID("LID") should not have quotes around the LID, as it names the listid variable to be used later. To be clear, use LMDINIT LISTID(LID)..... |
|
| Back to top |
|
 |
Punki
New User
Joined: 31 Oct 2006 Posts: 12
|
|
|
|
Hi together,
thanks alot for your answers.
I found a solution. Didn't know if it is the optimal solution, but it works for me
First member (member name as you like).
| Quote: |
/* REXX */
ADDRESS TSO
"ALLOC F(INPUT1) DA('SYS7.CLIST(VOLLIST)') SHR "
"EXECIO * DISKR INPUT1 (STEM VOL. FINIS"
"FREE F(INPUT1)"
do i = 1 to vol.0
volume = strip(vol.i)
call volume(volume)
end
exit 0
|
and we need a secound member with the name volume in the same library
| Quote: |
/* REXX */
arg volume
drop cnt
drop vl.
vl.0 = 0
cnt = 0
cnt = cnt + 1
vl.0 = cnt
vl.cnt = VOLUME
address ispexec ("LMDINIT LISTID("LID") VOLUME("volume")")
if RC > 8 then exit 8
address ispexec ("LMDLIST LISTID("LID") DATASET(DSNAME) STATS(YES)")
do while RC = 0
if RC = 0 then do
cnt = cnt + 1
t_value = cnt - 1
t_value = RIGHT(t_value,7,'0')
vl.0 = cnt
vl.cnt = VOLUME!!" "!!t_value!!" "!!dsname
end
address ispexec ("LMDLIST LISTID("LID") DATASET(DSNAME) STATS(YES)")
end /* END DO WHILE */
address ISPEXEC("LMDFREE LISTID("LID")")
WORK_DA = 'SYS7.VOLUME.LIST'
DCBS = "UNIT(VIO) SPACE(100,10) CYLINDERS REUSE ",
" RECFM (F B) LRECL (60) BLKSIZE (0)"
RC = LISTDSI("'"WORK_DA"'")
IF RC = 0 THEN DO
ADDRESS TSO "ALLOC FI(TMPF) DA('"WORK_DA"') MOD"
END
ELSE DO
ADDRESS TSO "ALLOC FI(TMPF) DA('"WORK_DA"') MOD" DCBS
END
ADDRESS TSO "EXECIO * DISKW TMPF (STEM vl. FINIS"
ADDRESS TSO "FREE DD(TMPF)"
exit
|
In the member SYS7.CLIST(VOLLIST) is in each row a name of a volume.
like ,,,
VOLS01
VOLS02
VOLS03
You must execute the first member ... than you get a dataset SYS7.VOLUME.LIST
with the desired information.
So my problem is solved!
@Joerg: this was my first way to get the information... but it didn't fit into my plans.
@Willy: it seems that it make no difference if it is with or without quotes. I try this but get no other results. So i posted my problem,
Greetings
OlliP |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2283 Location: USA
|
|
|
|
| Punki wrote: |
and we need a secound member with the name volume in the same library
|
In order to simplify the life, you can use inner procedure within the same member.
| Code: |
/* REXX */
ADDRESS TSO
"ALLOC F(INPUT1) DA('SYS7.CLIST(VOLLIST)') SHR "
"EXECIO * DISKR INPUT1 (STEM VOL. FINIS"
"FREE F(INPUT1)"
do i = 1 to vol.0
volume = strip(vol.i)
call volume(volume)
end
exit 0
/*=======================================*/
VOLUME: Procedure
. . . . . . . . . . .
Return
|
P.S.
1. Very bad habit: using the same name "volume" for different program entities. In many cases it is not allowed by compiler/interpreter (Thanks God!), but it's better to NEVER TRY DOING SO.
2. The keyword Procedure is optional but useful; it allows isolation of namespaces between different parts of the same REXX member. |
|
| Back to top |
|
 |
Willy Jensen
Active Member

Joined: 01 Sep 2015 Posts: 774 Location: Denmark
|
|
|
|
I still recommend that you change your LMDINIT, so as not confuse yourself at some later stage. The listid parameter defines the name of the variable into which is stored the list-id to be associated with the list of data set names.
The reason it worked for your first iteration is that the variable name you use 'LID' had not been initialized yet and thus contained its own name name as value. That is basic REXX. The LMDINIT sets the value of LID to something else, i.e ISP12345, the first time around. In your code you specify LISTID('LID'), but the 2nd time around LID contains ISP12345, which result in the variable ISP12345 being set to the new list-id. But you are still using the LID variable name in the LMDLIST command, and LID still contains ISP12345.
So, go back your original code, remove the quotes in LISTID('LID') in the LMDINIT and see if it works now. |
|
| Back to top |
|
 |
|
|