View previous topic :: View next topic
|
Author |
Message |
shanbalasay
New User
Joined: 22 May 2007 Posts: 19 Location: Belfast, UK
|
|
|
|
In REXX, each SAY statement prints the string in a new line.
for ex. the below code,
SAY 'Line 1.'
SAY 'Line 2.'
SAY 'Line 3.
will give an output as below
Line 1
Line 2
Line 3
Is there an option to make each SAY statement to print the string as a continuation to the last SAY statement?
For ex. I'd like to make the above the above 3 SAY stmts print as below
Line 1 Line 2 Line 3
I need to have the 3 SAY statements in place anyway.
Thanks to anyone who could advice |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
What is your requirement you are trying to achieve ?
if you are trying to learn .. read the manuals.. Link is available to top of the page... |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
MVS i/o is record oriented, each SAY will <emit> one record
and also on stream oriented systems each say will cause an i/o with the appropriate CR/NL ( depending on the platform)
so une line of output for each say
on any system which supports REXX You will have to build the whole message, concatenating the appropriate tokens and issue one SAY at the end
and here for Your info the link to the zOS 1.10 TSO bookshelf
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IKJ4BK90
or to the IBM index for other zOS versions/releases
www-03.ibm.com/systems/z/os/zos/bkserv/index.html |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Try the effect of sticking all your text together and one SAY.
Try SAY LINE1 LINE2 LINE3
Where these are variables with text in.
If you want to format paragraphs from broken-up text, nothing easier than rexx. You want one-word-per-line from a string of text, easy-peasy.
Very, very, flexible language. However, with an unclear requirement, no language is good enough. |
|
Back to top |
|
|
shanbalasay
New User
Joined: 22 May 2007 Posts: 19 Location: Belfast, UK
|
|
|
|
Thanks to Escapa, enrico-sorichetti and Bill Woodger for your suggestions.
In many languages like, C, PERL, etc. we could have multiple output statements but with an available option, we could concatenate the string printed on the screen. As enrico had suggested in line with my requirement, I'd like to post an example from PERL.
Code A
---------
print "min : $min\n";
print "sec : $sec";
Code B
--------
print "min : $min";
print "sec : $sec";
Code A will output as below with sample values
min : 10
sec : 20
Code B will output as below
min : 10sec : 20
My requirement was of Code B and needed to know how this could be implemented in REXX.
From enrico's suggestion, it looks like REXX wouldnt support this. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
yadayadayada
print command in perl sends to last position on the pc screen,
rexx will automatically newline with each say command.
so if you want multiple output on the same line,
you have to concatenate your data until you are ready to output a complete screen line.
so, rexx supports this.
that you have to remember in perl to include a nl character
seems to be a draw back, since most every other language
will reset to 1, the output stream on execution of each put-to-device instruction.
your abilities do not seem to support multiple languages and how they work. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1315 Location: Vilnius, Lithuania
|
|
|
|
There is supposed to b a WRITENR function available on the CBTTape site. No clue as to which tape you need to get... |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
It looks like file 431 of the CBT tape. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
WRITENR is a clist called from your rexx program. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1315 Location: Vilnius, Lithuania
|
|
|
|
Enrico,
The PDF is still around, the zip is gone.
I believe the functionality is now available in the alternate library, but have no clue how to make that one available, let alone its name on your average z/OS system. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
Quote: |
I believe the functionality is now available in the alternate library, but have no clue how to make that one available, let alone its name on your average z/OS system. |
as usual IBM likes to make things complicated ...
the whole shebang is there in the
Code: |
——————————————————————————————————————————————————————————————————————————————
BROWSE FAN140.SEAGFUP Row 00001 of 00002
Command ===> Scroll ===> CSR
Name Prompt Alias-of Size TTR AC AM RM
_________ EAGEFSIO *Browsed 000076D0 000007 00 31 ANY
_________ EAGIOHKP 00002AC0 000015 00 31 ANY
**End**
|
but from the names it looks like a complimentary add on to the rexx compiler |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
anyway the situation is murkier than it seems
according to the docs it should have behaved as the sample I posted...
unfortunately my first test ( without reading the docs naturally )
gave the same results as a sequence of say!
I' ll keep testing and post the results ! |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
well it works,
the buzzword is "persistent datastream "
the trick is to use the ddname ..
and not let it default to the <standard> output
the code
Code: |
000008 /* REXX */
000009 CALL CHAROUT "&SYSTSPRT", "TOK1 "
000010 CALL CHAROUT "&SYSTSPRT", "TOK2 "
000011 CALL CHAROUT "&SYSTSPRT", "TOK3 "
000012 CALL CHAROUT "&SYSTSPRT", "TOK4 "
000013 CALL CHAROUT "&SYSTSPRT"
000014 EXIT
|
the result
Code: |
TOK1 TOK2 TOK3 TOK4
1READY
END
|
quick and dirty, couple more tests needed for proper working ! |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Ok, if we are stepping outside of SAY itself...
Why not make a function, call is saypara. Call the function for each piece of data, then call with a blank, or period-only (or whatever) line to get the paragraph onto the screen. You could look to make functions for line, para, and screen/page, taking chunks of whater size and building it from there, hierachical sort of thing.
If the code is too tricky (it isn't) "somewhere" I have it in AWK, easily transferrable, not so easy to find... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
Quote: |
if we are stepping outside of SAY itself |
I beg to differ
the ts was asking for a builtin way of stacking data on an output <line>
the <correct> answer was ... cannot do it with basic rexx,
an add on function package for rexx gives that flexibility...
so no stepping outside, just providing an ALMOST BUILTIN REXX alternative |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK :-) As usual I like the lateralness involved in your solution to a "can't be done here" sort of thing.
I'm stepping outside, anyway. I found many uses for the code in text manipulation/reformatting. Don't know if it is what TS wants, "wraps" on line/screen/page (parameter), nothing fancy, but saves truncation/looking ugly. I know the computer I wrote it on is dead, but I've a feeling the data still lives. Somewhere... Maybe easier (for TS) to just do it from scratch than for me to find it, if it is what they want. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Bala,
From an old "System Product Interpreter Reference Summary"
Quote: |
[REXX] is a command programming language that allows you to combine useful sequences of commands to create new commands. [...] REXX is especially suitable for writing EXECs or editor macros, but also a useful tool for algorithm development. |
Including expression, assignment and eight versions of PARSE, there are 36 instructions, 58 "built-in" functions (don't know why I counted them), plus some external functions.
With this little lot, you can do pretty much what anyone would want.
For your example, if you only need something as simple as that:
Code: |
say "min : "min"sec : "sec |
or, by concatenating the data
Code: |
abanana = "min : "min"sec : "sec
say abanana |
If you want something fancier, write could write your own function which instead of "saying" immediately, stores the output, concatenates the next, and only issues a SAY itself when you want the output written, or, if you prefer, automatically writes a line when the line is "full", however you want to code it.
REXX, instead of having many instructions has a small number of instructions supplemented by the built-in functions. If you want something outside of the "normal" processing, you just write it yourself. |
|
Back to top |
|
|
|