Home SELCOPY CBLVCAT SELCOPY/i Trial/Prices CBL SiteMap
 
Multiple Information Retrieval, Manipulation & Update for IBM Mainframe, iSeries, UNIX & PC Platforms

SELCOPY Examples Menu

MVS, VSE and CMS datasets may be processed without a DD, DLBL or FILEDEF statement by providing the full dataset name on the SELCOPY I/O command, either as a literal or as a field in the workarea giving a variable data set name.

Dynamic allocation has a variety of uses in all environments. A simple application for MVS is shown below, which uses SELCOPY to copy selected members of a PDS to another new PDS. For this example, we will select members with '96' anywhere in the member name.

   read  PDSINP  dsn='CBL.PDS.SSPDSC'   dirdata   into 101  worklen 33333
                                 * Read directory record and data
                                 * records for each PDS member.

   if dir                        * If it's a PDS directory record
     then do  SELECTION          * then selectively open a new output memb.
     else write PDSOUT   fr 101  * Copy record to the output member.

   goto get



 ==SELECTION==        ** Process the PDS directory records **
   if pos 101,107 = '96'  * Select if '96' appears anywhere in the name.
     then pos   1,44  =  'CBL.PDS.SSPDSC.Y96'   stopaft 1 * Output DSN.
     then pos  45     =  '(12345678)'           stopaft 1 * Append the
     then pos  46     =    8 at 101                       * memb name.
     then open   PDSOUT      dsn = 44+10 at 1   * CLOSE is automatic.

     else flag eomemb   * Suppress the OPEN for this input member.

   return

Programming Notes

  1. SELCOPY tolerates blanks padding the variable DSN up to 44 bytes and blanks padding the member name up to 8 bytes.


  2. The SELCOPY feature, DIRDATA, is used to read all DIRectory and DATA records from the PDS, opening each member in turn, provided FLAG EOMEMB has not been set.

    DIRDATA input for MVS returns the directory record for each member, followed by its data records. (For VSE and CMS, the directory records are reformatted by SELCOPY.) PDS member selection may then be based on any combination of information held in the directory record. e.g. member name, userid, timestamps, record count/file size, authorisation code.

  3. Although not illustrated above, at the same time, using a few additional statements, the output member name could have been changed to rationalize it so that the '96' falls in a fixed position.
Top © 2005 Compute (Bridgend) Limited
http://www.cbl.com/selcex16.html
yyyy/mm/dd HH:MM:SS