0

I want to display an ispf panel with a cobol program. With REXX is easy, no problems, but with cobol is not showing the panel. When I submit the jcl, the compile and link step gives no errors but when it try to run an error is received: MAXCC=0020. In the jesysmsg I found

...
IEF236I ALLOC. FOR CBLMINE STEP2                                               
IGD103I SMS ALLOCATED TO DDNAME STEPLIB                                        
IEF237I JES2 ALLOCATED TO SYSOUT                                               
IEF237I DMY  ALLOCATED TO CEEDUMP                                              
IEF237I DMY  ALLOCATED TO SYSUDUMP                                             
IEF142I CBLMINE STEP2 - STEP WAS EXECUTED - COND CODE 0020                     
IGD104I Z30952.PATO RETAINED,DDNAME=STEPLIB 
IEF285I   Z30952.CBLMINE.JOB04408.D0000103.?           SYSOUT                  
...

According with the IBM manual the error is: ERROR. I/O error writing to update file, FILEDEF missing, or APNDUPD process option cancelled because of inconsistent file attributes. Any practical help (with an example please)?

With an ispf panel :

)ATTR DEFAULT(+_%)                                                      
% TYPE(TEXT) COLOR(PINK) INTENS(HIGH)                                 
$ TYPE(INPUT) INTENS(HIGH) PAD(_)                                     
! TYPE(INPUT) INTENS(LOW) PAD(' ') 
)BODY                                                                   
%-------------------- *TITLE FOR ENTRY PANEL* --------------------------
%COMMAND ===>_ZCMD                                                      
%                                                                       
&ZUSER    &ZTIME             &ZSCREEN    &ZWIDTH  &ZUS4S7               
+   THIS DIRECTION LINE TELLS THE USER HOW TO USE THE PANEL:            
%XXXXX:_X     %YYY:$YYY          %ZZZ:$ZZ%AAAAAAAA:$AAAAAAAA  +         
)END

With a cobol program:

   IDENTIFICATION DIVISION.                             
   PROGRAM-ID.    CBLEX003                              
   ENVIRONMENT DIVISION.                                
   DATA DIVISION.                                       
   WORKING-STORAGE SECTION.                             
   77 PST1 PIC X(6) VALUE 'LIBDEF'.                     
   77 PST2 PIC X(7) VALUE 'ISPPLIB'.                    
   77 PST3 PIC X(7) VALUE 'DATASET'.                    
   77 PST4 PIC X(15) VALUE 'Z30952.MINE.GML'.           
   77 PST5 PIC X(16) VALUE 'DISPLAY PANEL01'.           
   77 ISPLINK PIC X(7) VALUE 'ISPLINK'.                 
   PROCEDURE DIVISION.                                  
       CALL ISPLINK USING PST1 PST2 PST3 PST4.          
       CALL ISPLINK USING PST5.                         
       STOP RUN.                                        

With a jcl:

//CBLMINE  JOB 1,NOTIFY=&SYSUID,MSGLEVEL=(1,1)                       
//SETVAR   SET THEPGM=CBLEX003                                       
//SETVAR   SET WHERES=&SYSUID..MINE.GML                              
//SETVAR   SET LINKRU=&SYSUID..PATO                                  
//COBRUN   EXEC IGYWCL                                               
//COBOL.SYSIN  DD DSN=&WHERES(&THEPGM),DISP=SHR                      
//LKED.SYSLMOD DD DSN=&LINKRU(&THEPGM),DISP=SHR                      
// IF RC = 0 THEN                                                    
//STEP2    EXEC PGM=&THEPGM                                          
//STEPLIB   DD DSN=&LINKRU,DISP=SHR                                  
//SYSOUT    DD SYSOUT=*,OUTLIM=15000                                 
//CEEDUMP   DD DUMMY                                                 
//SYSUDUMP  DD DUMMY                                                 
// ELSE                                                              
// ENDIF        

2 Answers2

5

If you want to use ISPF services like ISPLINK you must execute in an ISPF environment. IBM's documentation provides an example here, reproduced below.

//USERAA JOB (AA04,BIN1,000000),'I. M. USERAA',
// CLASS=L,MSGCLASS=A,NOTIFY=USERAA,MSGLEVEL=(1,1)
//*-------------------------------------------------------*/
//*  EXECUTE ISPF COMMAND IN THE BACKGROUND               */
//*-------------------------------------------------------*/
//*
//ISPFBACK EXEC PGM=IKJEFT01,DYNAMNBR=25,REGION=1024K
//*- - ALLOCATE PROFILE, PANELS, MSGS, PROCS, AND TABLES -*/
//ISPPROF  DD DSN=USERAA.ISPF.PROFILE,DISP=OLD
//ISPPLIB  DD DSN=ISP.SISPPENU,DISP=SHR
//ISPMLIB  DD DSN=ISP.SISPMENU,DISP=SHR
//ISPSLIB  DD DSN=ISP.SISPSENU,DISP=SHR
//         DD DSN=ISP.SISPSLIB,DISP=SHR
//ISPTLIB  DD DSN=USERAA.ISPF.TABLES,DISP=SHR
//         DD DSN=ISP.SISPTENU,DISP=SHR
//         DD DSN=ISP.SISPTLIB,DISP=SHR
//ISPTABL  DD DSN=USERAA.ISPF.TABLES,DISP=SHR
//*
//*- - ALLOCATE ISPF LOG DATA SET  - - - - - - - - - - - -*/
//ISPLOG   DD DSN=USERAA.ISPF.LOG,DISP=SHR
//*
//*- - ALLOCATE DIALOG PROGRAM AND TSO COMMAND LIBRARIES -*/
//ISPLLIB  DD DSN=USERAA.ISPF.LOAD,DISP=SHR
//SYSEXEC  DD DSN=ISP.SISPEXEC,DISP=SHR
//SYSPROC  DD DSN=ISP.SISPCLIB,DISP=SHR
//*
//*- - ALLOCATE TSO BACKGROUND OUTPUT AND INPUT DS - - - -*/
//SYSTSPRT DD DSNAME=USERAA.ISPF.ISPFPRNT,DISP=SHR
//SYSTSIN  DD *
  PROFILE PREFIX(USERAA)         /* ESTABLISH PREFIX      */
  ISPSTART CMD(%TBUPDATE)        /* INVOKE CLIST DIALOG   */
