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

List and write all the PDS name to the file in Batch


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

New User


Joined: 20 Nov 2007
Posts: 37
Location: USA

PostPosted: Wed Jul 10, 2013 8:36 pm
Reply with quote

Hi I am able to list the PDS and write it to a file when executing a REXX through TSO command. It worked fine.
But when i tried to write a batch job i am receving RC = 20 in the below line
Code:
"ISPEXEC LMDINIT LISTID("IDV") LEVEL("DS")"



This is my REXX program
Code:

/*REXX*/                                                           
/************ GET THE LIST OF CMN PDS   ********/                 
ARG DATASET                                                       
DS     = DATASET                                                   
SAY 'DATASET:' DS                                                 
                 
ADDRESS TSO                                                       
"ISPEXEC LMDINIT LISTID("IDV") LEVEL("DS")"                       
SAY RC                                                             
IX = 0                                                             
DO FOREVER                                                         
  "ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"     
  IF RC <> 0 THEN DO                                               
     "ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"                 
     LEAVE                                                         
  END
.....                                                             


My JCL
Code:

//STEP10   EXEC PGM=IKJEFT01,REGION=0M,                           
//             PARM='GETALPDS HLQ.**'                         
//SYSPROC  DD  DISP=SHR,DSN=REXXPDS.REXX                   
//SYSTSPRT DD SYSOUT=*                                           
//SYSPRINT DD SYSOUT=*                                           
//ISPMLIB  DD DSN=HLQ.ISPMLIB,DISP=SHR             
//ISPPLIB  DD DSN=HLQ.ISPPLIB,DISP=SHR             
//ISPSLIB  DD DSN=HLQ.ISPSLIB,DISP=SHR             
//ISPLLIB  DD DSN=HLQ.LOAD,DISP=SHR                     
//SYSTSIN DD DUMMY                                               
//FILEOUT  DD  DSN=HLQ.LIST,    * OUTPUT FILE
//             DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(15,5),RLSE),   
//             UNIT=SYSDA,DCB=(RECFM=FB,LRECL=080,BLKSIZE=0)     
//ISPPROF   DD DSN=&&PROFILE,                                     
//             DISP=(,DELETE,DELETE),                             
//             UNIT=SYSDA,                                       
//             SPACE=(TRK,(1,1,1),RLSE),                         
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)                 


PLease let me know if i am missing anything ...
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Jul 10, 2013 8:45 pm
Reply with quote

Yes - you missed a [/code] and obviously the Preview button is missing from your editor.
Also, when invoking IKJEFT01 it is normal to provide SYSTSIN to let it know what it should be doing.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Jul 10, 2013 8:51 pm
Reply with quote

You appear to be passing the namme of the Rexx script to background TSO via the PARM parameter. This is entirely acceptable when using TSO only; when using ISPF, however, you should use a SYSTSIN DD, as Mr. Clouston has said, and invoke ISPF via ISPSTART CMD(scriptname).
Back to top
View user's profile Send private message
Santty

New User


Joined: 20 Nov 2007
Posts: 37
Location: USA

PostPosted: Wed Jul 10, 2013 10:46 pm
Reply with quote

But still i am receving ISPV010 message not found in 'ISPMLIB' library.
Code:

CMG999   Message ISPV010 - ISPV010  message not found in 'ISPMLIB' library. 


My JCL
Code:

