Posted: Wed May 31, 2006 12:38 pm Post subject: REXX code to PL1 code
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 ?
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
Posted: Wed May 31, 2006 1:15 pm Post subject:
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.
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
Posted: Tue Jun 06, 2006 10:49 am Post subject:
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).
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;
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