SCOUG Logo


Next Meeting: Sat, TBD
Meeting Directions


Be a Member
Join SCOUG

Navigation:


Help with Searching

20 Most Recent Documents
Search Archives
Index by date, title, author, category.


Features:

Mr. Know-It-All
Ink
Download!










SCOUG:

Home

Email Lists

SIGs (Internet, General Interest, Programming, Network, more..)

Online Chats

Business

Past Presentations

Credits

Submissions

Contact SCOUG

Copyright SCOUG



warp expowest
Pictures from Sept. 1999

The views expressed in articles on this site are those of their authors.

warptech
SCOUG was there!


Copyright 1998-2024, Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.

The Southern California OS/2 User Group
USA

SCOUG-Programming Mailing List Archives

Return to [ 08 | April | 2005 ]

<< Previous Message << >> Next Message >>


Date: Fri, 8 Apr 2005 22:52:39 PDT7
From: Peter Skye <pskye@peterskye.com >
Reply-To: scoug-programming@scoug.com
To: scoug-programming@scoug.com
Subject: SCOUG-Programming: Rexx file rename ?

Content Type: text/plain

Hi Gary, thanks for looking in those two Rexx libraries.

> You didn't state why you desire a function in place of a command call, but if you really
> need such a function, it would be easy enough to write your own as a procedure call.

To me they're both the same -- function, procedure, even subroutine.
Subroutine is an old word I don't see any more; function and procedure
are exactly the same as far as I know (including at the assembler level)
with one exception: a function returns a value that the caller is to
use in an assignment or expression.

In other words, X = func(y) will set X, but X = proc(z) won't because
proc() doesn't return a value that the expression can use. Both
functions and procedures can do lots of other things such as calculate
*other* values too, but only the function returns a value in a way that
the caller can directly calculate with it. In Rexx a function does this
by returning a value, for example "return 255", rather than a procedure
which does only a "return".

Often a function that does something with a file system (such as Rename
A File) will return a result code to let you know if it was successful
or not. For example,

DataFile = "GaryCookieRecipes.txt"
NewNameFile = "CookieRecipiesStolenByTheDuck.txt"
rc = Rename( DataFile, NewNameFile )
if rc \= 0 then do
say "Oops, some kind of error: rc =" rc
if rc = 3 then say " (no such file)"
if rc = 8 then say " (file readonly attribute is set)"
if rc = 17 then say " (file is locked)"
if rc = 27 then say " (disk is locked)"
EXIT
end

Of course, you can write Rexx and ignore the returned value. Both of
the following are correct:

rc = Rename( DataFile, NewNameFile )
call Rename DataFile, NewNameFile

In the latter statement, if you want the return code you have to ask
Rexx to give you "the last return code that was created". I can't
remember the variable name that holds the value. I also don't know of
any other language that does this for you.

Anyway, you asked why I wanted a function rather than a procedure. It's
so I can look at the return code and see if the Rename was successful or
not. :-)

- Peter

=====================================================

To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-programming".

For problems, contact the list owner at
"postmaster@scoug.com".

=====================================================


<< Previous Message << >> Next Message >>

Return to [ 08 | April | 2005 ]



The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA

Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.