Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Has anyone used COBOL with MVS ISPF dialog manager 4

Status
Not open for further replies.

dallasdino

Programmer
Nov 27, 2002
28
US
Has anyone done a lot of programing using ISPF Dialog manager panels called from COBOL.

I am in the process of creating a number of panels for some specific business applications used in our testing group as well as some general technical productivity enhancers. I plan to add to these and keep the core panels with me during all my consultant assignments.

Has anyone set up a number of panels called from COBOL. I have some books that I will be following but I am wondering the pros and cons of using COBOL verses CLIST, verses REXX, verses JCL skeletons.

I am a good applications assembler and COBOL programmer and have done a little CLIST and panels in the distant past but I want to create business application and technical productivity enhancement tools to use every day. The goal here is to enhance the ability of lesser trained individuals and help productivity of the others.

Any pointer in the design stage? I plan on getting these up and running this week.
 
Hi,

The source you need to make COBOL programs working with ISPF is available when you use the MODEL command.

If you are in an edit session on the mainframe, you put an a on a line, the a that means After and on the commandline you give the command MODEL. What happens depends on the profile you are working with. You can see the profile on the mainframe by giving the command PROF 10 in your edit session. You get the name of the profile and all its properties. If you have a known profile for MODEL, like COBOL, CLIST or something like that, you can choose one of the models to do something with ISPF for that language. If you have an unknown profile, you can first choose the language of your choice.

To change the profile, you can give the command:

PROF FUNNY

Now you will work with profile FUNNY.

You put an 'a' on the first edit line and you give the command MODEL on the commandline. Now you can choose the language you need and also compare them.

If you choose a model, it is copied into your edit session. It gives lots of ==NOTE== lines, which are away if you give the command RESET. If you want to keep the notes, give the line command MD on it. The linecommand MD means Make Data and the ==NOTE== line will change into a line of data.

I made my first ISPF/COBOL program in 1984. There were no manuals available to me at that time but the ISPF help and the MODEL source gave me all I need.

I guess it will help you also a lot.

Regards,

Crox
 
Before you begin a new project, perhaps you'de have the decency to report on the status of the previous project since there were many here that took the time and expended the effort to attempt to help.

Jack
 
Hi Dallas,
Jack (Slade) has a good point. Feedback on previous threads is always good, and always welcome. If you've left a thread hanging, it's always good to end it, by saying 'I fixed it thus...'

Anyway, I've written quite a lot of programs in COBOL that use ISPF dialog manager, and I've also done quite a bit with CLISTs. I've done a little REXX, but (being a Dino myself) have never really got round to upgrading to REXX from CLISTs.

CLISTs (and I guess REXX) are very useful when you want to knock up something very quickly, that is prone to change, as they can very easily be changed and tested at the touch of a button. Where they fall down is when you wish to process comp/comp-3 or decimal place fields. Accepting data from panels in these formats is nigh on impossible in a CLIST (usual proviso.... unless someone knows different).

COBOL (as usual) is superb at processing this sort of stuff. You can knock up test harnesses, job submission suites and proper systems, that use ISPF dialog panels and file tailoring skeletons (ncluding JCL) very easily. Reading thru files and displaying their values is easy too.

Crox is giving you a very good pointer with the MODEL command, which if you are short of manuals will be a real help.

You need to think about what you are attempting to achieve at this early stage, and if necessary, get back to us with further questions once you have firmed up your requirements. Needless to say, I/Crox will be able to provide you with examples if you're stuck, but I think that you need to examine your basic need first.

HTH
Marc
 
Hey guys,

I did reply to my last solution so I am not sure what the beef is about. Here it is below. I do appreciate the help. I am not sure of the remarks from Slade. He sounds a little cranky today. I will be using this panel to call the smart compare among other things.

In any case I have a read/write program written in assembler that clearly shows how to get the input format and LRECL. It essentially does what SORT=COPY does for simple QSAM files. I am about 90% done writing the smart compare program in assembler. (I decided that I would just do this all in assembler but I have the ability to call COBOL now that I have it working.)

