Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Need sample program
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  16 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
globaloney  
View profile  
 More options Jul 19 2008, 12:35 am
Newsgroups: comp.lang.rexx
From: globaloney <jgol...@excite.com>
Date: Fri, 18 Jul 2008 21:35:56 -0700 (PDT)
Local: Sat, Jul 19 2008 12:35 am
Subject: Need sample program
Hello.
I have had 20 +years working with Rexx on a mainframe but I am new to
working on a pc.
I have oorexx installed on my pc running Windows Vista OS. I need a
sample program to get me started.

Could someone provide a sample list of commands to open a file on my
pc, read each line
and write each line to an output file?

Also how do you debug a rexx.exe?, When I run on that is in error the
MS window closes
before I see what the error was. Thanks in advance.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nitro  
View profile  
 More options Jul 19 2008, 10:40 am
Newsgroups: comp.lang.rexx
From: "Nitro" <nitro-57@no_spam_please_usa.net>
Date: Sat, 19 Jul 2008 10:40:03 -0400 (EDT)
Local: Sat, Jul 19 2008 10:40 am
Subject: Re: Need sample program

Here is an old file I had around (cut and pasted below).  Modifies lines in a
file based on a simple pos search on each line.  
ASCII/text file.  
No waranty on how it will work for you.
This was written for OS/2 but should run unchanged in windows.

For debug you can add the trace command.  Most of my rexx has been simple
scripts so Say and Trace have been enough.
From the rexx docs:
TRACE ?R
/* Interactive debugging is switched on if it was off, */
/* and tracing results of expressions begins.          */

You can switch off interactive debugging in several ways:
    *      Entering TRACE O turns off all tracing.
    *      Entering TRACE with no options restores the defaults--it turns off
interactive debugging but continues tracing with TRACE Normal (which traces
any failing command after execution).
    *      Entering TRACE ? turns off interactive debugging and continues
tracing with the current option.
    *      Entering a TRACE instruction with a ? prefix before the option
turns off interactive debugging and continues tracing with the new option.

Now that IBM has opensourced Rexx you can get info here
http://www.oorexx.org/
http://www.oorexx.org/docs.html

Take care,
  Bart

cut and paste to a filename of your choice ".cmd" ie "myscript.cmd"
run as follows:

c>rexx myscript.cmd mydatafile.dat

-------------  Cut  ------------
/* REXX EXEC */
'@Echo off'
parse arg filename

fname = filename'.new'     /* create new file name for output,  If it exists
we will append to it. */

say 'input file = "'filename'"'
say 'output file = "'fname'"'

modifiedLines = 0
totalLines = 0

input=linein(filename)

Do while lines(filename) > 0
  totalLines = totalLines + 1

  pos1 = lastpos('Fixme', input)

  if pos1 \= 0 then
    Do
    output = left(input, pos1-1)'Fixed'
    modifiedLines = modifiedLines + 1
    End
  else
    Do
    output = input
    End
  call LINEOUT fname, output

  input=linein(filename)           /* get next line */
  End  /* file read loop */

say 'Total lines read = 'totalLines
say 'Total lines changed = 'modifiedLines
------------ End Cut -------------------


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve Swift  
View profile  
 More options Jul 19 2008, 11:43 am
Newsgroups: comp.lang.rexx
From: Steve Swift <Steve.J.Sw...@gmail.com>
Date: Sat, 19 Jul 2008 16:43:54 +0100
Local: Sat, Jul 19 2008 11:43 am
Subject: Re: Need sample program

Nitro wrote:
> For debug you can add the trace command.  Most of my rexx has been simple
> scripts so Say and Trace have been enough.

I recently came across the fact that you could turn rexx tracing on by
setting the RXTRACE environment variable to ON.  This can be handy if
you use external subroutines, or ::include libraries. If you find
yourself about to call such an external routine (while tracing your own
code) then you can enter:
Call Value 'RXTRACE','ON','ENVIRONMENT'
... and see what the external routine does.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Graham Hobbs  
View profile  
 More options Jul 19 2008, 9:26 pm
