/* REXX */
/* this works, by echoing the text from the shell and redirecting
stdout to stderr
*/
"echo this is stderr la la la 1>&2"
/* this is what lots of webpages say should work, but doesn't - you
just get:
1) written to stdout (correct)
2) written to file called stdout
3) written to file called stderr
4) written to file called stderr
5) written to file called STDERR
6) written to file called 2
*/
call lineout ,"this is a line to stdout (1)"
call lineout stdout,"this is a line to stdout (2)"
call lineout stderr,"this is a line to stderr (3)"
call lineout "stderr","this is a line to stderr (4)"
call lineout "STDERR","this is a line to stderr (5)"
call lineout 2,"this is a line to stderr (6)"
What Rexx implementation are you using? Methods 2-5 appear to do what
you expect with Object Rexx. You can also try "STDERR:".
I'm afraid I'm completely new to this, but I think it's rexx on USS on
z/os.
Methods 1-5 work with Regina. I have two suggestions for
you:
1. To help the people who you're asking for help, always include
the output of the following commands (using whatever variable
names you like, of course):
parse source a
say "parse source output:" a
say "address():" address()
parse version b
say "parse version output:" b
FYI, mine shows:
parse source output: WIN32 COMMAND F:\VER.REX
address(): SYSTEM
parse version output: REXX-Regina_3.3(MT) 5.00 25 Apr 2004
2. If you're using REXX under TSO, you might get better answers
if you subscribe to, and post to, the TSO-Rexx list. It's for
mainframers and will have more people with expertise in that
environment. Send a message to
LIST...@VM.MARIST.EDU
with a body of:
SUBSCRIBE TSO-REXX <your name here>
In case you want to lurk before subscribing, it's echoed to
bit.listserv.tsorexx (but not echoed in the other direction, so
don't post your question to the newsgroup).
--
Arthur T. - ar23hur "at" intergate "dot" com
Looking for a good MVS systems programmer position
regina at least uses <stderr>, <stdout>,
brexx <STDERR> usw.
Wolfgang
parse source output: TSO COMMAND ./rexx_version.rxx PATH
./rexx_version.rxx ? SH OMVS OpenMVS
address(): SH
parse version output: REXX370 3.48 01 May 1992
In z/OS USS REXX, you would use the mainframe rexx EXECIO command to write
to a specific (open) filehandle. EXECIO is the standard means of
reading/writing from/to files in any IBM-supplied mainframe REXX
implementation.
The easiest way to write with EXECIO is to put all of your message text
lines in stemvars, then invoke EXECIO. The entire stem will be written, in
numerical order, until it finds the first uninitialized variable:
/* REXX */
errorline.1 = "This is an error message"
errorline.2 = "This is error message line 2"
errorline.4 = "This line won't be written because errorline.3 isn't
initialized"
ADDRESS MVS "EXECIO * DISKW STDERR (STEM errorline. FINIS)"
To write to stdout, change the STDERR to STDOUT.
To read from stdin, change STDERR to STDIN, DISKW to DISKR:
EXECIO * DISKR STDIN (STEM inputline. FINIS)
This will read in all stdin until EOF and store it in the stemvar
'inputline.', assigning the total number of lines read to 'inputline.0'.
In all cases, you must enclose the entire EXECIO command in quotes (double
quotes prefered) and put ADDRESS MVS in front of it:
ADDRESS MVS "EXECIO * DISKW STDERR (STEM errorline. FINIS)"
The max length for EXECIO reads is 1024 chars., but I don't know if it dumps
the remainder or continues on from there at the next invoke, I only just
learned this stuff about 2min. ago.
All you need to know about USS REXX can be found in IBM's online manuals
(was where I just learned this), particularly "Using REXX and z/OS UNIX
System Services":
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/BPXZB661/CCONTENTS?SHELF=BPXZSH60&DN=SA22-7806-09&DT=20050926202723
The main USS manual site is:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/BPXZSH60
Once in the manual, you can click on the flashlight at the top of the page
to search it for 'stderr', etc...
Enjoy!
"TheMoff" <robin....@gmail.com> wrote in message
news:1150995112....@y41g2000cwy.googlegroups.com...
Not if you are running under USS it isn't! And as he posted a while ago,
that's what he is doing. You *can* use it, but
charin/charout/linein/lineout are supported too, and preferable in many
cases. (BTW linein/lineout are also available on z/VM.)
To OP: did you try to use stream open or popen to open the stream first?
Have you read
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/BPXZB661/CCONTENTS?SHELF=BPXZSH61&DN=SA22-7806-09&DT=20050926202723
Graham.
Writing to stderr is what this thread is about & the OP apparently has
mastered normal file writing, if by accident...
The manual for stream (chptr 5.19) mentions nothing about redirecting file
descriptors; the chapter on EXECIO (1.7.3) explicitly states within 10 lines
how to read/write stderr, out & in -- the OP's original intent -- and is the
only entry in the entire manual that does.
Do you have any code samples on how to write to stderr with stream(),
lineout() and/or charout()? I can't figure it out myself.
Here is a script called test_std:
/* rexx */
stdout.1 = "this goes to stdout"
stderr.1 = "this goes to stderr"
address MVS "EXECIO * DISKW STDOUT (STEM stdout. FINIS)"
address MVS "EXECIO * DISKW STDERR (STEM stderr. FINIS)"
Now exec it from command prompt:
test_std 1>/dev/null
test_std 2>/dev/null
Option '1>' only prints stderr.1, and option '2>', stdout.1.
The answer lies in reading the fine manual. It describes 0, 1 and 2 as
file descriptors, not streams. So, that means you can't use them as
streams, instead, you have to use them as file descriptors, thus:
/* REXX Test writing to stderr */
address syscall
text = "Error line"
"write" 2 "text"
exit
Graham.
Solution 1:
/* REXX */
errorline.1 = "This is an error message"
errorline.2 = "This is error message line 2"
errorline.4 = "This line won't be written because errorline.3 isn't
initialized"
ADDRESS MVS "EXECIO * DISKW STDERR (STEM errorline. FINIS)"
Solution 2:
/* REXX Test writing to stderr */
address syscall
text = "Error line"
"write" 2 "text"
exit
BTW, what the does 'address syscall' line do?
Thanks again.
The address instruction in REXX tells REXX where to send commands. In
this case it sends them to the USS-supplied environment named syscall,
which is an interface to system calls. You can find address syscall
documented in some detail at the beginning of the document I provided a
link for, and address itself in the standard REXX reference material.
Graham.