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 

REXX code to PL1 code

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
key
Beginner


Joined: 29 Dec 2005
Posts: 19
Topics: 6

PostPosted: Wed May 31, 2006 12:38 pm    Post subject: REXX code to PL1 code Reply with quote

Hi,

My Program needs to return the member names of a pds in sequential order.

Following code will do this in REXX
Code:

/* rexx */
say 'Enter Dataset Name : '
pull dsname
dsname = strip(dsname)
x = outtrap('var.')
ADDRESS TSO "listds '"dsname"' members "
do i = 7 to var.0
say strip(var.i)
end

Is it same thing possible in PL1 coding ? If Yes, Could you please let me know, How to match the Rexx - OUTTRAP function with PL1 function ?

Please let me know.
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed May 31, 2006 1:15 pm    Post subject: Reply with quote

There are other ways to accomplish this. If you are running under ISPF, use the LMMLIST service. If not, you can read the directory directly (Rexx example & see doc for directory structure), or you can call IEHLIST and read the listing, or there may be function packages at your site already that do this. I haven't coded PL/I in over 20 years, but there may even be built in functions for this from LE pr PL/I.

Generally, output trapping of commands that you did not write should probably be avoided since the structure can change, though LISTDS probably will never change.
Back to top
View user's profile Send private message Visit poster's website
key
Beginner


Joined: 29 Dec 2005
Posts: 19
Topics: 6

PostPosted: Thu Jun 01, 2006 4:06 am    Post subject: Reply with quote

Hi Semigeezer,

Thanks for your reply.

Quote:

There are other ways to accomplish this. If you are running under ISPF, use the LMMLIST service.


Could you please explain more about above mentioned statement.
Back to top
View user's profile Send private message
key
Beginner


Joined: 29 Dec 2005
Posts: 19
Topics: 6

PostPosted: Tue Jun 06, 2006 2:55 am    Post subject: Reply with quote

Hi Members...

Could you please send any more input on this topic.
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Tue Jun 06, 2006 10:49 am    Post subject: Reply with quote

LMMLIST is documented along with all of the ISPF services in the ISPF Services Guide. There aren't many examples in PL/I, but if you search the web you will find examples like this one that show how to call ISPF services from PL/I. You can find many many examples of using LMMLIST etc in Rexx and changing that to PL/I is easy as long as you understand ISPF variables (VDEFINE, VDELETE at least).
Back to top
View user's profile Send private message Visit poster's website
key
Beginner


Joined: 29 Dec 2005
Posts: 19
Topics: 6

PostPosted: Tue Jun 13, 2006 11:44 am    Post subject: Reply with quote

Thanks much for each and everyones valuable reply.

I have written the suitable code for this requirement as follows... and tested the same.

Code:

TSTPDS: PROC OPTIONS(MAIN) REORDER;                                 
  DECLARE  (PLIRETV,PLIRETC) BUILTIN;                               
  DECLARE  (STG,SUBSTR,PTRADD) BUILTIN;                             
  DECLARE  ISPLINK  ENTRY EXTERNAL OPTIONS(ASM,INTER,RETCODE);     
  DECLARE  VAR1 CHAR(8) INIT('');                                   
  DECLARE  DDNAME CHAR(8) INIT('DD1');                             
  DECLARE  MEMBER CHAR(8);                                         
  DECLARE  RETCODE BIN FIXED(31);                                   

  CALL ISPLINK ('VDEFINE ', '(VAR1)',                               
                  VAR1, 'CHAR    ' ,STG(VAR1));                     
  CALL ISPLINK ('LMINIT  ','VAR1  ',' ',' ',' ',' ',' ',' ',       
                 ' ',DDNAME,' ','SHR    ');                         

  IF PLIRETV() ^= 0 THEN DO;                                       
    PUT SKIP LIST('TSTPDS: LMINIT FAILED FOR VAR1 RC=',PLIRETV()); 
    PUT SKIP LIST('TSTPDS: TERMINATING');                           
    CALL PLIRETC(8);                                               
  RETURN;                                                           
END;                                                                 
CALL ISPLINK ('LMOPEN  ',VAR1);                                     
IF PLIRETV() ^= 0 THEN DO;                                           
  PUT SKIP LIST('TSTPDS: LMOPEN FAILED FOR VAR1 RC=',PLIRETV());     
  PUT SKIP LIST('TSTPDS: TERMINATING');                             
  CALL PLIRETC(8);                                                   
  RETURN;                                                           
END;                                                                 

CALL  ISPLINK ('VDEFINE ', '(MEMBER)',                               
                MEMBER, 'CHAR    ' ,STG(MEMBER));                   
MEMBER='';      /* FOR FIRST TIME */                                 

CALL ISPLINK ('LMMLIST ',VAR1,'LIST    ','MEMBER  ','YES     ');     
IF PLIRETV()^= 0                                                     
THEN DO;                                                             
      PUT SKIP LIST('TSTPDS: LMLIST FAILED FOR VAR1 RC=',PLIRETV());
      CALL ISPLINK ('LMMLIST ',VAR1,'FREE    ');
     END;                                       
ELSE DO;                                       
      PUT SKIP LIST('MEMBER NAME:',MEMBER);     
     END;                                       
  CALL ISPLINK ('LMCLOSE ',VAR1);
  CALL ISPLINK ('LMFREE  ',VAR1);
END TSTPDS;                     


Hope this will help...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming 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