This smart compare has the following desirable features.
1. Key start/length provided to program for adds/deletes
2. OMIT columns provided allowed to prove you only changed thos columns
3. New file in
4. Old file in
5. Adds file out same length as new file
6. Deletes file out the same length as new file
7. Compare OMIT file (like compare file but omits columns in compare)
8. Compare file out 10 bytes longer than input with a 10 byte header showing 7 bytes of a record count and a new/old indicator with only the miscompared characters shown on the old file line and * under those characters for an easy read.
Code:
0000022 N MISCOMPARE   YYY
0000024 O NOT        XXX
        * ***        OOOOO
9. Smart compares are done by adding an omit card. This allows the omit columns to be omitted for compare purposes. This is enter by control card of omit or include. This card is optional.
Code:
OMIT    00012,00005

The whole premise here is to prove a file change by compare. After a file fix if you expected to change the customer code on the master file for 100 accounts a before and after download would be done and the key and omit card supplied to the program. Your expected results would be that there was 100 miscompares but zero would be in the omit file. This proves you change what you wanted but also importantly proves you did not truncate all the records you updated for instance. This is soimetimes overlooked in testing.

The assembler version of this program does a couple of things that the COBOL version did not. The assembler version allows the input file to be any length. This allows you to omit a reformatting step to a particular length of file that the COBOL version required. The omit table built is not limited by a value imposed like 4096 and can always be the same as the input file. While this is little limitation it does make the utility more general purpose.

Here is the code needed for getting the input file attirbutes and setting an output file to the same attributes as an input file. If someone needs a general use program called from COBOL I would be happy to provide one. As you can see the format and LRECL can be gotten easily from the DCB after the input file is open but before it is read.
Code:
         OPEN  (IFILE,INPUT)           OPEN INPUT TO GET ATTRIBUTES
         MVC   OFILE+36(1),IFILE+36    MOVE THE FORMAT INPUT TO OUTPUT
*                                      V=X'40',VB=X'50,F=X'80',FB=X'90'
         MVC   OFILE+82(2),IFILE+82    MOVE THE LRECL  INPUT TO OUTPUT
*                                      (RECORD LENGTH IS A HALF WORD)
         OPEN  (OFILE,OUTPUT)          OPEN OUPUT WITH INPUT ATTRIBUTES

IFILE    DCB   DSORG=PS,MACRF=GL,DDNAME=IFILE,EODAD=EOFI
OFILE    DCB   DSORG=PS,MACRF=PL,DDNAME=OFILE
Thanks for everyone pointing me in the right direction. Yak back if you want a copy of the finished program of anything you have seen me post.
 
Hi,

I recall that the last time I wrote a COBOL program that used the Dialogue Manager it was a real pain to synchronize the storage structures that maintain the 'bindings' between the COBOL program and the ISPF variable pools.

Is there an easier way of doing this?

I resorted to prototyping the application in REXX and then re-coding in COBOL.

Stoggers.
 
Hi all,
I've written a number of these beasts over the years and must admit that I always have trouble linking the variable names in the Cobol with those in the panel and Dialog Manager. I recall that it's a little odd, but once that it's been cracked within the program, it's just a case of repeating it ad hoc. I'm sure I could find a listing lying about somewhere if anyone was interested.
Marc
 
I am interested in anything you have as examples and any pointers. I successfully called a COBOL program from a CLIST that displayed a panel but I did not pass any parms yet. I have created a number of panels and tested them. I am an experienced programmer in COBOL but am a novice at using COBOL with ISPF so any help is appreciated.

I plan on making a number of panels to simplifying some tasks in the testing group. Some of these will execute JCL and some will be more interactive. I will use this exercise to also simplify routine tasks like creating cobol shell programs, doing smart compares, using sort in various ways, create select jobs, and several other ideas. Hopefully I can make 50-100 useful panels that I can use throughout the rest of my mainframe career.
 
