Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need VOLSERs from output tape 1

Status
Not open for further replies.

nxm150

Programmer
May 22, 2002
78
0
0
US
What is the best command to get all VOLSERs associated with a dataset?
 
Some background info - we currently send an email to our end users when their datasets have been created. They also want the VOLSERs associated with their DSN's. I plan on having a REXX pgm to pull the VOLSERs and then plug the VOLSERs into my email message. I have never coded in REXX before so any help is appreciated.
 
The LISTCAT command will deliver the VOLSER, but it will have to be parsed out of the listing.

If you have never coded in REXX before this may turn out to be quite a project.

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
I do have lots of CLIST experience so any coding shouldn't be too dificult.

I did a LISTCAT on a dataset that resides on tape output and got back the following -

NONVSAM ------- MY.DSN
IN-CAT --- CATALOG.HDCUCATW
***
I didn't get back a list of VOLSERs???
 
You need to use the ALL operand to get the volume. In REXX it would look something like this;
Code:
Call Outtrap 'OUT.'
"ListC Lev('MY.DSN') All"
Call Outtrap 'OFF'
do i = 1 to OUT.0
  select
    when index(OUT.i, 'NONVSAM') > 0 then ,
        say 'Dataset - 'word(OUT.i, words(OUT.i))
    when index(OUT.i, 'VOLSER-') > 0 then do
      parse var OUT.i . 'VOLSER------------' volume .
      say volume
    end
    otherwise nop
  end
end
 
Thanks alot for the sample code. I will give it a try tomorrow!
 
I am getting the following error -

STMT 7 - A(N) SELECT STMT WAS FOUND FOR WHICH THERE IS NO CORRESPONDING END STM
T

My code does have the correct number of 'END'. Any ideas??

CALL OUTTRAP 'OUT.'
"LISTC LEV('MYDSN') ALL"
CALL OUTTRAP 'OFF'
DO I = 1 TO OUT.0
SELECT
WHEN (INDEX(OUT.I, 'NONVSAM')) > 0 THEN
SAY 'DATASET - ' WORD(OUT.I, WORDS(OUT.I))
WHEN (INDEX(OUT.I, 'VOLSER-')) > 0 THEN DO
PARSE VAR OUT.I . 'VOLSER------------' VOLUME .
SAY VOLUME
END
OTHERWISE NOP
END
END
 
Another question, will LISTCAT return all VOLSERs or just the first VOLSER?
 
Try adding a comma after the "THEN".

My experience with tape datasets is sparse but I believe you will get all VOLSERs.

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
Tried a comma and semicolon and no help....
 
Putting a comma after the first THEN should do it. Don't put one in between the THEN DO though.

If that fails you may want to post your code once the comma after the first then is in place.
 
I took did a cut and paste of your code and it works for me. Maybe you need a REXX identifier or are trying to run this as a CList? You are using the right dataset qualifier (please don't consider this insulting - just covering all bases).

You should show what error you received.
 
Thanks for all your help. I added '/* REXX EXEC */' to the beginning of my code and the program ran but it keeps falling down to the WHEN OTHERWISE. I will debug this in the morning. Thanks again!
 
I am displaying OUT.I and am getting the following...

ENTRY MY.DSN. NOT FOUND+
** VSAM CATALOG RETURN CODE IS 8
** MY.DSN NOT LISTED
*** LASTCC=4


On the first display line, why does my DSN have a '.' at the end 'MY.DSN.'??
 
Almost certainly you asked for
Code:
"LISTC LEVEL('MY.DSN.') ALL"
The presence of the quotes causes exapnsion of the DSN to be suppressed -- but it's likely your userid needs to be prepended. Try
Code:
"LISTC LEVEL(MY.DSN) ALL"
(no quotes).

Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster
 
I tried it with no quotes and am getting the same results. Here is the latest code I am executing...

/* REXX EXEC */
CALL OUTTRAP 'OUT.'
"LISTCAT LEV(XXXX.XXXXDS47.IOFLIST) ALL"
CALL OUTTRAP 'OFF'
DO I = 1 TO OUT.0
SAY OUT.I
SELECT
WHEN (INDEX(OUT.I, 'NONVSAM')) > 0 THEN,
SAY 'DATASET - ' WORD(OUT.I, WORDS(OUT.I))
WHEN (INDEX(OUT.I, 'VOLSER-')) > 0 THEN, DO
SAY HELLO
PARSE VAR OUT.I . 'VOLSER------------' VOLUME .
SAY VOLUME
END
OTHERWISE NOP
END
END


Here is my displays -

ENTRY XXXX.XXXXDS47.IOFLIST. NOT FOUND+
** VSAM CATALOG RETURN CODE IS 8
** XXXX.XXXXDS47.IOFLIST NOT LISTED
LASTCC=4
***
 
Well it looks like the problem is the dataset level you are listing doesn't exist. If you don't use quotes the ListC lists datasets prefixed with your userid, e.g. MYID.XXXX.XXXXDS47.IOFLIST as Frank mentioned.

However, you need to bear in mind that ListC lists dataset levels - if you are trying to list a specific dataset you should be using ListD for a disk dataset, or do a query to your tape management system for a tape dataset.

Either that or use ListC to list Lev('XXXX.XXXXDS47') and start displaying volumes from the dataset you want until the start of the next dataset. Like this (slightly modified);

Call Outtrap 'OUT.'
"ListC Lev('XXXX.XXXXDS47') All"
Call Outtrap 'OFF'
Collect = 0
do i = 1 to OUT.0
select
when index(OUT.i, 'NONVSAM') > 0 then do
Dsn = word(OUT.i, words(OUT.i))
if Collect then leave i
if Dsn = 'XXXX.XXXXDS47.IOFLIST' then do
Collect = 1
say 'Listing datasets for 'Dsn
end
else Collect = 0
end
when index(OUT.i, 'VOLSER-') > 0 & Collect then do
parse var OUT.i 'VOLSER------------' volume .
say volume
end
otherwise nop
end
end
return 1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top