Insert a Page break in REXX



IBM's Command List programming language & Restructured Extended Executor

Insert a Page break in REXX

Postby durgam4 » Fri Jul 18, 2014 3:32 pm

How to write records to a new page in REXX.
durgam4
 
Posts: 9
Joined: Fri Jun 25, 2010 4:59 am
Has thanked: 0 time
Been thanked: 0 time

Re: Insert a Page break in REXX

Postby prino » Fri Jul 18, 2014 3:55 pm

Clarify "a new page".

z/OS has no concept of pages, unless you mean print files, in which case your file should be defined FBA, FBM, VBA or VBM, and you should read the manuals!
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: Insert a Page break in REXX

Postby durgam4 » Fri Jul 18, 2014 4:00 pm

I need to print every 30 records in a new page. is there any command to do this?
durgam4
 
Posts: 9
Joined: Fri Jun 25, 2010 4:59 am
Has thanked: 0 time
Been thanked: 0 time

Re: Insert a Page break in REXX

Postby steve-myers » Fri Jul 18, 2014 5:50 pm

I do not think you read and understood prino's post.

Rexx, as a language, is not well suited to prepare highly formatted reports.

In the TSO environment there is no concept of report pages; for the most part TSO programs write their output to a TSO terminal, which in the current world usually means a 3270 type "glass teletype." In 1970 or so when TSO was first used, TSO terminals usually meant something like an IBM 2741 printer/keyboard using fan folded paper usually intended for 1403 printers. While this paper had "pages," TSO was ignorant of page boundaries; programs running in the TSO environment literally had to count lines if they were going to write "pages" on a 2741 printer/keyboard, and the printer/keyboard operator had to manually position the paper before starting a program that was going to write "pages" on this paper.

The term "glass teletype" was often used in the 1970s and 1980s when CRT terminals were replacing printer/keyboard terminals in nearly all online environments, not just TSO. By the 1990s, the term "glass teletype" was obsolete since CRT terminals had completely replaced printer/keyboards. Only gray beards like me even remember the term.

To extend prino's remarks: if it is your intent to use Rexx to produce output that is going to be printed, you are going to write the printed report to a data set that uses carriage control characters, and then "print" the data set in some fashion appropriate to your environment.

I need to print every 30 records in a new page. is there any command to do this?
Basically, no. If you are thinking in terms of the ASCII "form feed" concept and the \f character as used in the standard C library printf function formats, it really does not exist in Rexx or the z/OS mainframe except as carriage control characters used in printed reports. Technically the EBCDIC character set does have a form feed character comparable to the ASCII form feed character, but the only time it was widely used was for now obsolete 3270 type printers.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Insert a Page break in REXX

Postby durgam4 » Fri Jul 18, 2014 8:29 pm

Got it .. Thank you Steve and Prino for your replies
durgam4
 
Posts: 9
Joined: Fri Jun 25, 2010 4:59 am
Has thanked: 0 time
Been thanked: 0 time

Re: Insert a Page break in REXX

Postby Pedro » Fri Jul 18, 2014 9:31 pm

30 records seems odd to me. Are you 'writing' a page to the screen?
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: Insert a Page break in REXX

Postby steve-myers » Fri Jul 18, 2014 10:59 pm

Pedro is right. Sadly, there is no formally defined way for Rexx to clear a screen and start writing from the top. Many shops have a TSO command to clear a screen, perhaps known as clrscrn or something similar. I use a command I stole from my last employer for this purpose, that I renamed to CLS. I vaguely recall a topic about how to write a command to clear a screen in this forum a couple of years ago.

There is a formal method for Rexx to obtain screen dimensions. See sysvar in "TSO/E REXX Reference" for your z/OS release.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Insert a Page break in REXX

Postby Pedro » Fri Jul 18, 2014 11:22 pm

Writing line mode messages to the screen is not user friendly. You should consolidate all of your messages then display in a file.

Here is an example of capturing the line mode messages:
/* rexx */                                                           
parse arg parms                                                       
x = outtrap('output.')                                               
Address TSO parms                                                     
x = outtrap('OFF')                                                   
if output.0 = 0 then                                                 
 Do                                                                   
  say '===> No information trapped from' parms                       
  EXIT                                                               
 End                                                                 
trapdd = 'TRAP'|| right('0000'||random(9999),4)                       
Address TSO "ALLOC FILE("TRAPDD") BLKSIZE(0) LRECL(133) NEW REU",     
            " SPACE(50,50) CYL RECFM(F,B) "                           
Address TSO 'EXECIO ' output.0 ' DISKW 'TRAPDD' ( FINIS  STEM OUTPUT.'
Address ISPEXEC                                                       
"LMINIT DATAID(DATAID) DDNAME("TRAPDD")"                             
"VIEW DATAID(&DATAID)"                                               
"LMFREE DATAID(&DATAID)"                                             
Address TSO "FREE F("TRAPDD")"                                       

If you normally invoke your rexx program like this:
TSO %myrexx
you can invoke it from the trap exec:
TSO %TRAP %myrexx

Though, ideally, your rexx program should write to a file itself and also invoke the VIEW service.
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: Insert a Page break in REXX

Postby steve-myers » Fri Jul 18, 2014 11:49 pm

Again Pedro is right. I usually write print output to a data set and then browse the data set. The data set is often too wide to work well that way, but it's usually better than writing it to the screen!
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Insert a Page break in REXX

Postby Pedro » Wed Jul 23, 2014 9:18 pm

The data set is often too wide to work well that way

You should format the output based on the screen width.
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post