Hi Dallas,
I found a program that we used as a test harness and I've cut it down so that it is manageable here. The program displays a main menu and thens performs another section which displays a further panel and then calls a subroutine. This can be hacked about to do other things as required.

A few things which migtht make it clearer:

1st panel displayed has only one 2 byte field on it called CHOICE. This is your typical list of options main menu.

The 2nd panel has two fields and validation in the panel to ensure that only one of them are entered. These are date fields in different formats. A cobol subroutine is called to pass back the date in the opposite format.

I've tried to make it as clear as possible without being too verbose. Let me know if there's anything needs further explanation.

IDENTIFICATION DIVISION.
PROGRAM-ID. ISPFPROG.
*
* TEST HARNESS USING ISPF DIALOG MANAGER
*
* 1. DISPLAYS A SCREEN WHICH LISTS ALL THE OPTIONS AND REQUIRES
* A SELECTION TO BE MADE, OR PF3 TO EXIT
* 2. DEPENDING ON THE OPTION CHOSEN, DISPLAYS A SCREEN REQUESTING
* THE INPUT FOR THE SPECIFIC PROGRAM OR PF3 TO EXIT
* 3. CALLS THE CHOSEN PROGRAM AND DISPLAYS THE DATA RETURNED
*
DATA DIVISION.
WORKING-STORAGE SECTION.
* ISPF SERVICES
01 VDEFINE PIC X(8) VALUE 'VDEFINE '.
01 VPUT PIC X(8) VALUE 'VPUT '.
01 VGET PIC X(8) VALUE 'VGET '.
01 PDISPLAY PIC X(8) VALUE 'DISPLAY '.
* FIELD TYPES AND LENGTHS
01 CHAR PIC X(8) VALUE 'CHAR '.
01 L2 PIC 9(6) VALUE 2 COMP.
01 L6 PIC 9(6) VALUE 6 COMP.
01 L10 PIC 9(6) VALUE 10 COMP.
* OTHER PARAMETERS
01 PANELID PIC X(8) VALUE SPACE.
01 ASIS PIC X(8) VALUE 'ASIS '.
01 PF3-PRESSED PIC X VALUE SPACE.
01 ERROR-FOUND PIC X VALUE SPACE.
* MAINMENU PANEL VARIABLES
01 VCHOICE PIC X(6) VALUE 'CHOICE'.
* CHOICE 1 PANEL VARIABLES
01 VHPSDB2.
03 FILLER PIC X(50) VALUE
'(DB2DATE HPSDTE)'.
01 VDB2DATE PIC X(7) VALUE 'DB2DATE'.
01 VHPSDTE PIC X(6) VALUE 'HPSDTE'.
* WS PANEL VARIABLES
01 WS-PANEL-VARIABLES.
* WS MAINMENU PANEL VARIABLES
03 CHOICE PIC X(2) VALUE SPACES.
* WS CHOICE 1 PANEL VARIABLES
03 DB2DATE PIC X(10) VALUE SPACES.
03 HPSDTE PIC 9(6) VALUE 0.
* DATECONV VARIABLES
01 WS-DATE.
03 WS-HPS-DATE PIC S9(8) COMP.
03 WS-OUTPUT-DB2-DATE PIC X(10) VALUE SPACES.

PROCEDURE DIVISION.
MAIN-CONTROL SECTION.
******************************************************************
* CONTROL SECTION. *
* DEFINES VARIABLE, AND DISPLAYS INITIAL MENU *
* UNTIL PF3 KEY IS PRESSED TO EXIT *
******************************************************************
CALL 'ISPLINK' USING VDEFINE VCHOICE CHOICE CHAR L2.
IF RETURN-CODE NOT = 0
DISPLAY 'VDEFINE ERROR, RETURN CODE IS: ' RETURN-CODE
GO TO MAIN-EXIT
END-IF.

MOVE 'N' TO PF3-PRESSED.
MOVE 'N' TO ERROR-FOUND.

PERFORM A-DISPLAY-INITIAL
UNTIL PF3-PRESSED = 'Y'
OR ERROR-FOUND = 'Y'.

