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

SELCOPY Examples Menu

The following SELCOPY/PC job will generate and dynamically execute File Transfer Program commands to SEND a generic group of files to your mainframe.

Although this example uses an MVS Partitioned Data Set to receive the PC files it could easily be modified for any environment and any FTP command.

Note:
Occurrences of %1, %2 and %3 in the control card syntax refer to the parameters passed to SELCOPY/PC on the invoking command line.

   equ pdsname       1
   equ dirrec      101

   option      w 32760

   do init stopaft=1                 * Initialise once only.

   rd %1     dir     into dirrec     * Read a directory rec into pos 101.

   pos  dirrec-1+38    = ' '              * Blank out the '.'
   pos  @fn            = 9 at dirrec-1+30 * fn followed by a blank.
   if p @fn,@fn+9      = ' '              * Bound to get one.
     then pos @,@fn+10 = ")'"

   pos  dirrec-1+60-5  = 'send '
   if lrecl < 80
     then pos dirrec+lrecl,dirrec+80 = ' '
     then lrecl = 80                          * Keep it neat.
   pos  dirrec+lrecl   = pos 1,@fn+22

   log           fr dirrec-1+60-5,dirrec+lrecl-1+@fn+22-1
   system        fr dirrec-1+60-5,dirrec+lrecl-1+@fn+22-1
 * wr ssftp.cmd  fr dirrec-1+60-5,dirrec+lrecl-1+@fn+22-1 * To run in OS/2.
   gg

 ==init==              ** Initialisation sub-routine **
   pos  pdsname+3    = %2   !lower 1 at pdsname+3   * The emulator session.
   pos  pdsname+3+1  = ":'"                         * x:
   pos  pdsname+3+3  = %3                           * x:receive.pds.name
   if p pdsname+3,pdsname+99 = ' '                  * Scan for blank.
     then @fn   = @+1

   lower from pos pdsname+3,@fn                     * Lower case the dsn.
   pos @fn-1 = "(ABCDEFGH)'  ascii crlf"    * x:receive.pds.name(ABCD.. etc
  =ret=

Invocation
Assuming that the above control cards are stored in the file d:\cbl\SSFTP.ctl, then keying in at the DOS prompt

 selcopy <d:\cbl\SSFTP.ctl    c:\dos\*.BAS   C   CBL.FTPTEST

could generate and execute the following FTP commands:

 send c:\dos\GORILLA.BAS    c:'cbl.ftptest(GORILLA)'   ascii crlf
 send c:\dos\MONEY.BAS      c:'cbl.ftptest(MONEY)'     ascii crlf
 send c:\dos\NIBBLES.BAS    c:'cbl.ftptest(NIBBLES)'   ascii crlf
 send c:\dos\REMLINE.BAS    c:'cbl.ftptest(REMLINE)'   ascii crlf

The command line may seem a little long winded, in which case it would be worthwhile setting up a BAT file: e.g.

 :** h:\cg\SSFTP.BAT kkk             L=101 --- 97/06/19 11:24:32    (P22)

 : Format: ssftp      fileid_with_wildcard    emulator_session   mvs_pds_dsn
 :   e.g.  ssftp           C:\CBL\*.T*               B          CBL.SELC980.DM

 selcopy <d:\cbl\ssftp.ctl     %1                    %2              %3
Top © 2005 Compute (Bridgend) Limited
http://www.cbl.com/selcex17.html
yyyy/mm/dd HH:MM:SS