//STEP10   EXEC PGM=IKJEFT01,REGION=0M                           
//SYSPROC  DD  DISP=SHR,DSN=HLQ.REXX                     
//SYSTSPRT DD SYSOUT=*                                             
//SYSPRINT DD SYSOUT=*                                             
//ISPMLIB  DD DSN=HLQ.ISPMLIB,DISP=SHR               
//ISPPLIB  DD DSN=HLQ.ISPPLIB,DISP=SHR               
//ISPSLIB  DD DSN=HLQ.ISPSLIB,DISP=SHR               
//ISPTLIB  DD DDNAME=ISPTABL                                       
//         DD DSN=HLQ.ISPTLIB,DISP=SHR               
//ISPTABL  DD DSN=HLQ.ISPTLIB,DISP=SHR                     
//ISPLLIB  DD DSN=HLQ.LOAD,DISP=SHR                     
//SYSTSIN DD *                                                     
ISPSTART CMD('MYPDS(MEMBER)' HLQ.**)             
//*                                                               
//FILEOUT  DD  DSN=HLQ.LIST,        * OUTPUT FILE
//             DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(15,5),RLSE),   
//             UNIT=SYSDA,DCB=(RECFM=FB,LRECL=080,BLKSIZE=0)   
//ISPPROF   DD DSN=&&PROFILE,                                 
//             DISP=(,DELETE,DELETE),                         
//             UNIT=SYSDA,                                     
//             SPACE=(TRK,(1,1,1),RLSE),                       
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)               
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Jul 10, 2013 11:04 pm
Reply with quote

Why do you not concatenate mypds to SYSPROC instead of trying to put it in the CMD parameter?
Back to top
View user's profile Send private message
Santty

New User


Joined: 20 Nov 2007
Posts: 37
Location: USA

PostPosted: Wed Jul 10, 2013 11:10 pm
Reply with quote

Yes... I tried that too but no luck ...

I am getting the same error message
CMG999 Message ISPV010 - ISPV010 message not found in 'ISPMLIB' library.

I am not sure what is missing here....
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jul 10, 2013 11:16 pm
Reply with quote

You don't have your site's system ISPF messages library concatenated to ISPMLIB. ISPV010 is a standard system message usually stored in the site ISPF message library.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Jul 10, 2013 11:23 pm
Reply with quote

I see that you have posted only a part of your script. It is short enough that you can post the whole thing?
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Jul 11, 2013 12:11 am
Reply with quote

Quote:
I am not sure what is missing here....

Besides the messages library, you also should provide the other ISPF data sets.

For example, message ISPV010 is:
Code:
ISPV010 Profile not loaded -  Profile table 'aaaaaaaa' not read.
       Table service RC=bbbbbbbb.                               

and shows that you are missing the ISPTLIB concatenation.
Back to top
View user's profile Send private message
Santty

New User


Joined: 20 Nov 2007
Posts: 37
Location: USA

PostPosted: Thu Jul 11, 2013 12:41 am
Reply with quote

Please find the full script

JCL
Code:

//Jobname  JOB (1234567),' ',         
//         CLASS=?,MSGCLASS=?,NOTIFY=&SYSUID           
//*                                                     
//******************************************************
//*   GET ALL THE PDS NAMES                             
//******************************************************
//*                                                     
//STEP10   EXEC PGM=IKJEFT01,REGION=0M                 
//*            PARM='ISPSTART CMD(MEMBER) HLQ.**' 
//SYSPROC  DD  DISP=SHR,DSN=HLQ.REXX         
//SYSTSPRT DD SYSOUT=*                                 
//SYSPRINT DD SYSOUT=*                                 
//ISPMLIB  DD DSN=HLQ.ISPMLIB,DISP=SHR             
//ISPPLIB  DD DSN=HLQ.ISPPLIB,DISP=SHR             
//ISPSLIB  DD DSN=HLQ.ISPSLIB,DISP=SHR             
//ISPTLIB  DD DDNAME=ISPTABL                                     
//         DD DSN=HLQ.ISPTLIB,DISP=SHR             
//ISPTABL  DD DSN=HLQ.ISPTLIB,DISP=SHR                   
//ISPLLIB  DD DSN=HLQ.LOAD,DISP=SHR                     
//SYSTSIN DD *                                                   
ISPSTART CMD(MEMBER HLQ.**)                                 
//*                                                               
//FILEOUT  DD  DSN=HLQ.LIST,    * OUTPUT FILE
//             DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(15,5),RLSE),   
//             UNIT=SYSDA,DCB=(RECFM=FB,LRECL=080,BLKSIZE=0)     
//ISPPROF   DD DSN=&&PROFILE,                                   
//             DISP=(,DELETE,DELETE),                           
//             UNIT=SYSDA,                           
//             SPACE=(TRK,(1,1,1),RLSE),             
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)     
//                                                   



