REXX ISPF Panels
To Display a ISPF Screen using Rexx
REXX Code
ISPEXEC "CONTROL DISPLAY REFRESH"
ISPEXEC "LIBDEF ISPPLIB DATASET ID ('IBMUSER.FADO.PANELS')"
/* TO DISPLAY FIRST PANEL*/
ISPEXEC "DISPLAY PANEL(DB2P) CURSOR(DBS1)"
/* PANEL(DB2P) specifies the Panel name which is a member name
and CURSOR(DBS1) tell ISPF to place the cursor on that Field */
Basic Display
REXX CODE TO Execute
/*REXX*/
ISPEXEC CONTROL DISPLAY REFRESH
"ISPEXEC LIBDEF ISPPLIB DATASET ID ('IBMUSER.FADO.PANELS')"
/*panels location ex: IBMUSER.FADO.PANELS*/
TIM = ""
DAT = ""
"ISPEXEC VGET (TIM,DAT) PROFILE";
"ISPEXEC DISPLAY PANEL (PANL2)"
TIM = TIME()
DAT = DATE()
"ISPEXEC VPUT (TIM,DAT) PROFILE";
"ISPEXEC DISPLAY PANEL (PANEL2)"
/*PANEL2 is the panel PDS member name */
EXIT
Panel Code
PDS member PANEL2 contains this
)ATTR
% TYPE (TEXT) INTENS (HIGH) COLOR (GREEN) SKIP (ON)
# TYPE (TEXT) INTENS (HIGH) COLOR (YELLOW)
¢ TYPE (TEXT) INTENS (HIGH) COLOR (WHITE) CAPS (OFF)
_ TYPE (INPUT) INTENS (LOW) COLOR (GREEN) PAD (_)
$ TYPE (OUTPUT) INTENS (HIGH) COLOR (BLUE)
)BODY
*----------------------------------------------------------------------*
#WELCOME TO ELT TRAINEE PAGE
*----------------------------------------------------------------------*
TIME:$TIM %
DATE:$DAT %
ENTER YOUR NAME: _Z %
ENTER YOUR AGE: _Z %
*----------------------------------------------------------------------*
)INIT
.ZVARS = '(NAME AGE)'
&NAME = ''
&AGE = ''
)PROC
)END
NAME and AGE fields are not used in this program they are dummy.
------------------------------------------------------------------------------
open dataset to edit in REXX ISPF
REXX CODE
/*REXX*/
ISPEXEC CONTROL DISPLAY REFRESH
"ISPEXEC LIBDEF ISPPLIB DATASET ID ('IBMUSER.FADO.PANELS')"
"ISPEXEC VERASE (DSNAME,DSMEMB) PROFILE";
"ISPEXEC DISPLAY PANEL (PANEL3)"
"ISPEXEC VGET (DSNAME,DSMEMB) PROFILE";
SAY DSMEMB
SAY DSNAME
IF DSMEMB = "" THEN
MIG_FILE1 = DSNAME
ELSE
MIG_FILE1 = DSNAME"("DSMEMB")"
CHKLIB = SYSDSN("'"MIG_FILE1"'") /* SEE IF DATA SET EXISTS */
IF CHKLIB <> 'OK' THEN DO /* DATA SET NOT FOUND */
SAY 'ERROR -' DSN 'NOT FOUND. CHECK NAME AND QUOTES.' /* ISSUE MSG*/
EXIT 12 /* EXIT RC=12 */
END
ADDRESS ISPEXEC "EDIT DATASET ('"MIG_FILE1"')"
EXIT
ISPF Panel Code
PDS member name PANEL3
)ATTR DEFAULT (%+_)
% TYPE (TEXT) INTENS (HIGH)
+ TYPE (TEXT) INTENS (LOW) SKIP (ON)
_ TYPE (INPUT) INTENS (HIGH) CAPS (ON) JUST(LEFT) COLOR(BLUE) PADC(_)
)BODY
+ A ISPF PANEL 1 - REXX TRAINING TO OPEN DATASET FOR EDITING
+ ----------------------------------------------------------------------
+
+ %ENTER THE DATASET NAME ==>_DSNAME +
+
+ %ENTER THE DATASET MEMBER IF EXISTING ==>_DSMEMB +
+
+ +PRESS ENTER TO CONTINUE,PF3 TO EXIT +
+
+
+
)INIT
VGET(DSNAME,DSMEMB)PROFILE
)PROC
VPUT(DSNAME,DSMEMB)PROFILE
)END
To Display Error Messages on ISPF Screen using Rexx
ZEDLMSG = TEMPZTDS 'ERROR IN SELECTION'
ADDRESS ISPEXEC "SETMSG MSG(ISRZ000)"
REXX CODE to add two numbers using ISPF Panel
REXX Code
/*REXX*/
ISPEXEC CONTROL DISPLAY REFRESH
"ISPEXEC LIBDEF ISPPLIB DATASET ID ('IBMUSER.FADO.PANEL')"
DO FOREVER
"ISPEXEC VERASE (INP1,INP2,OUT) PROFILE";
"ISPEXEC DISPLAY PANEL (ADD)"
CALL SUB
"ISPEXEC VGET (INP1,INP2,OUT) PROFILE";
IF INP1 = "" | INP2 = "" THEN DO
ZEDLMSG = TEMPZTDS 'INVALID INPUTS'
ADDRESS ISPEXEC "SETMSG MSG(ISRZ000)"
END
ELSE
OUT = INP1 + INP2
"ISPEXEC DISPLAY PANEL (ADD)"
CALL SUB
END
SUB:
"ISPEXEC VGET (ZPFKEY) ASIS"
IF ZPFKEY = "PF03" THEN
EXIT RC
RETURN
ISPF Panel Code
PDS (IBMUSER.FADO.PANEL) Member name (ADD)
)ATTR
! TYPE(TEXT) INTENS(HIGH) CAPS(ON) PAD(NULLS) COLOR(GREEN) SKIP(ON)
$ TYPE(TEXT) INTENS(HIGH) CAPS(ON) PAD(NULLS) COLOR(BLUE) SKIP(ON)
¢ TYPE(TEXT) INTENS(HIGH) CAPS(ON) PAD(NULLS) COLOR(WHITE) SKIP(ON)
# TYPE(INPUT) INTENS(LOW) CAPS(ON) PAD('_') COLOR(YELLOW)
+ TYPE(TEXT) INTENS(LOW) SKIP(ON)
)BODY
%COMMAND ===>_ZCMD
+-------------------------------------------------------------------
+ $ SAMPLE PANEL
+-------------------------------------------------------------------
+
+
+
+! ENTER THE FIRST NUMBER : #INP1 +
+! ENTER THE SECOND NUMBER : #INP2 +
+
+
+
+! THE SUM IS : #OUT +
+
+
+
+
+------------------------------------------------------------------
+ ¢F3=END ¢<ENTER>=CONTINUE
)INIT
)PROC
VER (&INP1,NONBLANK)
VPUT( INP1,INP2,OUT) PROFILE
VGET( INP1,INP2,OUT) PROFILE
)END
To Display a ISPF Screen using Rexx
REXX Code
ISPEXEC "CONTROL DISPLAY REFRESH"
ISPEXEC "LIBDEF ISPPLIB DATASET ID ('IBMUSER.FADO.PANELS')"
/* TO DISPLAY FIRST PANEL*/
ISPEXEC "DISPLAY PANEL(DB2P) CURSOR(DBS1)"
/* PANEL(DB2P) specifies the Panel name which is a member name
and CURSOR(DBS1) tell ISPF to place the cursor on that Field */
Basic Display
REXX CODE TO Execute
/*REXX*/
ISPEXEC CONTROL DISPLAY REFRESH
"ISPEXEC LIBDEF ISPPLIB DATASET ID ('IBMUSER.FADO.PANELS')"
/*panels location ex: IBMUSER.FADO.PANELS*/
TIM = ""
DAT = ""
"ISPEXEC VGET (TIM,DAT) PROFILE";
"ISPEXEC DISPLAY PANEL (PANL2)"
TIM = TIME()
DAT = DATE()
"ISPEXEC VPUT (TIM,DAT) PROFILE";
"ISPEXEC DISPLAY PANEL (PANEL2)"
/*PANEL2 is the panel PDS member name */
EXIT
Panel Code
PDS member PANEL2 contains this
)ATTR
% TYPE (TEXT) INTENS (HIGH) COLOR (GREEN) SKIP (ON)
# TYPE (TEXT) INTENS (HIGH) COLOR (YELLOW)
¢ TYPE (TEXT) INTENS (HIGH) COLOR (WHITE) CAPS (OFF)
_ TYPE (INPUT) INTENS (LOW) COLOR (GREEN) PAD (_)
$ TYPE (OUTPUT) INTENS (HIGH) COLOR (BLUE)
)BODY
*----------------------------------------------------------------------*
#WELCOME TO ELT TRAINEE PAGE
*----------------------------------------------------------------------*
TIME:$TIM %
DATE:$DAT %
ENTER YOUR NAME: _Z %
ENTER YOUR AGE: _Z %
*----------------------------------------------------------------------*
)INIT
.ZVARS = '(NAME AGE)'
&NAME = ''
&AGE = ''
)PROC
)END
NAME and AGE fields are not used in this program they are dummy.
------------------------------------------------------------------------------
open dataset to edit in REXX ISPF
REXX CODE
/*REXX*/
ISPEXEC CONTROL DISPLAY REFRESH
"ISPEXEC LIBDEF ISPPLIB DATASET ID ('IBMUSER.FADO.PANELS')"
"ISPEXEC VERASE (DSNAME,DSMEMB) PROFILE";
"ISPEXEC DISPLAY PANEL (PANEL3)"
"ISPEXEC VGET (DSNAME,DSMEMB) PROFILE";
SAY DSMEMB
SAY DSNAME
IF DSMEMB = "" THEN
MIG_FILE1 = DSNAME
ELSE
MIG_FILE1 = DSNAME"("DSMEMB")"
CHKLIB = SYSDSN("'"MIG_FILE1"'") /* SEE IF DATA SET EXISTS */
IF CHKLIB <> 'OK' THEN DO /* DATA SET NOT FOUND */
SAY 'ERROR -' DSN 'NOT FOUND. CHECK NAME AND QUOTES.' /* ISSUE MSG*/
EXIT 12 /* EXIT RC=12 */
END
ADDRESS ISPEXEC "EDIT DATASET ('"MIG_FILE1"')"
EXIT
ISPF Panel Code
PDS member name PANEL3
)ATTR DEFAULT (%+_)
% TYPE (TEXT) INTENS (HIGH)
+ TYPE (TEXT) INTENS (LOW) SKIP (ON)
_ TYPE (INPUT) INTENS (HIGH) CAPS (ON) JUST(LEFT) COLOR(BLUE) PADC(_)
)BODY
+ A ISPF PANEL 1 - REXX TRAINING TO OPEN DATASET FOR EDITING
+ ----------------------------------------------------------------------
+
+ %ENTER THE DATASET NAME ==>_DSNAME +
+
+ %ENTER THE DATASET MEMBER IF EXISTING ==>_DSMEMB +
+
+ +PRESS ENTER TO CONTINUE,PF3 TO EXIT +
+
+
+
)INIT
VGET(DSNAME,DSMEMB)PROFILE
)PROC
VPUT(DSNAME,DSMEMB)PROFILE
)END
To Display Error Messages on ISPF Screen using Rexx
ZEDLMSG = TEMPZTDS 'ERROR IN SELECTION'
ADDRESS ISPEXEC "SETMSG MSG(ISRZ000)"
REXX CODE to add two numbers using ISPF Panel
REXX Code
/*REXX*/
ISPEXEC CONTROL DISPLAY REFRESH
"ISPEXEC LIBDEF ISPPLIB DATASET ID ('IBMUSER.FADO.PANEL')"
DO FOREVER
"ISPEXEC VERASE (INP1,INP2,OUT) PROFILE";
"ISPEXEC DISPLAY PANEL (ADD)"
CALL SUB
"ISPEXEC VGET (INP1,INP2,OUT) PROFILE";
IF INP1 = "" | INP2 = "" THEN DO
ZEDLMSG = TEMPZTDS 'INVALID INPUTS'
ADDRESS ISPEXEC "SETMSG MSG(ISRZ000)"
END
ELSE
OUT = INP1 + INP2
"ISPEXEC DISPLAY PANEL (ADD)"
CALL SUB
END
SUB:
"ISPEXEC VGET (ZPFKEY) ASIS"
IF ZPFKEY = "PF03" THEN
EXIT RC
RETURN
ISPF Panel Code
PDS (IBMUSER.FADO.PANEL) Member name (ADD)
)ATTR
! TYPE(TEXT) INTENS(HIGH) CAPS(ON) PAD(NULLS) COLOR(GREEN) SKIP(ON)
$ TYPE(TEXT) INTENS(HIGH) CAPS(ON) PAD(NULLS) COLOR(BLUE) SKIP(ON)
¢ TYPE(TEXT) INTENS(HIGH) CAPS(ON) PAD(NULLS) COLOR(WHITE) SKIP(ON)
# TYPE(INPUT) INTENS(LOW) CAPS(ON) PAD('_') COLOR(YELLOW)
+ TYPE(TEXT) INTENS(LOW) SKIP(ON)
)BODY
%COMMAND ===>_ZCMD
+-------------------------------------------------------------------
+ $ SAMPLE PANEL
+-------------------------------------------------------------------
+
+
+
+! ENTER THE FIRST NUMBER : #INP1 +
+! ENTER THE SECOND NUMBER : #INP2 +
+
+
+
+! THE SUM IS : #OUT +
+
+
+
+
+------------------------------------------------------------------
+ ¢F3=END ¢<ENTER>=CONTINUE
)INIT
)PROC
VER (&INP1,NONBLANK)
VPUT( INP1,INP2,OUT) PROFILE
VGET( INP1,INP2,OUT) PROFILE
)END