Discussion:
Can fortran clear the 3270 screen?
Ron Hudson
2010-06-07 02:37:10 UTC
Permalink
Hey all...

Did you know that the fortran pause statement prompts the operator for
permission to continue?


Is there a way to clear the 3270 screen from fortran, without using
fullscreen programming?

Thanks...

Ron
Gerhard Postpischil
2010-06-07 06:22:54 UTC
Permalink
Post by Ron Hudson
Is there a way to clear the 3270 screen from fortran, without using
fullscreen programming?
I'm not sure why you ask a question you already (should) know
the answer to? The TIOC will translate unprintable characters
to a colon, SBA/SF/IC order all require an unprintable
character. Q.E.D.

You need an assembler subroutine that issues a TPUT with the
FULLSCR option, and appropriate text. Common is Write; SBA
(1,1); ' '; RA (1,1,' '): IC which is screen size independent.
Use Erase Write or Erase/Write Alternate only if you know the
screen geometry and size in use.

There are other methods (e.g., TSO macros); search the CBT files
for CLEAR, CLEAR70, CLRSCRN, CLR3270, and any number of
variations on the name (or look at file 1 online and search that).

Gerhard Postpischil
Bradford, VT
Ron Hudson
2010-06-07 16:28:15 UTC
Permalink
On Sun, Jun 6, 2010 at 11:22 PM, Gerhard Postpischil
Post by Gerhard Postpischil
Post by Ron Hudson
Is there a way to clear the 3270 screen from fortran, without using
fullscreen programming?
I'm not sure why you ask a question you already (should) know
the answer to? The TIOC will translate unprintable characters
to a colon, SBA/SF/IC order all require an unprintable
character. Q.E.D.
I am guessing this spells out "You can't from Fortran"

I will have to google "TIOC"
Post by Gerhard Postpischil
You need an assembler subroutine that issues a TPUT with the
FULLSCR option, and appropriate text. Common is Write; SBA
(1,1); ' '; RA (1,1,' '): IC which is screen size independent.
Use Erase Write or Erase/Write Alternate only if you know the
screen geometry and size in use.
There are other methods (e.g., TSO macros); search the CBT files
for CLEAR, CLEAR70, CLRSCRN, CLR3270, and any number of
variations on the name (or look at file 1 online and search that).
Gerhard Postpischil
Bradford, VT
Rick Fochtman
2010-06-07 22:56:33 UTC
Permalink
<mailto:gerhardp-***@public.gmane.org>
<>-------------------------------<snip>-------------------------

I am guessing this spells out "You can't from Fortran"

I will have to google "TIOC"
-----------------------------<unsnip>---------------------------
TIOC = Terminal I/O Control

Rick
Rick Fochtman
2010-06-07 22:52:48 UTC
Permalink
--------------------------------<snip>---------------------------------
Post by Ron Hudson
Hey all...
Did you know that the fortran pause statement prompts the operator for
permission to continue?
Is there a way to clear the 3270 screen from fortran, without using
fullscreen programming?
Thanks...
Ron
---------------------------------<unsnip>----------------------------------
FORTRAN doesn't know anything about "screens" but a very simple
Assembler subroutine, callable from FORTRAN, can clear the screen for
you. There's a number of CLRSCRN and CLR3270 TSO commands on the
CBTTAPE.ORG Web site. You could call any of them with a simple CALL
statement in FORTRAN. That's not their intended use, but the linkage is
the same and they don't process any command operands, so they should
work just find. They could also be called from COBOL, if anyone else is
tempted to play terminal games.

Rick
PeterH
2010-06-07 23:38:51 UTC
Permalink
Post by Rick Fochtman
FORTRAN doesn't know anything about "screens" but a very simple
Assembler subroutine, callable from FORTRAN, can clear the screen
for you.
If you use an external subroutine, which you would separately
compile, and all it contained was /DATA/, then it is possible to
include anything in that subroutine as "data", even functional
machine code.

As a TPUT is SVC 93, you would include what ever "orders" are
required for a "clear screen" function, and then issue SVC 93.

