MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Use Rexx to copy a member from CA librarian to a PDS/file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Mon Oct 15, 2018 6:32 am    Post subject: Use Rexx to copy a member from CA librarian to a PDS/file Reply with quote

I'm including this solution simply because it's taken me a while to get where I wanted to be. Basically, because where I'm working using CA Librarian, I wanted a method of copying/extracting source code from Librarian to a simple sequential file/PDS member. Somewhere or other, I found references to using SORT and subsys(LAM) to do so (see https://www.mvsforums.com/helpboards/viewtopic.php?t=12922), but now I found a "better" example which I'll include here).

In the code below: -
memb is the member name I want to extract from librarian,
temp_ds is the fully qualified (pre-allocated) output dataset to receive the extracted source code (without quotes)
pds_name is the LIBRARIAN dataset name that might/might not contain the source code

Code:

address TSO                                                 
x = outtrap('alloc.')                                       
/* Specify the member to copy/extract */                     
sin.1 = '-SEL 'memb',EXEC(R)'                               
/* Now allocate SYSIN as a temporary file .... */           
"alloc f(sysin) unit(vio) new sp(1 1) block(1)",             
   "recfm(f b) lrecl(80) reuse"                             
"execio 1 diskw sysin (stem sin. finis"                     
/* but DON'T free it */                                     
                                                             
/* Allocate the output file */                               
"alloc f(OSJOB) da('"temp_ds"')  shr reuse"                 
/* ... and the LIBRARIAN "PDS" */                           
"alloc f(MASTER) da('"pds_name"') shr reuse"                 
                                                             
"alloc file(sysprint) dummy shr reuse"                                 
                                                             
/* Call LIBRARIAN to extract the file */                     
address ispexec "select pgm(AFOLIBR) parm('NRJS,NJTA')"     
save_rc = rc                                                 
"free f(SYSIN SYSPRINT MASTER OSJOB)"                       
x = outtrap('OFF')                                           


Hope this helps someone else.

(Edited -added SHR REUSE to SYSPRINT allocation, otherwise CA messages splattered on screen first time in)
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Oct 18, 2018 9:28 am    Post subject: Reply with quote

misi01,

Thanks for sharing the code.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group