Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SAY statement in REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
shanbalasay

New User


Joined: 22 May 2007
Posts: 19
Location: Belfast, UK

PostPosted: Fri Aug 05, 2011 3:52 pm    Post subject: SAY statement in REXX
Reply with quote

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
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Aug 05, 2011 3:59 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Aug 05, 2011 4:03 pm    Post subject:
Reply with quote

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/IKJ4C310/1.2.3.2.2?SHELF=&DT=20010706113306
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Aug 05, 2011 4:13 pm    Post subject: Reply to: SAY statement in REXX
Reply with quote

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
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IKJ4BK90

or to the IBM index for other zOS versions/releases
http://www-03.ibm.com/systems/z/os/zos/bkserv/index.html
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Aug 05, 2011 4:19 pm    Post subject: Reply to: SAY statement in REXX
Reply with quote

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
View user's profile Send private message
shanbalasay

New User


Joined: 22 May 2007
Posts: 19
Location: Belfast, UK

PostPosted: Tue Aug 09, 2011 9:39 pm    Post subject: Reply to: SAY statement in REXX
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 09, 2011 10:16 pm    Post subject:
Reply with quote

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
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Wed Aug 10, 2011 12:39 am    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Aug 10, 2011 12:57 am    Post subject:
Reply with quote

It looks like file 431 of the CBT tape.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Wed Aug 10, 2011 1:21 am    Post subject:
Reply with quote

WRITENR is a clist called from your rexx program.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Aug 12, 2011 2:56 pm    Post subject: Reply to: SAY statement in REXX
Reply with quote

no need to explain how perl does it, just a useless waste of resources for everybody,
You already expressed You requirements icon_evil.gif

perl is perl REXX is REXX so comparing them is a moot point

noting prevents You from writing a simple rexx subroutine/wrapper around rexx say to provide what You want

or if Your installation allows it install the REXX streamio package
available here

ftp://ftp.software.ibm.com/ps/products/ad/obj-xx/Streamio.pdf
ftp://ftp.software.ibm.com/ps/products/ad/obj-xx/rexxsio.zip
ftp://ftp.software.ibm.com/ps/products/ad/obj-xx/rexxsio.ZIP

( wrong url fixed )
and check if the charout lets You do it
along the lines of

call charout , "tokn1 "
call charout , "tokn2 "
call charout , "tokn3 "
call charout , "tokn4"
say

which will produce
tokn1 tokn2 tokn3 tokn4
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Fri Aug 12, 2011 3:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Aug 12, 2011 3:28 pm    Post subject: Reply to: SAY statement in REXX
Reply with quote

icon_redface.gif my bad... laziness to cut and paste from the original urls
should have been

ftp://ftp.software.ibm.com/ps/products/ad/obj-xx/rexxsio.zip
or
ftp://ftp.software.ibm.com/ps/products/ad/obj-xx/rexxsio.ZIP

tested and working

fixed also the original answer
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Aug 12, 2011 3:47 pm    Post subject: Reply to: SAY statement in REXX
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Aug 12, 2011 4:35 pm    Post subject: Reply to: SAY statement in REXX
Reply with quote

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 icon_biggrin.gif )
gave the same results as a sequence of say!

I' ll keep testing and post the results !
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Aug 12, 2011 5:00 pm    Post subject: Reply to: SAY statement in REXX
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Aug 12, 2011 6:04 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Aug 12, 2011 6:17 pm    Post subject: Reply to: SAY statement in REXX
Reply with quote

Quote:
if we are stepping outside of SAY itself

I beg to differ icon_biggrin.gif

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Aug 12, 2011 6:52 pm    Post subject: Reply to: SAY statement in REXX
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Sun Aug 14, 2011 5:17 am    Post subject: Reply to: SAY statement in REXX
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
This topic is locked: you cannot edit posts or make replies. Need to code a Rexx PGM sundaram.naveen CLIST & REXX 18 Thu Oct 06, 2016 6:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us