IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need help in REXX CALL program


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Raje1002

New User


Joined: 21 Feb 2009
Posts: 11
Location: India

PostPosted: Wed Apr 19, 2017 11:18 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Thu Apr 20, 2017 1:31 am
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Apr 20, 2017 3:37 am
Reply with quote

8 years here and you have not learned how to use the code tags? icon_sad.gif

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
View user's profile Send private message
Raje1002

New User


Joined: 21 Feb 2009
Posts: 11
Location: India

PostPosted: Thu Apr 20, 2017 10:25 am
Reply with quote

Thanks Sergeyken...
Back to top
View user's profile Send private message
Raje1002

New User


Joined: 21 Feb 2009
Posts: 11
Location: India

PostPosted: Thu Apr 20, 2017 10:25 am
Reply with quote

Thanks Nic...
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Thu Apr 20, 2017 12:34 pm
Reply with quote

quoting is wrong
DSINFO = LISTDSI("'FNAME'")
should be DSINFO = LISTDSI("'"FNAME"'")
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top