Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need help in REXX CALL program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Need help in REXX CALL program
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

Active User


Joined: 29 Apr 2008
Posts: 187
Location: Maryland

PostPosted: Thu Apr 20, 2017 1:31 am    Post subject:
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: 1894
Location: UK

PostPosted: Thu Apr 20, 2017 3:37 am    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

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

Active User


Joined: 01 Sep 2015
Posts: 170
Location: Switzerland

PostPosted: Thu Apr 20, 2017 12:34 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 5 Wed Oct 04, 2017 6:54 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 47 Fri Sep 29, 2017 1:08 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us