ISPF 2.x, MVS38J, TSO

Calendar on ISPF Panel w MVS 3.8J

Overview

Adding a calendar display field to a ISPF panel without a built-in function on your MVS 3.8J hobbyist system is a simple implementation using the AREA tag to define a dynamic area in ISPF 2.x! 

It is assumed the reader has basic working knowledge of TSO CLISTs and ISPF services.

Let’s walk through a simple design brainstorm of a representative learning exercise.

The Design

First, a function is required to provide monthly calendar data as a string representing a specific month with a defined pattern regardless of month.  

The calendar string must be patterned (sliced) into weeks.  In this case, from Sunday to Saturday as depicted by the December 2018 calendar on the left.

Let’s continue exploring and designing…

If we physically slice each week in the above calendar, the result is eight slices concatenated (pasted in sequential order) representing the month name year (slice 1), days of week (slice 2) , and 6 weeks for dates (slices 3 – 8).  If a data length is applied to each slice, say 21 bytes, the string length is 168 bytes (8 slices x 21 bytes per slice).  Each slice (slice 2 – 8) represents a full week – seven days of the month, Sunday to Saturday, respectively.

A representation of the calendar data string is shown below:

0        1         2         3         4         5         6         7         8         9         0         1         2         3         4         5         6       | 
1...5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5..|
___DECEMBER 2018____ S M T W T F S . . . . . . 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 1 2 3 4 5
|--21 byte slice#1--||--21 byte slice#2--||--21 byte slice#3--||--21 byte slice#4--||--21 byte slice#5--||--21 byte slice#6--||--21 byte slice#7--||--21 byte slice#8--|
| (Month and Year) || (7 days) || (7 days) || (7 days) || (7 days) || (7 days) || (7 days) || (7 days) |

If the above string is logically split into slices, basically working backwards from our brainstorming thus far, the text string can be divided into 21 byte segments (slices) to form a tabular view.

A tabular representation of the 8 row table is shown below:

      |---21 byte slice---|
0 + 1 + 2
Row 1...5....0....5....0.
1 ___DECEMBER 2018____
2 S M T W T F S
3 . . . . . . 1 Each slice contains 7 occurrences
4 2 3 4 5 6 7 8 representing 3 bytes for each
5 9 10 11 12 13 14*15 day in the week
6 16 17 18 19 20 21 22
7 23 24 25 26 27 28 29
8 30 31

If the current date is marked with a preceding ‘*’, assuming today is December 15, 2018, the calendar highlights today’s date!.

After establishing a data structure for calendar data, a panel definition needs to be declared to physically display the calendar value.

Below are pertinent ISPF panel sections that define a dynamic area and associated color attributes to display the dialog variable CALENDAR.  Notice that the area defines a 8 row depth area with row length of 21 bytes. 

)ATTR  
* AREA(DYNAMIC) SCROLL(ON)
[ TYPE(DATAOUT) INTENS(LOW) COLOR(GREEN)

0 + 1 + 2
1...5....0....5....0.
)BODY
*CALENDAR *
* *
* *
* *
* *
* *
* *
* *

After the calendar data is constructed and moved to the panel variable, the panel is displayed as follows:

 ___DECEMBER 2018____
S M T W T F S
. . . . . . 1
2 3 4 5 6 7 8
9 10 11 12 13 14*15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31

Some Code…

Ready for a test drive?  Start your TSO editor. 

Below are two steps to demonstrate the display calendar design on your MVS 3.8J system with ISPF 2.x!

1) This component simulates the setting of symbolic variable, CALENDAR, and displays its content on panel PCAL01 using the AREA tag definition.
  –  Copy-paste and save the following CLIST as SYS2.CMDPROC(CCAL01):

PROC 0                                                              

/****************************************************************/
/* CLIST: CCAL01 To demonstrate a CALENDAR display */
/* on panel PCAL01 */
/****************************************************************/


/* Declare CALENDARn ROW variable with data */
SET CALENDAR1 = &STR( ___DECEMBER 2018____) /* Row 1*/
SET CALENDAR2 = &STR( S M T W T F S) /* Row 2*/
SET CALENDAR3 = &STR( . . . . . . 1) /* Row 3*/
SET CALENDAR4 = &STR( 2 3 4 5 6 7 8) /* Row 4*/
SET CALENDAR5 = &STR( 9 10 11 12 13 14*15) /* Row 5*/
SET CALENDAR6 = &STR( 16 17 18 19 20 21 22) /* Row 6*/
SET CALENDAR7 = &STR( 23 24 25 26 27 28 29) /* Row 7*/
SET CALENDAR8 = &STR( 30 31 ) /* Row 8*/

