DSLIST in REXX program in Batch mode.



TSO Programming, ISPF, SDF, SDSF and PDF, FTP, TCP/IP Concepts, SNA & SNA/IP etc...

DSLIST in REXX program in Batch mode.

Postby magesh123 » Sun May 29, 2011 10:49 am

My requirement is to list the datasets like the below When i specify the partial dataset qualifier

ex: INPUT --> USERID.CHAM*.PS*

OUTPUT DATASET USERID.DATASET.REPORT should contains
TSCH050.CHAMP.PS1
TSCH050.CHAMP.PS2
TSCH050.CHAMP.PS3
TSCH050.CHAMPION2.PS
TSCH050.CHAMPION1.PS1

i have used to below code(not in batch mode) for listing multiple datasets and i am getting the expected result.

PDS ='USERID.DATASET.REPORT'                   
DATA = SYSDSN("'"PDS"'")                       
IF DATA = 'OK' THEN                             
DO                                             
X = MSG('OFF')                                 
"DELETE ('"PDS"')"                             
X = MSG('ON')                                   
END                                             
/* ALLOCATE DATASET */                         
"ALLOC DD(DDIN) DA('"PDS"')",                   
" NEW LRECL(80) RECFM(F B) DSORG(PS) REUSE",   
"SPACE(2,1) TRA"                               
DS=STRIP("USERID.CHAM*.PS*")                                 
"ISPEXEC LMDINIT LISTID(IDV) LEVEL(&DS)"                     
DO FOREVER                                                   
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"   
IF RC = 0 THEN                                               
DO                                                           
SAY DSVAR                                                     
QUEUE " "DSVAR                                               
N = QUEUED()                                                 
"ALLOC F(OUT) DS('"PDS"') MOD REUSE"                         
"EXECIO" N "DISKW OUT(FINIS "                                 
"FREE F(OUT)"                                                 
END                                                           
ELSE LEAVE                                                   
END                                                           
"ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"


My output dataset contains:

USERID.DATASET.REPORT
~~~~~~~~~~~~~~~~~~~~~~
TSCH050.CHAMP.PS1
TSCH050.CHAMP.PS2
TSCH050.CHAMP.PS3
TSCH050.CHAMPION2.PS
TSCH050.CHAMPION1.PS1

But when i submit the rexx program using Batch mode(IKJEFT01) i am getting "Dataset USERID.DATASET.REPORT" in use
message. I didnt change any code from the above.

Since i am new to rexx pragram please tell me how to rectify the problem and give idea to list multiple datasets
using JCL(DSLIST...)/REXX program if possible.

Thank you,
Magesh.
magesh123
 
Posts: 13
Joined: Fri Apr 15, 2011 11:29 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DSLIST in REXX program in Batch mode.

 

Re: DSLIST in REXX program in Batch mode.

Postby NicC » Sun May 29, 2011 12:48 pm

Suggest you issue a FREE for the dataset before allocating it and making sure that it is not allocated to your TSO session. Also, if you do not need to run the program in foreground, take all the dataset allocation/frww stuff out of the program and use JCL DD statements for your dataset(s). If you need to run in foreground as well then have 2 versions - one with ALLOC/FREE and one without.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: DSLIST in REXX program in Batch mode.

Postby MrSpock » Sun May 29, 2011 6:22 pm

I agree with Nic. You should place your dataset allocations outside in the JCL stream when possible.

As far as your exec, it seems to me that you made it way more complex than it needs to be. It could be much smaller:

                               
DS = STRIP("USERID.CHAM*.PS*")                                 
"ISPEXEC LMDINIT LISTID(IDV) LEVEL("DS")"     
DO FOREVER                                                   
  "ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"   
  IF RC <> 0 THEN LEAVE                                                   
  SAY DSVAR                                                     
  QUEUE " "DSVAR
END
"ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"                   
"EXECIO "QUEUED()" DISKW OUT (FINIS"                                                     
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: DSLIST in REXX program in Batch mode.

Postby magesh123 » Mon May 30, 2011 10:52 am

Hi MrSpock,

I have tried with the above code with the Main JCL specfied below. but still
my dataset USERID.DATASET.REPORT is empty. Can you please tell me whether the exact
problem is.

//STEP3    EXEC PGM=IKJEFT01,                                           
// PARM='LOGREAD1'                                                     
//SYSEXEC  DD DSN=userid.REXX.MAIN,DISP=SHR                     
//SYSPRINT DD SYSOUT=*                                                 
//SYSTSPRT DD SYSOUT=*                                                 
//SYSTSIN  DD DUMMY                                                   
//OUT    DD   DSN=userid.DATASET.REPORT,                           
//             DISP=(,CATLG,DELETE),                               
//             UNIT=3390,SPACE=(TRK,(1,1),RLSE),                       
//             RECFM=FB,LRECL=80

Thank you,
Magesh.
magesh123
 
Posts: 13
Joined: Fri Apr 15, 2011 11:29 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DSLIST in REXX program in Batch mode.

Postby MrSpock » Mon May 30, 2011 5:35 pm

DSLIST is an ISPF Service, yet nowhere in your job are you showing that you've initiated ISPF and provided for all of the required supporting DD statements. Where is your ISPSTART command? Where are the allocations for all of the necessary libraries?

See this previous topic for the same issue.
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times


Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post