MEMBER is the REXX program

REXX program

Code:

/*REXX*/                                                       
/************ GET THE LIST OF CMN PDS   ********/             
ARG DATASET                                                   
DS     = DATASET                                               
SAY 'DATASET:' DS                                             
ADDRESS TSO                                                   
"ISPEXEC LMDINIT LISTID("IDV") LEVEL("DS")"                   
SAY RC                                                         
IX = 0                                                         
DO FOREVER                                                     
  "ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)" 
  IF RC <> 0 THEN DO                                           
     "ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"             
     LEAVE                                                     
  END                                                       
  IX = IX + 1                                               
  WORK.IX  = DSVAR                                         
  SAY "DSVAR:" DSVAR                                       
  IF (SUBSTR(WORK.IX,23,1) =  ' ') & ,                     
     (SUBSTR(WORK.IX,19,1) <> ' ') THEN                     
     QUEUE SUBSTR(DSVAR,10,4) SUBSTR(DSVAR,15,3) WORK.IX   
     SAY WORK.IX                                           
END                                                         
  ADDRESS TSO                                               
  "EXECIO" QUEUED() "DISKW FILEOUT ( FINIS"                 
  "FREE F(FILEOUT)"                                         
  SAY 'RC:'RC                                               
  ADDRESS TSO "DELSTACK"                                   
EXIT                                                       
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Jul 11, 2013 1:11 am
Reply with quote

If your shop has a standard ISPF proc, I suggest that you use it, so as to avoid the problems noted by Mr. Sample and Sr. Vera. If you do so, I think that you will find no further problems with your script.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Jul 11, 2013 3:45 am
Reply with quote

I noticed you use a stem variable, as if you are going to use the STEM form of the EXECIO command. But instead, you use the form that gets its data from the stack.

I do not think you need to use a stem variable:
Code:
  IX = IX + 1                                               
  WORK.IX  = DSVAR                 

And other places. Instead, use DSVAR where you use WORK.IX

Your code will work regardless, except if you have an extremely large number of members. In that case, you will have a copy of the data in the stem, as well as a copy QUEUE'd up, plus a copy that ISPF maintains via LMDLIST. You may encounter storage exhausted problems.
Back to top
View user's profile Send private message
Santty

New User


Joined: 20 Nov 2007
Posts: 37
Location: USA

PostPosted: Fri Jul 12, 2013 12:50 am
Reply with quote

Thank you Akatsukami, Sample , Vera and Clouston .. icon_smile.gif

I added ISPLOG and made some changes to the ISPTLIB.

The program is working fine now.

But is can see a message at the end of SYSTSPRT as below

Code:
MYRACFID.MYRACFID.JOBID.D0000103.? was preallocated (no free was done).


Can you please help me in this ??
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Jul 12, 2013 1:14 am
Reply with quote

IIRC, this is because you did add the ISPLOG DD to the JCL; ISPF warns you that it wished to allocate the data set dynamically. Remove the DD, and the message should go away.
Back to top
View user's profile Send private message
Santty

New User


Joined: 20 Nov 2007
Posts: 37
Location: USA

PostPosted: Fri Jul 12, 2013 1:19 am
Reply with quote

Yes .. You are right.

But if i remove ISPLOG i am receving the below message

Code:

ISPF system data set allocation error - press Enter to continue.         
Log file allocation error - ISPF will operate without a log data set.   
Data set 'MYRACFID.SPFLOG1.LIST' in use by another user, try later.       
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Jul 12, 2013 2:39 am
Reply with quote

That other user is you - most likely. you probably do not need the log so you could dummy it.
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 How to split large record length file... DFSORT/ICETOOL 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top