Everything would be coded in the appropriate source, possibly decimal
which was converted to hexadecimal by the compiler.

The MAIN would invoke the DATA control section as if it was a closed
subroutine. MAIN cannot tell that the named subroutine is actually
DATA, as it was compiled separately.

The "usual suspect" prefix and suffix instructions would be required,
as with all assembly subroutines, ending in a BR 14, of course.

This is a "hole" in the FORT G and FORT H compilers which, AFAIK, has
not been closed.

You could, for example, assemble the desired routine, and also name
it the same as the /DATA/ section, but this is not a requirement, and
relatively simple assembly-type routines may be made by hand coding
them, as described, as a FORTRAN external DATA area.
Rick Fochtman
2010-06-08 00:19:49 UTC
Permalink
-------------------------------<snip>----------------------------
Post by PeterH
Post by Rick Fochtman
FORTRAN doesn't know anything about "screens" but a very simple
Assembler subroutine, callable from FORTRAN, can clear the screen
for you.
If you use an external subroutine, which you would separately
compile, and all it contained was /DATA/, then it is possible to
include anything in that subroutine as "data", even functional
machine code.
As a TPUT is SVC 93, you would include what ever "orders" are
required for a "clear screen" function, and then issue SVC 93.
Everything would be coded in the appropriate source, possibly decimal
which was converted to hexadecimal by the compiler.
The MAIN would invoke the DATA control section as if it was a closed
subroutine. MAIN cannot tell that the named subroutine is actually
DATA, as it was compiled separately.
The "usual suspect" prefix and suffix instructions would be required,
as with all assembly subroutines, ending in a BR 14, of course.
This is a "hole" in the FORT G and FORT H compilers which, AFAIK, has
not been closed.
You could, for example, assemble the desired routine, and also name
it the same as the /DATA/ section, but this is not a requirement, and
relatively simple assembly-type routines may be made by hand coding
them, as described, as a FORTRAN external DATA area.
-------------------------------<unsnip>--------------------------------
That's all true, but it's sort of like trying to take tonsils out via
the rectum. Why would you want to?

Why re-invent the wheel?

Rick
PeterH
2010-06-08 00:29:10 UTC
Permalink
Post by Rick Fochtman
That's all true, but it's sort of like trying to take tonsils out
via the rectum. Why would you want to?
A vaginal hysterectomy v. an abdominal hysterectomy is probably a
more accurate comparison, although all medical comparisons are pretty
far afield.

At least in the example I gave, it was on-point, and would indeed
perform the function expected.
Rick Fochtman
2010-06-08 01:00:11 UTC
Permalink
--------------------------------<snip>------------------------------
Post by PeterH
Post by Rick Fochtman
That's all true, but it's sort of like trying to take tonsils out
via the rectum. Why would you want to?
A vaginal hysterectomy v. an abdominal hysterectomy is probably a
more accurate comparison, although all medical comparisons are pretty
far afield.
At least in the example I gave, it was on-point, and would indeed
perform the function expected.
---------------------------------<unsnip>---------------------------------
It's certainly workable and I won't dispute that point. But I have the
impression that Ron is not quite the Assembler programmer that you and I
might be. Let's minimize the pain. :-)

Rick
Ron Hudson
2010-06-08 01:16:13 UTC
Permalink
I am not. Yes, lets.

Let's minimize the pain. :-)

Ok, here's the reason I want to do this.. Perhaps there is another way
around.

At regular intervals my STREK program prints out the current situation:

----- show in fixed width
font----------------------------------------------------------------------------
S-TREK STATUS:GREEN
ENTERPRISE LOCATION (6.1,7.5)
1 2 3 4 5 6 7 8 %% 1 2 3 4 5 6 7 8
----------------- -- --- --- --- --- --- --- --- ---
1 . . . . . . . .|99| 888 888 888 888 999 888 888 888
2 . . . . . . . .|99| 888 888 888 888 888 888 888 888
3 . . . . . . . .|99| 888 888 888 888 888 888 888 888
4 . . . . . . . *|99| 888 888 888 888 888 888 888 888
5 + . . . . . . .|99| 888 888 888 888 888 888 888 888
6 . . . . . . . .|99| 888 888 888 888 120 200 431 888
7 . . . * . . . .|99| 888 888 888 888 10 200 20 888
8 . . . . . . . .|99| 888 888 888 888 300 210 20 888
----------------- -- --- --- --- --- --- --- --- ---
DAYS: 655 BASES: 13 TORPEDOES: 10
ENERGY: 3000 KLINGONS: 95
COMMAND CXX C:?,Q,W,I,P,T