Newsgroups: comp.lang.rexx
From: Graham Hobbs <gho...@cdpwise.net>
Date: Sat, 19 Jul 2008 21:26:14 -0400
Local: Sat, Jul 19 2008 9:26 pm
Subject: Re: Need sample program
This is what I use to copy a file. The 'say' is cosmetic.
It assumes f1_rm1 exists as an input file and you'll create fi_out.

someproc:

   fi_rm1 = 'c:\ghexe\utem1rm1.txt'
   fi_out = 'w:\bkpdir\utem1rm1.001'

   do while lines(fi_rm1) > 0
      ws_inb = linein(fi_rm1)
      say 'ws_inb='ws_inb
      call lineout fi_out, ws_inb
   end

   call lineout (fi_rm1)   /* close */
   call lineout (fi_out)   /* close */
   return

As for debugging - ask smarter guys than me. That said . .
I do use 'trace' with a parm occasionally but usually when I've done a
nono if prints up on the CMD window and describes the error very
clearly. (Am ooRexx on XP though - shouldn't make a difference).

Many Rexx's have bitten me because i forgot to close the file. Read
the manual about linein and how its coded (I say this because in the
code above there is no explicit 'open' - ain't like cobol:-))
Hope this helps,
Graham

On Fri, 18 Jul 2008 21:35:56 -0700 (PDT), globaloney

<jgol...@excite.com> wrote:
>Hello.
>I have had 20 +years working with Rexx on a mainframe but I am new to
>working on a pc.
>I have oorexx installed on my pc running Windows Vista OS. I need a
>sample program to get me started.

>Could someone provide a sample list of commands to open a file on my
>pc, read each line
>and write each line to an output file?

>Also how do you debug a rexx.exe?, When I run on that is in error the
>MS window closes
>before I see what the error was. Thanks in advance.

** Posted from http://www.teranews.com **

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Lueck  
View profile  
 More options Jul 19 2008, 11:00 pm
Newsgroups: comp.lang.rexx
From: Michael Lueck <mlu...@lueckdatasystems.com>
Date: Sat, 19 Jul 2008 23:00:59 -0400
Local: Sat, Jul 19 2008 11:00 pm
Subject: Re: Need sample program

Graham Hobbs wrote:
> Many Rexx's have bitten me because i forgot to close the file. Read
> the manual about linein and how its coded (I say this because in the
> code above there is no explicit 'open' - ain't like cobol:-))

True true...

But for max I/O performance, methods were added which are FAR superior to LineIn / LineOut.

For example:

    file=.stream~new('data.dat')
    file~open('READ')
    if result\='READY:' then do
       return 0
    end

    /* Check for how many lines the file has */
    FILEsize=file~command('QUERY SIZE')

    /* Read in the file */
    /* This code requires at least ORexx 2.1.1 on Win32 - only tested with >=2.1.2 */
    INstr=file~charin(1, FILEsize)
    FINDarray=INstr~makearray()

    file~close()

Open/Close the file with the scream object. If it is not possible to have the complete data set in memory, the use LineIn/LineOut instead of charin/makearray.

--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Lueck  
View profile  
 More options Jul 19 2008, 11:02 pm
Newsgroups: comp.lang.rexx
From: Michael Lueck <mlu...@lueckdatasystems.com>
Date: Sat, 19 Jul 2008 23:02:01 -0400
Local: Sat, Jul 19 2008 11:02 pm
Subject: Re: Need sample program

Steve Swift wrote:
> I recently came across the fact that you could turn rexx tracing on by
> setting the RXTRACE environment variable to ON.

Thanks Steve! I had not known of that trick.

Indeed it does work with ooRexx on Linux.

--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremy Nicoll - news posts  
View profile  
 More options Jul 20 2008, 8:52 am
Newsgroups: comp.lang.rexx
From: Jeremy Nicoll - news posts <jn.nntp.scrap...@wingsandbeaks.org.uk>
Date: Sun, 20 Jul 2008 13:52:42 +0100
Local: Sun, Jul 20 2008 8:52 am
Subject: Re: Need sample program

globaloney <jgol...@excite.com> wrote:
> Also how do you debug a rexx.exe?, When I run on that is in error the
> MS window closes
> before I see what the error was. Thanks in advance.

The simplest way is to have your code end with something like:

 say "***" ; parse pull waste

so the exec waits for a final bit of input before ending.

You could put that in your error handler if normal execution is meant to
produce no output, so only when something goes wrong does the window hand
around.

--
Jeremy C B Nicoll - my opinions are my own.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gil Barmwater  
View profile  
 More options Jul 20 2008, 9:31 am
Newsgroups: comp.lang.rexx
From: Gil Barmwater <gi...@bellsouth.net>
Date: Sun, 20 Jul 2008 09:31:22 -0400
Local: Sun, Jul 20 2008 9:31 am
Subject: Re: Need sample program

Lots of good suggestions already so I will only add the following.
OoRexx provides two additional ways to run a script besides REXX.EXE -
REXXHIDE.EXE and REXXPAWS.EXE.  You would use the first in cases where
all of the user interaction is via dialogs so there would be no need for
a "command window".  It also would be useful for something meant to run
in the "background".  The second was added by Mark Hessling to mimic the
default Regina behavior of leaving the command window open after the
script terminates.  The default "association" for the .rex extension is
to invoke REXX.EXE but you COULD change it to run REXXPAWS for example
if you wanted the command window to always remain open.  In my opinion,
however, the best way to debug a new script is to invoke it from an
already open command window and make liberal use of TRACE to step
through the parts of the program that aren't working as expected.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
regli  
View profile  
 More options Jul 20 2008, 11:27 am
Newsgroups: comp.lang.rexx
From: regli <raee...@gmail.com>
Date: Sun, 20 Jul 2008 08:27:14 -0700 (PDT)
Local: Sun, Jul 20 2008 11:27 am
Subject: Re: Need sample program
On Jul 20, 6:31 am, Gil Barmwater <gi...@bellsouth.net> wrote:
 In my opinion,

> however, the best way to debug a new script is to invoke it from an
> already open command window and make liberal use of TRACE to step
> through the parts of the program that aren't working as expected.- Hide quoted text -

IMO, for the serious REXX developer, by far the best way to debug an
Object Rexx program is via the IBM Object Rexx Workbench Developer
Edition (2.1+ upgradable).

With a little effort, detailed in my post to rony (29 May 2008
09:11:48) in the following link, it can be adapted to use the latest
ooRexx version.  It allows for just about full visual interactive
debugging with watch variables, etc.  It's a serious development
environment in absence of ooRexx support for Eclipse.

http://groups.google.com/group/comp.lang.rexx/browse_thread/thread/6b...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Phil  
View profile  
 More options Jul 21 2008, 1:24 am
Newsgroups: comp.lang.rexx
From: "Phil" <obrie...@optusnet.com.au>
Date: Mon, 21 Jul 2008 15:24:00 +1000
Subject: Re: Need sample program

"globaloney" <jgol...@excite.com> wrote in message

news:13dc4c1c-d5a1-4c0d-b1c1-6c47a92a2163@r66g2000hsg.googlegroups.com...

> Hello.
> I have had 20 +years working with Rexx on a mainframe but I am new to
> working on a pc.
> I have oorexx installed on my pc running Windows Vista OS. I need a
> sample program to get me started.

> Could someone provide a sample list of commands to open a file on my
> pc, read each line
> and write each line to an output file?

> Also how do you debug a rexx.exe?, When I run on that is in error the
> MS window closes
> before I see what the error was. Thanks in advance.

use arg infile

infile = .stream~new(infile)
outfile = .stream~new('outfile.txt')

do infile~lines
  outfile~lineout(infile~linein)
end

infile~close
outfile~close

Phil
----


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Lueck  
View profile  
 More options Jul 19 2008, 1:25 pm
Newsgroups: comp.lang.rexx
From: Michael Lueck <mlu...@lueckdatasystems.com>
Date: Sat, 19 Jul 2008 13:25:50 -0400
Local: Sat, Jul 19 2008 1:25 pm
Subject: Re: Need sample program

Steve Swift wrote:
> I recently came across the fact that you could turn rexx tracing on by
> setting the RXTRACE environment variable to ON.

Thanks Steve! I had not known of that trick.

Indeed it does work with ooRexx on Linux.

--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
globaloney  
View profile  
 More options Jul 21 2008, 11:09 pm
Newsgroups: comp.lang.rexx
From: globaloney <jgol...@excite.com>
Date: Mon, 21 Jul 2008 20:09:17 -0700 (PDT)
Local: Mon, Jul 21 2008 11:09 pm
Subject: Re: Need sample program
On Jul 21, 12:24 am, "Phil" <obrie...@optusnet.com.au> wrote:

Thanks All. I am up and running

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Graham Hobbs  
View profile  
 More options Jul 22 2008, 10:26 pm
Newsgroups: comp.lang.rexx
From: Graham Hobbs <gho...@cdpwise.net>
Date: Tue, 22 Jul 2008 22:26:14 -0400
Local: Tues, Jul 22 2008 10:26 pm
Subject: Re: Need sample program
On Mon, 21 Jul 2008 20:09:17 -0700 (PDT), globaloney

Did you try mine and Phil's. Which one's better - if Phil's then I'll
use in future (seems cleaner).
Graham
** Posted from http://www.teranews.com **

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
globaloney  
View profile  
 More options Jul 26 2008, 1:55 am
Newsgroups: comp.lang.rexx
From: globaloney <jgol...@excite.com>
Date: Fri, 25 Jul 2008 22:55:20 -0700 (PDT)
Local: Sat, Jul 26 2008 1:55 am
Subject: Re: Need sample program
On Jul 22, 9:26 pm, Graham Hobbs <gho...@cdpwise.net> wrote:

Sorry for taking so long to get back to you

I was originally using Nitro's(Bart's) code since I am not familiar
with the oorexx language yet.
His is similar to yours. It was working pretty well. I am using
software called SPFLITE which simulates SPF edit functions like a
mainframe.
In my last line of code. I access my file thru SPFLite,review the
output and exit.

Now I am trying a little more complicated process where I read in 3
infiles and write to 1 output file . I have run into a snag opening
the output file at the end of the program. I get a file opened error
in SPFLITE, however if I exit and then access the file,it is exactly
as it should be. I tried adapting Phil's code but same deal, I don't
think I am closing my file properly.
Here are my last few lines of code to the output file. Am I closing
the file properly?
/*******************************************/
    outfile = .stream~new(FILEOT1)
      do j=1 to tw
       innie=l.j
       outfile~lineout(innie)
       END
       trace i
      outfile~close
 /**************Edit file thru
SPFLITE**************************************************/
 address cmd "C:\Program Files\SPFLite\SPFLite.exe" FILEOT1

/*****************************************************************/

although the code worked I couldn't get my file opened at the end of
the code.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gary Scott  
View profile  
 More options Jul 26 2008, 10:02 am
Newsgroups: comp.lang.rexx
From: Gary Scott <garylsc...@sbcglobal.net>
Date: Sat, 26 Jul 2008 09:02:26 -0500
Local: Sat, Jul 26 2008 10:02 am
Subject: Re: Need sample program

Oh my gosh, I can't believe someone is still using SPF let alone a clone
of it ... :)

--

Gary Scott
mailto:garylscott@sbcglobal dot net

Fortran Library:  http://www.fortranlib.com

Support the Original G95 Project:  http://www.g95.org
-OR-
Support the GNU GFortran Project:  http://gcc.gnu.org/fortran/index.html

If you want to do the impossible, don't hire an expert because he knows
it can't be done.

-- Henry Ford


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
globaloney  
View profile  
 More options Jul 26 2008, 11:48 am
Newsgroups: comp.lang.rexx
From: globaloney <jgol...@excite.com>
Date: Sat, 26 Jul 2008 08:48:08 -0700 (PDT)
Local: Sat, Jul 26 2008 11:48 am
Subject: Re: Need sample program
Oops, The problem appears to be with the Program File not the code,
apparently it can't handle a blank in a directory name.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google