MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Writting a File Using Rexx

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
mainframe1
Beginner


Joined: 29 Jan 2010
Posts: 7
Topics: 2

PostPosted: Fri Dec 10, 2010 3:31 am    Post subject: Writting a File Using Rexx Reply with quote

hi,

i need to get all the dataset fro the qualifier abc. have wriiten rexx code for that. now i ned to write all these datasets + creation date+volume occupied to a file.pls help me in the code
thanks in advance
Code:

DSLEVEL = 'abc.*'
"ALLOC F(INPUT) SHR DS(Q5O100.DATA.LIST)"
ADDRESS 'ISPEXEC'
"LMDINIT LISTID(LISTID) LEVEL("DSLEVEL")"
IF RC > 0 THEN RETURN 0
"LMDLIST LISTID("LISTID") DATASET(DSNAME) STATS(YES)
OPTION(LIST)"
DO WHILE RC = 0
SAY DSNAME ZDLCDATE ZDLVOL ZDLSPACU
PARSE VAR DSNAME ZDLCDATE ZDLVOL ZDLSPACU TEST.
"EXECIO * DISKW INPUT (FINIS TEST."

"LMDLIST LISTID("LISTID") DATASET(DSNAME) STATS(YES) OPTION(LIST
END
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Dec 10, 2010 4:43 am    Post subject: Reply with quote

add a trace ?R (or whatever your favorite parm is)
immediately after the /* REXX */ statement.

also,
what are you trying to accomplish with:
PARSE VAR DSNAME ZDLCDATE ZDLVOL ZDLSPACU TEST.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
mainframe1
Beginner


Joined: 29 Jan 2010
Posts: 7
Topics: 2

PostPosted: Fri Dec 10, 2010 4:46 am    Post subject: Reply with quote

hi dbzTHEdinosauer,

thanks for the response,
i have the dsname, and creation date displyed. i was trying to move it to test variable ( came to know it was wrong). i need to pass this variables to an output file, at presnt displayed on the screen..
pls help
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Dec 10, 2010 5:48 am    Post subject: Reply with quote

here, this will accomplish what you want:

Code:

/* REXX */
DSLEVEL = 'hlq.llq.llq1.*'
I = 0
ADDRESS 'ISPEXEC'
"LMDINIT LISTID(LISTID) LEVEL("DSLEVEL")"
IF RC > 0 THEN EXIT
"LMDLIST LISTID("LISTID") DATASET(DSNAME) STATS(YES)  OPTION(LIST)"
DO WHILE RC = 0
  I = I + 1
  SAY DSNAME ZDLCDATE ZDLVOL ZDLSPACU
  TEST.I =  DSNAME ZDLCDATE ZDLVOL ZDLSPACU
  "LMDLIST LISTID("LISTID") DATASET(DSNAME) STATS(YES) OPTION(LIST)"
END
/*  TRACE ?R     */
DUH_USER = USERID()
DSN=DUH_USER'.DATA.LIST'
ADDRESS TSO
'ALLOC F(OUT) DA('DSN') NEW TRACKS SPA(60 45) ' ,
' LRECL(80) RECFM(F B) BLKSIZE(9040) DSORG(PS)'
IF RC > 0 THEN
  DO
    SAY 'ALLOCATION FAILED RC=:' RC
    ADDRESS TSO 'FREE F(OUT)'
    EXIT
  END
ADDRESS TSO 'EXECIO * DISKW OUT  (STEM TEST. FINIS)'
ADDRESS TSO  'FREE F(OUT)'
EXIT


couple of suggestions:
1. do not allocate anything until you are going to use it.

2. you will have to modify this assignment instruction
TEST.I = DSNAME ZDLCDATE ZDLVOL ZDLSPACU
if you want any kind of formating (columns lined up).
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
mainframe1
Beginner


Joined: 29 Jan 2010
Posts: 7
Topics: 2

PostPosted: Fri Dec 10, 2010 6:57 am    Post subject: Reply with quote

Hi dbzTHEdinosauer,

thank you very much
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Dec 10, 2010 7:22 am    Post subject: Reply with quote

To avoid duplicate dataset allocation problems:
Code:

DSN=DUH_USER'.DATASET.LIST34'
IF SYSDSN(DSN) =  'OK' THEN
  DO
   ADDRESS TSO
   'DELETE 'DSN''
  END
ADDRESS TSO
'ALLOC F(OUT) DA('DSN') NEW TRACKS SPA(60 45) ' ,
' LRECL(80) RECFM(F B) BLKSIZE(9040) DSORG(PS)'
IF RC > 0 THEN
  DO
    SAY 'ALLOCATION FAILED RC=:' RC
    ADDRESS TSO 'FREE F(OUT)'
    EXIT
  END

_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Dec 10, 2010 2:22 pm    Post subject: Reply with quote

Also, keep the count of items in the TEST. stem in test.0 then use that as the count of items to write, not *
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
mainframe1
Beginner


Joined: 29 Jan 2010
Posts: 7
Topics: 2

PostPosted: Mon Dec 13, 2010 11:09 pm    Post subject: Reply with quote

thanks you all.
Back to top
View user's profile Send private message
mainframe1
Beginner


Joined: 29 Jan 2010
Posts: 7
Topics: 2

PostPosted: Tue Dec 14, 2010 12:56 am    Post subject: writing to file rexx Reply with quote

one question,

when allocating datasets, iam able to alocate datasets, like
userid.userid.data.list3, howeevr i want it to be allocated like
userid.data.list3
in display is shows allocating, userid.data.list3

when deleting.it shows deleted, userid.userid.data.list3Pls help
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Tue Dec 14, 2010 1:36 pm    Post subject: Reply with quote

Quote:
when allocating datasets, iam able to alocate datasets, like
userid.userid.data.list3, howeevr i want it to be allocated like
userid.data.list3

If you are using the code provided by dbzTHEdinosauer then change
Code:
DSN=DUH_USER'.DATASET.LIST3'

to
Code:
DSN="'"DUH_USER'.DATASET.LIST3'"'"


Quote:
in display is shows allocating, userid.data.list3

Not sure which display you are talking about

Quote:
when deleting.it shows deleted, userid.userid.data.list3

Above code change should take care of this.
_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group