But sometimes this gets broken by the end of page mark "***" and that leave
the player with only a portion of the information they need to select and
implement
their next command.

Oh, I just got an Idea.. If the situation display is on the screen-break
just hit enter
and get a new one without the loss of a day or the Klingons getting a
turn...
perhaps that will work.
Mike Schwab
2010-06-08 03:34:03 UTC
Permalink
When I played it at UW-Whitewater summer 1978, I just scrolled back
the paper coming out of the teletype terminal hooked up to a HP mini.
Post by Ron Hudson
I am not. Yes, lets.
 Let's  minimize the pain. :-)
Ok, here's the reason I want to do this.. Perhaps there is another way around.
----- show in fixed width font----------------------------------------------------------------------------
S-TREK                                 STATUS:GREEN
ENTERPRISE LOCATION (6.1,7.5)
  1 2 3 4 5 6 7 8 %%   1   2   3   4   5   6   7   8
----------------- --  --- --- --- --- --- --- --- ---
1 . . . . . . . .|99| 888 888 888 888 999 888 888 888
2 . . . . . . . .|99| 888 888 888 888 888 888 888 888
3 . . . . . . . .|99| 888 888 888 888 888 888 888 888
4 . . . . . . . *|99| 888 888 888 888 888 888 888 888
5 + . . . . . . .|99| 888 888 888 888 888 888 888 888
6 . . . . . . . .|99| 888 888 888 888 120 200 431 888
7 . . . * . . . .|99| 888 888 888 888  10 200  20 888
8 . . . . . . . .|99| 888 888 888 888 300 210  20 888
----------------- --  --- --- --- --- --- --- --- ---
  DAYS:  655    BASES:   13 TORPEDOES:   10
ENERGY: 3000 KLINGONS:   95
COMMAND  CXX C:?,Q,W,I,P,T
But sometimes this gets broken by the end of page mark "***" and that leave
the player with only a portion of the information they need to select and implement
their next command.
Oh, I just got an Idea.. If the situation display is on the screen-break just hit enter
and get a new one without the loss of a day or the Klingons getting a turn...
perhaps that will work.
--
Mike A Schwab, Springfield IL USA
Where do Forest Rangers go to get away from it all?
mitmwp
2010-06-08 01:54:39 UTC
Permalink
I once had to clear the screen from a Fortran IV program. I called the following assembler code:

CLEARSCR TITLE 'CLEARSCR - CLEAR 3270 SCREEN'

CLEARSCR CSECT

SETREG 12,CODE=RENT

STFSMODE ON,INITIAL=YES

LTR R2,R15

BNZ END

TPUT CLEAR,L'CLEAR,FULLSCR

STFSMODE OFF

END EOJ RC=(2),LOG=NO

CLEAR DC X'C11140403C4040001140C113'

END CLEARSCR


Mark
Post by Rick Fochtman
--------------------------------<snip>------------------------------
Post by PeterH
Post by Rick Fochtman
That's all true, but it's sort of like trying to take tonsils out
via the rectum. Why would you want to?
A vaginal hysterectomy v. an abdominal hysterectomy is probably a
more accurate comparison, although all medical comparisons are pretty
far afield.
At least in the example I gave, it was on-point, and would indeed
perform the function expected.
---------------------------------<unsnip>---------------------------------
It's certainly workable and I won't dispute that point. But I have the
impression that Ron is not quite the Assembler programmer that you and I
might be. Let's minimize the pain. :-)
Rick
Rick Fochtman
2010-06-08 02:41:54 UTC
Permalink
-------------------------------<snip>-----------------------------
I once had to clear the screen from a Fortran IV program. I called the
CLEARSCR TITLE 'CLEARSCR - CLEAR 3270 SCREEN'
CLEARSCR CSECT
SETREG 12,CODE=RENT
STFSMODE ON,INITIAL=YES
LTR R2,R15
BNZ END
TPUT CLEAR,L'CLEAR,FULLSCR
STFSMODE OFF
END EOJ RC=(2),LOG=NO
CLEAR DC X'C11140403C4040001140C113'
END CLEARSCR
Mark
-----------------------------------<unsnip>-----------------------------
That's reasonable code, Mark. But you have a few non-MVS macros in that
code that might be considered a problem. SETREG? EOJ ??