/*

You must supply a valid jobcard and the correct ISPF library concatenations for your shop. Also, I believe you would use ISPSTART PGM(CBLEX003) instead of what the IBM sample has for starting a CLIST.

If you don't know your shop's ISPF library concatenations, you can probably determine them from what is displayed by the ISRDDN command from any ISPF command line.

There is also an ISPF Dialog Test facility, usually on the main ISPF menu. You can use this to test your panel.

cschneid
  • 10,237
  • 1
  • 28
  • 39
  • 1
    Unless things have changed, you will have trouble displaying a ispf panel in a batch job – Bruce Martin Mar 03 '19 at 05:29
  • 1
    @BruceMartin IBM supplies documentation for [Batch display facility for background panel processing](https://www.ibm.com/support/knowledgecenter/SSLTBW_2.3.0/com.ibm.zos.v2r3.f54dg00/ispdg53.htm), but I agree it's a bit odd to want to do that. – cschneid Mar 03 '19 at 14:11
  • @cschneid The isplink and ispexec are in the isp.sispload library. How to include it in the link action could be a solution? – Higinio Fuentes Mar 04 '19 at 02:00
  • 1
    @HiginioFuentes your COBOL program as you show it in your question is making a dynamic call to the ISPLINK routine, so it will be resolved at runtime. If the isp.sispload library isn't in LPA or the linklist then you must include it in the STEPLIB for your job step or the JOBLIB for your job. – cschneid Mar 04 '19 at 04:47
  • @cschneid Yes, the dynamic call is used when I use the 77 ISPLINK PIC X(7) VALUE 'ISPLINK'. and the CALL ISPLINK USING PST5. Or I can use the CALL "ISPLINK" USING PST5. if I add before the line identification division. an instruction like PROCESS DYNAM Both combination options together or alone will return code 0 when compiling and linking otherwise it gives a return code 12. – Higinio Fuentes Mar 05 '19 at 01:15
  • @cschneid May I ask how to add the ISP.SISPLOAD in the STEPLIB? Because I add after the //STEPLIB DD DSN=&LINKRU,DISP=SHR the line //ISPLINK DD DSN=ISP.SISLOAD,DISP=SHR and I have return code=12 when tried to run – Higinio Fuentes Mar 05 '19 at 01:48
  • 1
    If you do not know how to concatenate data sets and you are trying to execute an interactive panel in batch then I would suggest that you are in way over your head and need to do some basic learning. There is no way to interact with the panel in batch - you are running in a batch environment not an interactive environment. To learn how to concatenate data sets look in the JCL User Guide manual. – NicC Mar 05 '19 at 12:38
  • 1
    @HiginioFuentes I think you would be best served asking for help from your coworkers on this latest question. – cschneid Mar 05 '19 at 15:46
  • @cschneid I would like to do so, but I'm an old curious doing self training. This is the reason I'm asking so many questions ;) – Higinio Fuentes Mar 14 '19 at 01:43
  • @NicC I know how to call a panel and interact with it in REXX (with no jcl routine). What I'm trying to do is to call and show a panel from a cobol program. In an IBM i is pretty simple. In a mainframe seems to be a very secret stuff! – Higinio Fuentes Mar 14 '19 at 01:51
3

I agree with what Bruce and cschneid have been stating. You can not invoke an ISPF service from a COBOL pgm using JCL unless the JCL is running ISPF in batch mode as in the example provided by cschneid. Without the ISPF environment ISPLINK will set rc=20 because it can not find an ISPF environment. Test your program via ISPF option 7 or write an exec to run it where you LIBDEF ISPLLIB to point at the load library containing your linked COBOL pgm.

address ISPEXEC
"LIBDEF ISPLLIB DATASET ID('userid.TEST.LOAD')"
"SELECT PGM(mycbl)"
"LIBDEF ISPLLIB"

You would normally not run a DISPLAY service via batch as you have been advised. It can be done by supplying all the values for the panel fields and then simulating an ENTER or END with the CONTROL service, but it would be easy to get in a DISPLAY loop if not careful.

Marv Knight
  • 416
  • 2
  • 4
  • Thank you for your explanations. In the ispf option 7.6, I tried LIBDEF ISPLLIB DATASET ID('userid.TEST.LOAD') and I receive the correct rc=0. When I try the SELECT PGM('mycbl') I received rc=0 but nothing shows up. Any idea? – Higinio Fuentes Mar 14 '19 at 02:03
  • 1
    Try setting breakpoints on the LIBDEF and DISPLAY service using 7.8 and run the program from 7.1. This will let you see what was actually passed to the service as parameters. I would be suspicious of the parameters on the service. They are not padded to 8 characters with a trailing space. The breakpoints will show if the ISPF service was called correctly. – Marv Knight Mar 15 '19 at 10:28