View previous topic :: View next topic |
Author |
Message |
mainframe1 Beginner
Joined: 29 Jan 2010 Posts: 7 Topics: 2
|
Posted: Fri Dec 10, 2010 3:31 am Post subject: Writting a File Using Rexx |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Dec 10, 2010 4:43 am Post subject: |
|
|
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 |
|
|
mainframe1 Beginner
Joined: 29 Jan 2010 Posts: 7 Topics: 2
|
Posted: Fri Dec 10, 2010 4:46 am Post subject: |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Dec 10, 2010 5:48 am Post subject: |
|
|
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 |
|
|
mainframe1 Beginner
Joined: 29 Jan 2010 Posts: 7 Topics: 2
|
Posted: Fri Dec 10, 2010 6:57 am Post subject: |
|
|
Hi dbzTHEdinosauer,
thank you very much |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Dec 10, 2010 7:22 am Post subject: |
|
|
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 |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri Dec 10, 2010 2:22 pm Post subject: |
|
|
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 |
|
|
mainframe1 Beginner
Joined: 29 Jan 2010 Posts: 7 Topics: 2
|
Posted: Mon Dec 13, 2010 11:09 pm Post subject: |
|
|
thanks you all. |
|
Back to top |
|
|
mainframe1 Beginner
Joined: 29 Jan 2010 Posts: 7 Topics: 2
|
Posted: Tue Dec 14, 2010 12:56 am Post subject: writing to file rexx |
|
|
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 |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Tue Dec 14, 2010 1:36 pm Post subject: |
|
|
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 |
|
|
|
|