MAIN-EXIT.
STOP RUN.
A-DISPLAY-INITIAL SECTION.
******************************************************************
* DISPLAYS THE PANEL, GETS THE SELECTION, AND PROCESSES *
******************************************************************
* DISPLAY THE PANEL
MOVE 'MENUPANL' TO PANELID.
CALL 'ISPLINK' USING PDISPLAY PANELID.
* PF3 SETS RETURN-CODE TO 8
IF RETURN-CODE = 8
MOVE 'Y' TO PF3-PRESSED
ELSE
IF RETURN-CODE NOT = 0
DISPLAY 'ERROR ON DISPLAY. RETURN CODE IS:' RETURN-CODE
MOVE 'Y' TO ERROR-FOUND
ELSE
* GET THE CHOICE ENTERED
CALL 'ISPLINK' USING VGET VCHOICE ASIS
IF RETURN-CODE NOT = 0
DISPLAY 'VGET ERROR RETURN CODE IS: ' RETURN-CODE
MOVE 'Y' TO ERROR-FOUND
ELSE
* LOOK AT THE CHOICE, AND PERFORM RELEVANT SECTION, LOOPING
* UNTIL PF3 IS ENTERED
EVALUATE CHOICE
WHEN '1'
PERFORM AA-CHOICE1
UNTIL PF3-PRESSED = 'Y'
OR ERROR-FOUND = 'Y'
MOVE 'N' TO PF3-PRESSED
END-EVALUATE
END-IF
END-IF
END-IF.
A-EXIT.
EXIT.
AA-CHOICE1 SECTION.
******************************************************************
* DEFINE THE VARIABLES USED ON THE CHOICE1P PANEL *
******************************************************************

CALL 'ISPLINK' USING VDEFINE VDB2DATE DB2DATE CHAR L10.
IF RETURN-CODE NOT = 0
DISPLAY 'VDEFINE ERROR DB2DATE RET CODE IS: ' RETURN-CODE
MOVE 'Y' TO ERROR-FOUND
GO TO AA-EXIT
END-IF.

CALL 'ISPLINK' USING VDEFINE VHPSDTE HPSDTE CHAR L6.
IF RETURN-CODE NOT = 0
DISPLAY 'VDEFINE ERROR HPSDTE RET CODE IS: ' RETURN-CODE
MOVE 'Y' TO ERROR-FOUND
GO TO AA-EXIT
END-IF.
* INITIALISE THE VARIABLES AND PUT THEM IN THEIR PLACE
INITIALIZE WS-PANEL-VARIABLES.
CALL 'ISPLINK' USING VPUT VHPSDB2 ASIS
IF RETURN-CODE NOT = 0
DISPLAY 'ERROR ON VPUT HPSDB2 RET CODE IS:' RETURN-CODE
MOVE 'Y' TO ERROR-FOUND
ELSE
* ALL VARIABLES HAVE BEEN DEFINED, NOW LOOP ROUND DISPLAYING THE
* PANEL UNTIL USER PRESSES PF3 TO EXIT
PERFORM AAA-DISPLAY-CHOICE1P
UNTIL PF3-PRESSED = 'Y'
END-IF.