Rick
Ron Hudson
2010-06-08 02:49:36 UTC
Permalink
Post by Rick Fochtman
-------------------------------<snip>-----------------------------
I once had to clear the screen from a Fortran IV program. I called the
CLEARSCR TITLE 'CLEARSCR - CLEAR 3270 SCREEN'
CLEARSCR CSECT
SETREG 12,CODE=RENT
Change this for?(I know the registers probably change)
SAVE (14,12),,*
LR 12,15
USING HELLO1,12
Post by Rick Fochtman
STFSMODE ON,INITIAL=YES
LTR R2,R15
BNZ END
TPUT CLEAR,L'CLEAR,FULLSCR
STFSMODE OFF
END EOJ RC=(2),LOG=NO
Change this for? (I know the registers probably change)
L 13,4(,13) RESTORE SAVEAREA
LM 14,12,12(13)
SLR 15,15 CLEAR MY ENTRY POINT
BR 14 RETURN TO CALLER
Post by Rick Fochtman
CLEAR DC X'C11140403C4040001140C113'
END CLEARSCR
Mark
-----------------------------------<unsnip>-----------------------------
That's reasonable code, Mark. But you have a few non-MVS macros in that
code that might be considered a problem. SETREG? EOJ ??
Rick
mitmwp
2010-06-08 15:37:00 UTC
Permalink
Sorry, I did a quick copy and paste from some old stuff (not Turnkey). I fired up the Turnkey and made it work.

Here is a complete copy of the program that has assembled, linked and run on Turnkey MVS:

