| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Troodon Beginner
 
 
 Joined: 10 Sep 2004
 Posts: 9
 Topics: 4
 Location: Johannesburg, Gauteng, South Africa
 
 | 
			
				|  Posted: Fri Jan 07, 2005 8:01 am    Post subject: Invoking ISPF Services from a Batch COBOL Program |   |  
				| 
 |  
				| I am trying to invoke the LMINIT service inside a batch COBOL Program, but am getting a return code of 20. Can anyone help. 
 EG. of Code:
 
 Working storage.
 
 77 isp-isplink                  Pic  x(8)  value 'ISPLINK'.
 77 isp-lminit                   Pic  x(8)  value 'LMINIT '.
 77 isp-dataid                   Pic  x(8)  value low-values.
 77 isp-ddname                   Pic  x(8)  value 'PDSINP'.
 77 isp-shr                      pic  x(8)  value 'SHR'.
 
 Procedure Division.
 
 call isp-isplink using isp-dataid isp-ddname isp-shr
 end-call
 
 if return-code = 0
 display 'PDSLIST: LMINIT passed'
 else
 display 'PDSLIST: LMINIT failed'
 display 'PDSLIST: return code =<' return-code '>'
 stop run
 end-if
 
 exit
 .
 
 eg of JCL:
 
 //FLP01#01 EXEC PGM=PDSLIST
 //STEPLIB  DD DISP=SHR,DSN=????????.TEST.LINKLIB
 //PDSINP   DD DISP=SHR,DSN=MY.PDS
 //SYSABOUT DD SYSOUT=*
 //IAMINFO  DD SYSOUT=*
 //SYSDBOUT DD SYSOUT=*
 //SYSPRINT DD SYSOUT=*
 //SYSUDUMP DD SYSOUT=*
 //ABENDAID DD SYSOUT=*
 //SYSPUNCH DD SYSOUT=*
 //SYSPRT   DD SYSOUT=*
 //SYSTSIN  DD DUMMY
 //SYSTSPRT DD SYSOUT=*
 //*
 
 Output from running pgm:
 
 PDSLIST: LMINIT failed
 PDSLIST: return code =<00020>
 
 Thank's
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Fri Jan 07, 2005 9:08 am    Post subject: |   |  
				| 
 |  
				| Troodon, 
 You are missing the ISP-LMINIT in your call.
 
 Change your call from
 
 
  	  | Quote: |  	  | call isp-isplink using isp-dataid isp-ddname isp-shr
 
 | 
 
 to
 
 
  	  | Code: |  	  | call isp-isplink using [b]isp-lminit[/b] isp-dataid isp-ddname isp-shr
 
 | 
 
 Hope this helps...
 
 Cheers
 
 kolusu
 _________________
 Kolusu
 www.linkedin.com/in/kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| superk Advanced
 
  
 Joined: 19 Dec 2002
 Posts: 684
 Topics: 5
 
 
 | 
			
				|  Posted: Fri Jan 07, 2005 9:32 am    Post subject: |   |  
				| 
 |  
				| Maybe it's me, but I don't see where in the JCL a TSO environment is being defined by calling the IKJEFT01 program along with the requisite ISPF libraries, and where ISPF is being enabled with an ISPSTART command prior to the program being called?? |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Troodon Beginner
 
 
 Joined: 10 Sep 2004
 Posts: 9
 Topics: 4
 Location: Johannesburg, Gauteng, South Africa
 
 | 
			
				|  Posted: Mon Jan 10, 2005 2:41 am    Post subject: |   |  
				| 
 |  
				| Kolusu 
 Thanks for pointing out such an obvious stupid error
  . However fixing it did not make a diference. Perhaps I am missing something, but is superk right. To invoke ispservices in a batch cobol program, I must invoke the program through the TSO environment, and then first run an ISPSTART command, before invoking the cobol batch program. Although my ISP liraries are not in the JCL provided, they are in the system libraries, they must be availble or I would be getting an 806 instead of a return code 20.  Since I have never done this before can someone provide an example please _________________
 Man is the universe becoming Conscious of itself.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Troodon Beginner
 
 
 Joined: 10 Sep 2004
 Posts: 9
 Topics: 4
 Location: Johannesburg, Gauteng, South Africa
 
 | 
			
				|  Posted: Mon Jan 10, 2005 3:53 am    Post subject: |   |  
				| 
 |  
				| I have tried executing the COBOL program from option 6 in ISPF in the following way 
 CALL 'my.linklib(PDSLIST)'
 
 And got the following reponse:
 
 ********************************************************************* ISPS107
 *
 * Required parm missing
 * Not all required parameters were found for the LMINIT service.
 *
 
 The COBOL Code looks like this:
 
 77 isp-lminit                   Pic  x(8)  value 'LMINIT'.
 77 isp-dataid                   Pic  x(8)  value space.
 77 isp-ddname                   Pic  x(8)  value 'PDSINP'.
 77 isp-shr                      pic  x(3)  value 'SHR'.
 
 call 'ISPLINK' using
 isp-lminit isp-dataid isp-ddname isp-shr
 end-call
 
 I have allocated the file PDSINP before executing the command succesfully. What am I missing. The manual  says:
 
 Call Invocation Format
 
 CALL ISPLINK (LMINIT, data-id-var
 {,project,group1 [,group2] [,group3] [,group4] ,type}
 {,dsname }
 {,ddname }
 ,[serial] ,[password]
 ,[SHR|EXCLU |SHRW|MOD]
 ,[org-var]);
 
 From this the only required prameters are LMINIT, data-id-var, one of (project etc, dsname,ddname)
 
 What am I missing
  _________________
 Man is the universe becoming Conscious of itself.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Phantom Data Mgmt Moderator
 
  
 
 Joined: 07 Jan 2003
 Posts: 1056
 Topics: 91
 Location: The Blue Planet
 
 | 
			
				|  Posted: Mon Jan 10, 2005 7:36 am    Post subject: |   |  
				| 
 |  
				| Troodon, 
 The problem is due to the difference b/w Batch & Online.  When u invoke ur cobol program thru' option 6 - Online, it uses all the ISPF libraries that are already allocated during ur login.  But when u invoke ur cobol program via JCL - Batch you need to allocate these ISPF libraries manually.  Hope I'm clear.
 
 You need to allocate so many datasets (ISPPLIB, ISPMLIB, ISPTLIB, SYSEXEC, .....).  Try the 'Batchpdf' macro provided in the following link. It will create u a JCL with all ISPF allocations.  It reads ur online allocations and replicates the same for batch.
 
 http://www.sillysot.com/ftp/batchpdf.txt
 
 For more details on how to use BATCHPDF, please refer the 3rd post From BOTTOM in the following link.
 http://www.mvsforums.com/helpboards/viewtopic.php?t=2608&highlight=batchpdf
 
 Hope this helps,
 
 Thanks,
 Phantom
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| superk Advanced
 
  
 Joined: 19 Dec 2002
 Posts: 684
 Topics: 5
 
 
 | 
			
				|  Posted: Mon Jan 10, 2005 10:09 am    Post subject: |   |  
				| 
 |  
				| I copied the code from the ISPF COBOL Model for the LMINIT command, and got this as a (working) result: 
 
  	  | Code: |  	  | PROCEDURE DIVISION.
 MOVE "LMINIT  " TO ISPF-SERVICE.
 MOVE "PDSINP  " TO ISPF-DATA-ID.
 MOVE "        " TO ISPF-PROJECT.
 MOVE "        " TO ISPF-GROUP1.
 MOVE "        " TO ISPF-GROUP2.
 MOVE "        " TO ISPF-GROUP3.
 MOVE "        " TO ISPF-GROUP4.
 MOVE "        " TO ISPF-TYPE.
 MOVE "                                                  "
 TO ISPF-DSNAME.
 MOVE "PDSINP  " TO ISPF-DDNAME.
 MOVE "      "   TO ISPF-SERIAL.
 MOVE "        " TO ISPF-PSWD-VALUE.
 MOVE "SHR     " TO ISPF-ENQ-VAR.
 MOVE "        " TO ISPF-ORG-VAR.
 CALL "ISPLINK" USING  ISPF-SERVICE     ISPF-DATA-ID
 ISPF-PROJECT     ISPF-GROUP1
 ISPF-GROUP2      ISPF-GROUP3
 ISPF-GROUP4      ISPF-TYPE
 ISPF-DSNAME      ISPF-DDNAME
 ISPF-SERIAL      ISPF-PSWD-VALUE
 ISPF-ENQ-VAR     ISPF-ORG-VAR.
 
 | 
 It appears that you must code the DATAID field (or you will get a "parameter missing" message), and that you must account for all of the fields.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Troodon Beginner
 
 
 Joined: 10 Sep 2004
 Posts: 9
 Topics: 4
 Location: Johannesburg, Gauteng, South Africa
 
 | 
			
				|  Posted: Wed Jan 12, 2005 2:27 am    Post subject: |   |  
				| 
 |  
				| Thanks folks for your Help I have made use of both the BATCHPDF rexx and the MODEL command to fix my program, However I am now getting a return code 10 from the LMOPEN function. Here are some displays from the program: 
 
  	  | Code: |  	  | PDSLIST: Before LMINIT LMINIT:  ispf-service      =<LMINIT  >
 LMINIT:  ispf-data-id      =<PDSLINP >
 LMINIT:  ispf-project      =<        >
 LMINIT:  ispf-group1       =<        >
 LMINIT:  ispf-group2       =<        >
 LMINIT:  ispf-group3       =<        >
 LMINIT:  ispf-group4       =<        >
 LMINIT:  ispf-type         =<        >
 LMINIT:  ispf-dsname       =<
 LMINIT:  ispf-ddname       =<PDSLINP >
 LMINIT:  ispf-serial       =<      >
 LMINIT:  ispf-pswd-value   =<        >
 LMINIT:  ispf-enq-var      =<SHR     >
 LMINIT:  ispf-org-var      =<        >
 PDSLIST: LMINIT passed
 PDSLIST: return code =<00000>
 LMINIT:  ispf-service      =<LMINIT  >
 LMINIT:  ispf-data-id      =<PDSLINP >
 LMINIT:  ispf-project      =<        >
 LMINIT:  ispf-group1       =<        >
 LMINIT:  ispf-group2       =<        >
 LMINIT:  ispf-group3       =<        >
 LMINIT:  ispf-group4       =<        >
 LMINIT:  ispf-type         =<        >
 LMINIT:  ispf-dsname       =<
 LMINIT:  ispf-ddname       =<PDSLINP >
 LMINIT:  ispf-serial       =<      >
 LMINIT:  ispf-pswd-value   =<        >
 LMINIT:  ispf-enq-var      =<SHR     >
 LMINIT:  ispf-org-var      =<        >
 PDSLIST: before LMOPEN
 LMOPEN:  ispf-service      =<LMOPEN  >
 LMOPEN:  ispf-data-id      =<PDSLINP >
 LMOPEN:  ispf-option1      =<INPUT   >
 LMOPEN:  ispf-data-lenvar  =<        >
 LMOPEN:  ispf-recform      =<        >
 LMOPEN:  ispf-org-var      =<        >
 PDSLIST: LMOPEN failed
 PDSLIST: return code =<00010>
 | 
 It seams to me that although the LMINIT is processing with a 0 return code, it is not establishing the DATA-ID correctly. I have tried using spaces in the DATA-ID with the LMINIT and the LMINIT then fails.
 
 From the Manual I understood that the LMINIT should establish the DATAID, and then the LMOPEN would uses it to open the DDNAME. Please tell me what I am missing
  _________________
 Man is the universe becoming Conscious of itself.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Mervyn Moderator
 
  
 Joined: 02 Dec 2002
 Posts: 415
 Topics: 6
 Location: Hove, England
 
 | 
			
				|  Posted: Wed Jan 12, 2005 6:36 am    Post subject: |   |  
				| 
 |  
				| The DATAID column needs to contain the name of the variable that you want to receive the DATAID value.  You use the VDEFINE service to define this (and any other ISPF variables) to ISPF. 
 I don't have time to expand on this at the moment, but you've now got something to go on, at least.
 _________________
 The day you stop learning the dinosaur becomes extinct
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| superk Advanced
 
  
 Joined: 19 Dec 2002
 Posts: 684
 Topics: 5
 
 
 | 
			
				|  Posted: Wed Jan 12, 2005 6:42 am    Post subject: |   |  
				| 
 |  
				| After the LMINIT command is processed to set the value of the DATA-ID variable, from that point on the value is specified as a variable, in this case &PDSLINP will work. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Mervyn Moderator
 
  
 Joined: 02 Dec 2002
 Posts: 415
 Topics: 6
 Location: Hove, England
 
 | 
			
				|  Posted: Wed Jan 12, 2005 6:56 am    Post subject: |   |  
				| 
 |  
				| I just found this code in an old program.  It'll give you an idea of what I mean: 
 
  	  | Code: |  	  | 
 01  ISPF-NAMES.
 05  NAME-DATABASE     PIC X(8)  VALUE 'DATABASE'.
 05  NAME-COMPCODE     PIC X(8)  VALUE 'COMPCODE'.
 05  NAME-PRODCODE     PIC X(8)  VALUE 'PRODCODE'.
 05  NAME-SCORCODE     PIC X(8)  VALUE 'SCORCODE'.
 05  NAME-SCCTFR       PIC X(8)  VALUE 'SCCTFR  '.
 05  NAME-SCCTTO       PIC X(8)  VALUE 'SCCTTO  '.
 05  NAME-VERSION      PIC X(8)  VALUE 'VERSION '.
 05  NAME-USER         PIC X(8)  VALUE 'ZUSER   '.
 
 01  ISPF-BUF              PIC X(120) VALUE SPACES.
 
 01  ISPF-TYPES.
 05  CHAR              PIC X(8)  VALUE 'CHAR'.
 05  FIXED             PIC X(8)  VALUE 'FIXED'.
 
 01  ISPF-SERVICES.
 05  VDEF              PIC X(8)  VALUE 'VDEFINE'.
 05  VRESET            PIC X(8)  VALUE 'VRESET '.
 
 01  ISPF-LENGTHS.
 05  L04               PIC S9(9) COMP VALUE  4.
 05  L06               PIC S9(9) COMP VALUE  6.
 05  L08               PIC S9(9) COMP VALUE  8.
 05  L30               PIC S9(9) COMP VALUE 30.
 05  L50               PIC S9(9) COMP VALUE 50.
 05  L80               PIC S9(9) COMP VALUE 80.
 05  L94               PIC S9(9) COMP VALUE 94.
 
 
 CALL 'ISPLINK' USING VDEF NAME-DATABASE DATABASE CHAR   L80.
 CALL 'ISPLINK' USING VDEF NAME-COMPCODE COMPCODE FIXED  L04.
 CALL 'ISPLINK' USING VDEF NAME-PRODCODE PRODCODE FIXED  L04.
 CALL 'ISPLINK' USING VDEF NAME-SCORCODE SCORCODE FIXED  L04.
 CALL 'ISPLINK' USING VDEF NAME-SCCTFR   SCCTFR   FIXED  L04.
 CALL 'ISPLINK' USING VDEF NAME-SCCTTO   SCCTTO   FIXED  L04.
 CALL 'ISPLINK' USING VDEF NAME-VERSION  VERSION  FIXED  L04.
 CALL 'ISPLINK' USING VDEF NAME-USER     USER-ID  CHAR   L08.
 
 
 | 
 
 
 
 You may like to consider using the ISPEXEC interface for some commands:
 
 
  	  | Code: |  	  | 
 MOVE 'VGET (ZUSER DATABASE) SHARED' TO ISPF-BUF.
 CALL 'ISPEXEC' USING L80, ISPF-BUF.
 
 
 | 
 
 
 It can make life a little simpler.
 _________________
 The day you stop learning the dinosaur becomes extinct
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |