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

How to move rexx output to a dataset?


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

New User


Joined: 24 Feb 2011
Posts: 4
Location: Bangalore

PostPosted: Thu Feb 24, 2011 12:35 pm
Reply with quote

The below code prints all the datasets with the given hiqualifier. Can you help me in getting this to a dataset?

"ISPEXEC LMDINIT LISTID(IDV) LEVEL(JSUDSA.DSADFAU.DT*)"
DO FOREVER
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
IF RC = 0 THEN SAY "'"DSVAR"'"
ELSE LEAVE
END
"ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"
Back to top
View user's profile Send private message
yugendran

New User


Joined: 14 Dec 2007
Posts: 51
Location: indore

PostPosted: Thu Feb 24, 2011 12:39 pm
Reply with quote

Use just EXECIO for writing it into dataset.. just populate the values of DSNVAR into a stem variable and write that stem variable into the dataset..
Back to top
View user's profile Send private message
yash_g

New User


Joined: 24 Feb 2011
Posts: 4
Location: Bangalore

PostPosted: Thu Feb 24, 2011 12:44 pm
Reply with quote

I tried using EXECIO as below
/* REXX */
"ISPEXEC LMDINIT LISTID(IDV) LEVEL(HIQUAL.FILE.DT*)"
DO FOREVER
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
IF RC = 0 THEN
DO
OUTVR = '"DSVAR"'
SAY "'"DSVAR"'"
"EXECIO 0 DISKW MYOUTD (STEM OUTVR. FINIS"
"FREE F(OUT)"
END
ELSE LEAVE
END

But when i run this through a job using MYOUTD as DD for my output dataset, nothing happens. The jo runs with a RC=0 but nothing goes into output file.
"ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"
EXIT
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Feb 24, 2011 1:24 pm
Reply with quote

had you posted your code with code tags,
you could have seen your error.
Code:

/* REXX */
"ISPEXEC LMDINIT LISTID(IDV) LEVEL(HIQUAL.FILE.DT*)"
DO FOREVER
  "ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
  IF RC = 0 THEN
     DO
       OUTVR = '"DSVAR"'
       SAY "'"DSVAR"'"
       "EXECIO 0 DISKW MYOUTD (STEM OUTVR. FINIS"
       "FREE F(OUT)"
     END
  ELSE LEAVE
END

try this:
Code:

/* REXX */
"ISPEXEC LMDINIT LISTID(IDV) LEVEL(HIQUAL.FILE.DT*)"
OUTVR. = ""
OUTVR.0 = 0
DO FOREVER
  "ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
  IF RC = 0 THEN
     DO
       OUTVR.0 = OUTVR.0 + 1
       i = OUTVR.0
       OUTVR.i = '"DSVAR"'
       SAY "'"DSVAR"'"
     END
  ELSE LEAVE
END
"EXECIO DISKW MYOUTD (STEM OUTVR. FINIS"
"FREE F(OUT)"

[/code]
Back to top
View user's profile Send private message
yash_g

New User


Joined: 24 Feb 2011
Posts: 4
Location: Bangalore

PostPosted: Thu Feb 24, 2011 1:40 pm
Reply with quote

Added * to "EXECIO DISKW MYOUTD (STEM OUTVR. FINIS"

But its till not working.
The RC is 0 and i get the following message in job
ACF0C038 ACF2 LOGONID ATTRIBUTES HAVE REPLACED DEFAULT USER ATTRIBUTES
FILE OUT NOT FREED, IS NOT ALLOCATED
READY
END

My Job is
//Step01 EXEC PGM=IKJEFT01,PARM='REXCODE',DYNAMNBR=20
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSEXEC DD DSN=REX.LIB,DISP=SHR
//MYOUTD DD DSN=FILES.YASH,DISP=SHR
//SYSTSIN DD DUMMY

i am a REXX beginner. Apologies if a am missing somthing very basic. icon_redface.gif
Back to top
View user's profile Send private message
yugendran

New User


Joined: 14 Dec 2007
Posts: 51
Location: indore

PostPosted: Thu Feb 24, 2011 3:19 pm
Reply with quote

Is it showing any displays in batch mode? cuz i believe if u hav to run the ISPEXEC commands, u have to do something more..

but u can easily do this in foreground.. use the below one for allocate and write..

OutDSN = 'FILES.YASH'
"Alloc dd(OutDSN) da('"OutDSN"') OLD REU"
"ExecIO * Diskw OutDsn (stem OutVr. finis"
"Free dd(OutDsn)"
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Feb 24, 2011 3:27 pm
Reply with quote

Since your file is allocated in your jcl and not by an ALLOC statement you
will get that message.
And the ACF message is an informational message.
So what to worry about, Dick gave you a working solution and know what,
its for free.
Back to top
View user's profile Send private message
yash_g

New User


Joined: 24 Feb 2011
Posts: 4
Location: Bangalore

PostPosted: Thu Feb 24, 2011 5:14 pm
Reply with quote

Thanks for your inputs...
yugendran..your methord worked!! Thanks again!

Cheers,
Yash
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Fri Feb 25, 2011 11:00 pm
Reply with quote

Know your services!

Instead of OPTION(LIST):
Code:
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"


Use OPTION(SAVE):
Code:
"ISPEXEC LMDLIST LISTID("IDV") OPTION(SAVE) DATASET(DSVAR)"


And I believe this option saves the whole list, so you not have to have a loop in your program.
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 202
Location: Toronto, ON, Canada

PostPosted: Thu Mar 17, 2011 8:15 pm
Reply with quote

You can also use the LISTCAT tso command and do an OUTTRAP in rexx like so:
Code:

CALL OUTTRAP 'dsnvar.'   
"LISTC LVL(HILVLQL.Q2)"
CALL OUTTRAP 'OFF'
 


Then a rexx DO loop to process the stem. The dataset name appears on every other line
Code:

DO i = 1 to dsnvar.0
  PARSE VAR dsnvar.i '---' dsname .
END


Create another stem to hold the dataset name and then use EXECIO to write it out.
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 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
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
Search our Forums:

Back to Top