//HERC01J JOB 'TURNKEY USER',CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1),
// REGION=4096K,NOTIFY=HERC01
//*
//ASM EXEC PGM=IFOX00,PARM=OBJ,REGION=2048K
//SYSLIB DD DSN=SYS1.MACLIB,DISP=SHR
//SYSUT1 DD DSN=&&SYSUT1,UNIT=SYSDA,SPACE=(1700,(600,100))
//SYSUT2 DD DSN=&&SYSUT2,UNIT=SYSDA,SPACE=(1700,(600,100))
//SYSUT3 DD DSN=&&SYSUT3,UNIT=SYSDA,SPACE=(1700,(600,100))
//SYSPRINT DD SYSOUT=*,DCB=BLKSIZE=189
//SYSPUNCH DD DUMMY
//SYSGO DD DSN=&&OBJSET,
// UNIT=SYSDA,SPACE=(80,(200,50)),DISP=(MOD,PASS)
//SYSIN DD *
CLEARSCR TITLE 'CLEARSCR - CLEAR 3270 SCREEN'
CLEARSCR CSECT
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R6 EQU 6
R7 EQU 7
R8 EQU 8
R9 EQU 9
R10 EQU 10
R11 EQU 11
R12 EQU 12
R13 EQU 13
R14 EQU 14
R15 EQU 15
BEGIN SAVE (14,12)
USING CLEARSCR,R3
LR R3,R15
ST R13,SAVEAREA+4 STORE CALLERS SAVEAREA IN MY SAVEAREA
LR R12,R13 LOAD CALLERS SAVEAREA ADDR IN R12
LA R13,SAVEAREA LOAD MY SAVEAREA ADDR IN R13
ST R13,8(R12) STORE MY SAVEAREA ADDR IN CALLERS SAVE
STFSMODE ON,INITIAL=YES
LTR R2,R15
BNZ END
TPUT CLEAR,L'CLEAR,FULLSCR
STFSMODE OFF
END EQU *
L R13,SAVEAREA+4 ...END.....
RETURN (14,12),RC=0 ..PROGRAM
SAVEAREA DS 18F
CLEAR DC X'C11140403C4040001140C113'
END CLEARSCR
/*
//LKED EXEC PGM=IEWL,PARM='LIST,XREF,NCAL,LET,SIZE=(300K,64K)',
// COND=(4,LT,ASM)
//SYSLMOD DD DISP=SHR,DSN=HERC01.TEST.LOADLIB
//INPUT DD DSN=&&OBJSET,DISP=(OLD,DELETE)
//SYSUT1 DD DSN=&&SYSUT1,UNIT=SYSDA,SPACE=(1024,(50,20))
//SYSPRINT DD SYSOUT=*
//SYSLIN DD *
INCLUDE INPUT
NAME CLEARSCR(R)
/*


To test.... Here is a little CLIST that calls the program --> put it in HERC01.TEST.CNTL(TSTCLEAR) ---> Then from READY EX 'HERC01.TEST.CNTL(TSTCLEAR)'



PROC 0
WRITE WE ARE IN THE CLEAR CLIST... GOING TO CALL PROGRAM
CALL 'HERC01.TEST.LOADLIB(CLEARSCR)'
WRITE WE HAVE COMPLETED THE CALL TO 'HERC01.TEST.LOADLIB(CLEARSCR)'
END



e.g.
READY
ex 'herc01.test.cntl(tstclear)'
WE ARE IN THE CLEAR CLIST...
.
.
<SCREEN CLEAR>
.
.
WE HAVE COMPLETED THE CALL TO 'HERC01.TEST.LOADLIB(CLEARSCR)'
READY




I believe this should be able to be called from a Fortran program and get the screen to clear at the appropriate time.

Best Regards,

Mark
Post by Ron Hudson
Post by Rick Fochtman
-------------------------------<snip>-----------------------------
I once had to clear the screen from a Fortran IV program. I called the
CLEARSCR TITLE 'CLEARSCR - CLEAR 3270 SCREEN'
CLEARSCR CSECT
SETREG 12,CODE=RENT
Change this for?(I know the registers probably change)
SAVE (14,12),,*
LR 12,15
USING HELLO1,12
Post by Rick Fochtman
STFSMODE ON,INITIAL=YES
LTR R2,R15
BNZ END
TPUT CLEAR,L'CLEAR,FULLSCR
STFSMODE OFF
END EOJ RC=(2),LOG=NO
Change this for? (I know the registers probably change)
L 13,4(,13) RESTORE SAVEAREA
LM 14,12,12(13)
SLR 15,15 CLEAR MY ENTRY POINT
BR 14 RETURN TO CALLER
Post by Rick Fochtman
CLEAR DC X'C11140403C4040001140C113'
END CLEARSCR
Mark
-----------------------------------<unsnip>-----------------------------
That's reasonable code, Mark. But you have a few non-MVS macros in that
code that might be considered a problem. SETREG? EOJ ??
Rick
Rick Fochtman
2010-06-08 21:32:05 UTC
Permalink
Post by Rick Fochtman
-------------------------------<snip>-----------------------------
I once had to clear the screen from a Fortran IV program. I
CLEARSCR TITLE 'CLEARSCR - CLEAR 3270 SCREEN'
CLEARSCR CSECT
SETREG 12,CODE=RENT
Change this for?(I know the registers probably change)
SAVE (14,12),,*
LR 12,15
USING HELLO1,12
STFSMODE ON,INITIAL=YES
LTR R2,R15
BNZ END
TPUT CLEAR,L'CLEAR,FULLSCR
STFSMODE OFF
END EOJ RC=(2),LOG=NO
Change this for? (I know the registers probably change)
L 13,4(,13) RESTORE SAVEAREA
LM 14,12,12(13)
SLR 15,15 CLEAR MY ENTRY POINT
BR 14 RETURN TO CALLER
CLEAR DC X'C11140403C4040001140C113'
END CLEARSCR
Mark
-----------------------------------<unsnip>-----------------------------
That's reasonable code, Mark. But you have a few non-MVS macros in
that code that might be considered a problem. SETREG? EOJ ??
Rick
Andreas F. Geissbuehler
2010-06-09 13:27:01 UTC
Permalink
Ron,

Below is an ancient Clear Screen sub-routne I found in my archives written in bare naked Assembler, roughly 1970s vintage, author unknown:

CLRSCRN START 0 00000100
USING *,10 00000200
ENTRY CLRSCN 00000300
CLRSCN EQU * 00000400
SAVE (14,12) 00000500
LR 10,15 00000600
GTSIZE 00001100
LTR 0,0 00001200
BZ NOTCRT 00001300
TPUT ERASE,L'ERASE,FULLSCR,,HOLD 00001400
NOTCRT EQU * 00001500
RETURN (14,12),RC=0 00001600
ERASE DC X'C1115D7E1140403C4040001DC813' 00001700
END 00001900

You cold remove the GTSIZE macro (lines 1100-1300). Its purpose is to prevent printing "rubbish" (the ERASE orders) on a teletype or IBM 2741 TSO termial.

Hope this helps !

Andreas F. Geissbuehler
AFG Consultants Inc.
http://www.afgc-inc.com/
Ron Hudson
2010-06-08 02:45:45 UTC
Permalink
Thanks MITMWP - I was just about to dismantle one of my other programs
to reduce it to a clear the screen. I think this is cleaner.


Just to be sure I transcribed it properly...

000100 CLEARSCR TITLE 'CLEARSCR - CLEAR 3270 SCREEN'
000200 CLEARSCR CSECT
000300 SETREG 12,CODE=RENT
000400 STFSMODE ON,INITIAL=YES
000500 LTR 2,15
000600 BNZ END
000700 TPUT CLEAR,LCLEAR,FULLSCR
000800 STFSMODE OFF
000900 END EOJ RC=(2),LOG=NO
001000 CLEAR DC X'C11140403C4040001140C113'
001100 LCLEAR EQU *-CLEAR
001200 END CLEARSCR

I made a change or two - in line 500 you referenced the registers with an
R - but don't show the EQU to set that up
I calculated LCLEAR,

I have not seen EOJ RC=2,LOG=NO but then I have not seen much anyway.

I have it in RPF in a PDS now... Anyone see any errors?
Mark
2010-06-08 23:45:57 UTC
Permalink
I setup a CLEARSCR program in the Turnkey as HERC01. The listing above has font problems. I put a copy called CLEARSCR.txt in the files section. It has been asseembled, linked and tested as HERC01 on the turnkey.

Mark
Post by Ron Hudson
Thanks MITMWP - I was just about to dismantle one of my other programs
to reduce it to a clear the screen. I think this is cleaner.
Just to be sure I transcribed it properly...
000100 CLEARSCR TITLE 'CLEARSCR - CLEAR 3270 SCREEN'
000200 CLEARSCR CSECT
000300 SETREG 12,CODE=RENT
000400 STFSMODE ON,INITIAL=YES
000500 LTR 2,15
000600 BNZ END
000700 TPUT CLEAR,LCLEAR,FULLSCR
000800 STFSMODE OFF
000900 END EOJ RC=(2),LOG=NO
001000 CLEAR DC X'C11140403C4040001140C113'
001100 LCLEAR EQU *-CLEAR
001200 END CLEARSCR
I made a change or two - in line 500 you referenced the registers with an
R - but don't show the EQU to set that up
I calculated LCLEAR,
I have not seen EOJ RC=2,LOG=NO but then I have not seen much anyway.
I have it in RPF in a PDS now... Anyone see any errors?
Ron Hudson
2010-06-11 01:17:37 UTC
Permalink
Thanks Everyone -

Problem solved.

I had an assembly language program that setup a full screen form for the
user fill in, then transferred the
information to another field..

Anyway I cut that one down to just it's clearing the screen essentials and
then was able to call that
from Fortran.

I am working clean ups and adjustments right now.

Thanks Rick,Mark,Mike,Gerhard,Peter,mitmwp and everyone else

Loading...