View previous topic :: View next topic
|
Author |
Message |
Raje1002
New User
Joined: 21 Feb 2009 Posts: 11 Location: India
|
|
|
|
Hi,
I have an requirement where am having list of datasets mentioned in a file, reading them one by one and passing to CALL program within the REXX to pull the file creation date and last used date.
Below is the code snippet, when am running this, the file name value is not being passed to CALL module. can you please help me
DSN='XXXX.DATASET.REPORT'
"ALLOC DD(INDD) DS('"DSN"') SHR REUSE"
"EXECIO * DISKR INDD(STEM L. FINIS"
"FREE DD(INDD)"
DO I=1 TO L.0
FNAME = SPACE(L.I,0)
SAY FNAME
CALL DATAINFO
END
EXIT 0
DATAINFO:
DSINFO=LISTDSI("'FNAME'")
IF DSINFO == 0 THEN
DO
SAY 'DATA SET CREATED...........:'SYSCREATE
SAY 'DATA SET LAST REFERENCED...:'SYSREFDATE
SAY 'DATA SET EXPIRATION DATE...:'SYSEXDATE
SAY DSINFO
END
ELSE
DO
SAY DSINFO
SAY 'DATA SET NOT FOUND!!'
END
RETURN
Input file:
AAA.BBB.CCC
BBB.CCC.DDD
CCC.DDD.EEE
Result comes as
AAA.BBB.CCC
16
DATA SET NOT FOUND!!
BBB.CCC.DDD
16
DATA SET NOT FOUND!!
CCC.DDD.EEE
16
DATA SET NOT FOUND!!
***
[/u] |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2010 Location: USA
|
|
|
|
Make "code", and indentation for you
Code: |
DSN='XXXX.DATASET.REPORT'
"ALLOC DD(INDD) DS('"DSN"') SHR REUSE"
"EXECIO * DISKR INDD(STEM L. FINIS"
"FREE DD(INDD)"
DO I = 1 TO L.0
FNAME = SPACE(L.I,0)
SAY FNAME
CALL DATAINFO
END I
EXIT 0
DATAINFO:
DSINFO = LISTDSI("'FNAME'")
IF DSINFO == 0 THEN DO
SAY 'DATA SET CREATED...........:'SYSCREATE
SAY 'DATA SET LAST REFERENCED...:'SYSREFDATE
SAY 'DATA SET EXPIRATION DATE...:'SYSEXDATE
SAY DSINFO
END
ELSE DO
SAY DSINFO
SAY 'DATA SET NOT FOUND!!'
END
RETURN
|
Input file:
Code: |
AAA.BBB.CCC
BBB.CCC.DDD
CCC.DDD.EEE
|
Result comes as
Code: |
AAA.BBB.CCC
16
DATA SET NOT FOUND!!
BBB.CCC.DDD
16
DATA SET NOT FOUND!!
CCC.DDD.EEE
16
DATA SET NOT FOUND!!
***
|
Now RTFM:
Quote: |
16 LISTDSI processing was not successful. An error occurred. None of the variables containing information about the data set can be considered valid, except for SYSREASON. The SYSREASON variable contains the LISTDSI reason code (see Reason Codes). |
Quote: |
Reason Codes
Reason codes from the LISTDSI function appear in variable SYSREASON. Table 3
shows the LISTDSI reason codes. With each reason code the REXX variable
SYSMSGLVL2 is set to message IKJ584nnI, where nn is the reason code. These
messages are described in z/OS TSO/E Messages.
Table 3. LISTDSI reason codes
Reason code Description
0 Normal completion.
1 Error parsing the function.
2 Dynamic allocation processing error.
3 The data set is a type that cannot be
processed.
4 Error determining UNIT name.
5 Data set not cataloged.
6 Error obtaining the data set name.
7 Error finding device type.
8 The data set does not reside on a direct
access storage device.
9 DFHSM migrated the data set. NORECALL
prevents retrieval.
11 Directory information was requested, but you
lack authority to access the data set.
12 VSAM data sets are not supported.
13 The data set could not be opened.
14 Device type not found in unit control block
(UCB) tables.
17 System or user abend occurred.
18 Partial data set information was obtained.
19 Data set resides on multiple volumes.
Consider using the MULTIVOL keyword to obtain
data set size information totaled across all
volumes.
20 Device type not found in eligible device
table (EDT).
21 Catalog error trying to locate the data set.
. . . . . . . etc . . . . . . . . |
Your parameter to LISTDSI is exactly 'FNAME' - I don't think the DSN=FNAME does exist in your system, doesn't it?
It must be:
Code: |
. . . .
QuotedDSN = "'"FNAME"'"
DSINFO = LISTDSI(QuotedDSN)
. . . . . . |
|
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
8 years here and you have not learned how to use the code tags?
You also seem to have not learned how to use Trace to debug your Rexx programs. I suggest you do that right now. |
|
Back to top |
|
|
Raje1002
New User
Joined: 21 Feb 2009 Posts: 11 Location: India
|
|
|
|
Thanks Sergeyken... |
|
Back to top |
|
|
Raje1002
New User
Joined: 21 Feb 2009 Posts: 11 Location: India
|
|
|
|
Thanks Nic... |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
quoting is wrong
DSINFO = LISTDSI("'FNAME'")
should be DSINFO = LISTDSI("'"FNAME"'") |
|
Back to top |
|
|
|