AA-EXIT.
EXIT.
AAA-DISPLAY-CHOICE1P SECTION.
******************************************************************
* DISPLAYS THE PANEL, GETS THE INPUT, CALLS THE RELEVANT DATE *
* PROG AND RE-DISPLAYS THE PANEL WITH THE OUTPUT ON IT *
******************************************************************
MOVE 'CHOICE1P' TO PANELID
CALL 'ISPLINK' USING PDISPLAY PANELID
IF RETURN-CODE = 8
MOVE 'Y' TO PF3-PRESSED
ELSE
IF RETURN-CODE NOT = 0
DISPLAY 'ERROR ON DISPLAY. RETURN CODE IS:' RETURN-CODE
MOVE 'Y' TO ERROR-FOUND
ELSE
* GET THE VARIABLES
CALL 'ISPLINK' USING VGET VHPSDB2 ASIS
IF RETURN-CODE NOT = 0
DISPLAY 'ERROR ON VGET HPSDB2 RT CODE IS:' RETURN-CODE
MOVE 'Y' TO ERROR-FOUND
GO TO AAA-EXIT
END-IF
* MOVE THE FIELDS IN
INITIALIZE WS-DATE
IF DB2DATE = SPACES
*DB2 DATE = SPACES THEN HPSDATE MUST HAVE BEEN ENTERED
MOVE HPSDTE TO WS-HPS-DATE
CALL 'DATECONV'
USING WS-DATE
ELSE
*DB2 DATE NOT = SPACES
MOVE DB2DATE TO WS-OUTPUT-DB2-DATE
CALL 'DATECONV'
USING WS-DATE
END-IF
* MOVE THE FIELDS TO THE DISPLAY
MOVE WS-OUTPUT-DB2-DATE TO DB2DATE
MOVE WS-HPS-DATE TO HPSDTE
* PUT THE VARIABLES ON TO PANEL
CALL 'ISPLINK' USING VPUT VHPSDB2 ASIS
IF RETURN-CODE NOT = 0
DISPLAY 'ERROR ON VPUT HPSDB2 RT CODE IS:' RETURN-CODE
MOVE 'Y' TO ERROR-FOUND
GO TO AAA-EXIT
END-IF
END-IF
END-IF.

AAA-EXIT.
EXIT.
 
Thanks for the code. I will be checking this out this week. I am sure this will help me get going.

Super !!!

I will let you know how it goes.
 
Don't forget, that if you find somebody's post to be of use, it's always nice to mark it as helpful!
 
With your help and the examples I had started I have sucessfully passed the input back and forth to the COBOL program.

I am getting a return code 8 on the VGET although it seems to be returning the values fine. I am going to try to track that down. I will post the test stub I came up with as soon as soon I polish it a bit.

Thanks,

Alfred
 
Hi Alfred,
If the data is comng frm a panel, try a VPUT in the panel before exiting. This may solve it.
Marc
 
I used to work for a company that developed a major software product based on the ISPF Dialog Manager. We developed our own interpreted language to interface with the Dialog Manager - it used ISPF variables as its native variables. COBOL is the wrong language to use for this. You will run into problems if you invoke the programs simultaneously on both sides of a split screen.
For syntax, the MODEL command suggestion was a good one - not many people even know of its existence. This feature will also give you the return codes from each command.
The IBM manuals also contain a mountain of information about the complexity and intricacies of the Dialog Manager.
 
Gaz,
Got to disagree with you as I've used Cobol to write programs that interface successfully with ISPF Dialog Manager. I seem to recall that these were proper business applications and therefore would not be running alongside other apps. I think we prorgammed the pf keys for the apps own usage, and disabled split screen
Marc
 
I think I have what I need for this project but I might revist this whole issue as I add some more features to the ISPF panels.

Thanks Gazolba for the tip. I think I can do this one either way and I was really looking for a quick and dirty but if you have a skeleton example it sounds like you have a good idea when I revist more productivity examples.

 
Has anyone here used lminit to create a temp work dataset within the dialog from a cobol program? If so do you have an example of the ISPLINK LMINIT call?

Thanks.
 
RE: calling a cobol program from a clist and passing parm, here's an example:

RUN PROGRAM(BLAHBLAH) PLAN(BLAHBLAH) PARM('&SYSUID') +
LIBRARY('BLAH.BLAH.LOAD')
 
Hi MC9,
I've used LMINIT, but not in the way you have described. I think that I have used it when I've wanted to do things such as display the standard member list of a PDS, from within a Cobol/ISPF program.

By the way (no criticism intended) you're RUN PROGRAM etc. is only valid for a DB2 program. For a standard Cobol program, you'd just call the load module/library direct.
Marc
 
You are right. I should have mentioned that 'run program' was for a DB2 program.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top