/* Add '[' attribute to start of each CALENDARn ROW */
/* and construct CALENDAR */
SET CALENDAR = &STR([)&SUBSTR(2:021,&STR(&CALENDAR1))
SET CALENDAR = &STR(&CALENDAR)&STR([)&SUBSTR(2:021,&STR(&CALENDAR2))
SET CALENDAR = &STR(&CALENDAR)&STR([)&SUBSTR(2:021,&STR(&CALENDAR3))
SET CALENDAR = &STR(&CALENDAR)&STR([)&SUBSTR(2:021,&STR(&CALENDAR4))
SET CALENDAR = &STR(&CALENDAR)&STR([)&SUBSTR(2:021,&STR(&CALENDAR5))
SET CALENDAR = &STR(&CALENDAR)&STR([)&SUBSTR(2:021,&STR(&CALENDAR6))
SET CALENDAR = &STR(&CALENDAR)&STR([)&SUBSTR(2:021,&STR(&CALENDAR7))
SET CALENDAR = &STR(&CALENDAR)&STR([)&SUBSTR(2:021,&STR(&CALENDAR8))

/* Display panel with calendar area */
ISPEXEC DISPLAY PANEL(PCAL01)

END

2) This component is the panel definition.
  –  Copy-paste and save the following PANEL as xxxxxxxx.ISPPLIB(PCAL01): (ISPF panel library) 
  Note: Your editor needs access to all 80 columns for this copy-paste operation.

)ATTR                                                                           
/* % TYPE(TEXT) INTENS(HIGH) defaults displayed for */
/* + TYPE(TEXT) INTENS(LOW) information only */
/* _ TYPE(INPUT) INTENS(HIGH) CAPS(ON) JUST(LEFT) */
+ TYPE(TEXT) INTENS(LOW) SKIP(ON) COLOR(GREEN)
% TYPE(TEXT) INTENS(HIGH) SKIP(ON) COLOR(WHITE)
^ TYPE(TEXT) INTENS(LOW) SKIP(ON) COLOR(YELLOW)
_ TYPE(INPUT) INTENS(LOW) JUST(LEFT) COLOR(TURQ)
} TYPE(OUTPUT) INTENS(LOW) JUST(RIGHT)
* AREA(DYNAMIC) SCROLL(ON)
[ TYPE(DATAOUT) INTENS(LOW) COLOR(GREEN)
)BODY WIDTH(&ZSCREENW) EXPAND(//)
%---------------------- Sample Menu for CALENDAR Demo --------------------------
%OPTION ===>_ZCMD +
% %USERID - &ZUSER +
% 0 +MENU1 -^Menu option 1 not operational %TIME - &ZTIME +
% 1 +MENU2 -^Menu option 1 not operational %TERMINAL - &ZTERM +
% %PF KEYS - &ZKEYS +
% %DATE - &ZDATE +
% %- &ZJDATE +
% This menu is for demo purposes only and has %SYSTEM -^&ZSYSID +
% minimal definition. %TSO-PROC -^&ZSYSPROC
% %PANEL - &ZPANELID
% %APPLID - &ZAPPLID+
% %TermSize}z }z ++
% +
% *CALENDAR *+
% Notice the calendar * *+
% display here ---------> * *+
% * *+
% 8 rows, 21 byte row length * *+
% * *+
% * *+
% * *+
% +
+ %PF3+END +
)INIT
.ZVARS = '(ZSCREEND ZSCREENW)'
)PROC
)END  

3) From your TSO command line, type %CCAL01, press <ENTER>.
  –  The following panel will display.

 ---------------------- Sample Menu for CALENDAR Demo -------------------------
OPTION ===>
USERID - LARRY01
0 MENU1 - Menu option 1 not operational TIME - 20:54
1 MENU2 - Menu option 1 not operational TERMINAL - 3277
PF KEYS - 0012
DATE - 11/05/20
- 20.132
This menu is for demo purposes only and has SYSTEM - BSP1
minimal definition. TSO-PROC - ISPLGN00
PANEL - PCAL01
APPLID - ISP
TermSize 0056 0090

___DECEMBER 2018____
Notice the calendar S M T W T F S
display here ---------> . . . . . . 1
2 3 4 5 6 7 8
8 rows, 21 byte row length 9 10 11 12 13 14*15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31

PF3 END  

4) Congratulations!  You completed this demonstration successfully.

Some data manipulation was required to place the appropriate attribute value and yield the correct colorization on the calendar, green.  Refer to the CLIST where the left bracket ([) is being placed in the beginning position of each calendar row as a screen attribute. 

Consult an ISPF Dialog Management Services manual for a detail description of an ISPF services (e.g. panel definitions).

In the next post, new attributes and additional data manipulation will be discussed resulting in a more colorful calendar display as shown below:

1...5....0....5....0....
___DECEMBER 2018____
S M T W T F S
. . . . . . 1
2 3 4
5 6 7 8
9 10 11
12 13 14 15
16 17 18
19 20 21 22
23 24 25
26 27 28 29
30 31

Stay tuned! 

 

Closing

Please use the comment box below or the contact us link on the menu bar to communicate any suggestions, improvements, corrections or issues regarding this post.

Thank You.

Tagged ,

Leave a Reply

Your email address will not be published. Required fields are marked *


CAPTCHA Image
Reload Image

This site uses Akismet to reduce spam. Learn how your comment data is processed.