View previous topic :: View next topic
|
Author |
Message |
yash_g
New User
Joined: 24 Feb 2011 Posts: 4 Location: Bangalore
|
|
|
|
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 |
|
|
yugendran
New User
Joined: 14 Dec 2007 Posts: 51 Location: indore
|
|
|
|
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 |
|
|
yash_g
New User
Joined: 24 Feb 2011 Posts: 4 Location: Bangalore
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
yash_g
New User
Joined: 24 Feb 2011 Posts: 4 Location: Bangalore
|
|
|
|
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. |
|
Back to top |
|
|
yugendran
New User
Joined: 14 Dec 2007 Posts: 51 Location: indore
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
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 |
|
|
yash_g
New User
Joined: 24 Feb 2011 Posts: 4 Location: Bangalore
|
|
|
|
Thanks for your inputs...
yugendran..your methord worked!! Thanks again!
Cheers,
Yash |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
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 |
|
|
jerryte
Active User
Joined: 29 Oct 2010 Posts: 202 Location: Toronto, ON, Canada
|
|
|
|
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 |
|
|
|