Scott,

As you put your code up I hope you don't mind if I chip in with a few comments as you said you were new to OO. Firstly, it's not obvious from the name of the class what it actually does. I'm not as dogmatic as Elardus WRT comments. In fact I'm quite the opposite. I believe that if you need lots of comments to understand code then that is an indication that the code is poor and needs to be refactored. You class appears to be a helper
class for system backups so I would call it SystemBackupHelper.

One of the compelling reasons for using an OO language is to avoid conditional logic with language features such as polymorphism. In the case of your REXX class I would refactor your select statement into methods for each function type. You can then chain the method calls to perform all three functions in one statement. Of course, if you always call copy->compress->dump you can create a method
that calls all three, for example backup which is a kind of macro method.

I'm not much of an oorexx expert and AFAIK it doesn't have exception handling?

FWIW, for this kind of stuff on Linux I usually just write a bash script.

/* This is a utility class for system backups */
::classSystemBackupHelper

/* make a copy of the file system */
::methodcopy

/* compress the backup copy */
::methodcompress

/* dump the compressed backup to external media */
::methoddump

/* backup the file system to external media */
::methodbackup

/* create an instance of SystemBackupHelper */
backup=SystemBackupHelper~new

/* create a backup using method chaining */
backup~~copy~~compress~~dump

/* create a backup using a macro method */
backup~backup


On 29/03/2016 11:43 PM, Scott Ford wrote:
Guys:

Heres what I do on OpenSuse 13.1 x64:

/*---------------------------------------------------------------*/
/* #!/usr/bin/rexx                                               */
/*   rexx                                                        */
/*   Name:       sysbkup                                       */
/*   Coampany:     IDF                                           */
/*   Created:      11/01/14 ( guess )                            */
/*   Parameters or Arguments:                                    */
/*                 ctlfle = ctlname and location                 */
/*---------------------------------------------------------------*/
trace i
arg subsys funcin
call dfdisp '/media/disk'
if result = 0 then do;
   say 'Sysbkup could not find usb external /media/disk '||date(u)' 'time()
   exit(99);
end;
say 'Sysbkup Found /media/disk/ at: 'date(u)' 'time()
myBackup = .filefunc~new
myBackup~funcs = "Backup"
exit
::class filefunc
::method funcs ftype
   expose backup_sys ifunc
   select
    when backup_sys = "TSS" & ifunc = "COPY" then do;
         tssin = '/z/zOS1.13/TSS'
         tssout = '/z/zOS1.13/TSS/GZIPBACK'
         call bkuptss tssin tssout trace
    end;
    when backup_sys = 'TSS' & ifunc = 'GZIP' then do;
         tssin = 'z/OS1.13/TSS/GZIPBACK/'
         call gziptss tssin trace
    end;
    when backup_sys = 'TSS' & ifunc = 'COPYEXT' then do;
         tssin = 'z/zOS1.13/TSS/GZIPBACK/'
         foldda = '';
         foldmo = '';
         foldyr = '';
         foldmo = substr(date(u),1,2);
         foldda = substr(date(u),4,2);
         foldyr = substr(date(u),7,2);
         bkupfold = 'B'||foldmo||foldda||foldyr
         tssout = '/media/disk/zpdt-backups/tss/'||bkupfold
         call copyext tssin tssout trace
   end;

All the calls are external rexx programs/scripts in the same folder.

HTH,

Regards,
Scott

On Tue, Mar 29, 2016 at 11:31 AM, Scott Ford <idfzos...@gmail.com> wrote:

Guys,

I try to write so i can pass multiple args. I have been doing some OOrexx
and like it. Just the OO part of it is a tad of a learning curve for this
T-rex ....

Scott

On Mon, Mar 28, 2016 at 11:31 PM, Paul Gilmartin <
0000000433f07816-dmarc-requ...@listserv.ua.edu> wrote:

On Tue, 29 Mar 2016 12:38:05 +1100, Wayne Bickerdike wrote:

I would use CALL. Implies that you want to return to the caller. Works in
all environments.

And the search order is different in each.

Most of my REXX code can then be ported to REXX/CICS without major
rewrites.

Another plus of CALL is that the called routine can be internal or
external
to the mainline code.

Internal gives you some funky variable scoping.

And CALL lets you return arbitrary strings, not merely integers.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to