IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Calling ISPLINK from COBOL


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
yugendran

New User


Joined: 14 Dec 2007
Posts: 51
Location: indore

PostPosted: Thu May 19, 2011 4:11 pm
Reply with quote

Hi,

I just tried to run a code to call ISPLINK from cobol to get a variable using VGET.. But it ended with RC 20.. I have just got the code from web..

Code:
IDENTIFICATION DIVISION.                               
PROGRAM-ID. COBISPF.                                   
DATA DIVISION.                                         
WORKING-STORAGE SECTION.                               
 ISPF SERVICES                                         
01  ISPLINK  PIC X(8)  VALUE 'ISPLINK '.               
01  TCCSID   PIC X(05).                               
01  LCCSID   PIC S9(8) COMP VALUE 5.                   
01  VDEFINE  PIC X(8)  VALUE 'VDEFINE '.               
01  ZTERMCID PIC X(8)  VALUE 'ZTERMCID'.               
01  CHAR     PIC X(4)  VALUE 'CHAR'.                   
01  VGET     PIC X(8)  VALUE 'VGET    '.               
01  SHARED   PIC X(8)  VALUE 'SHARED  '.               
PROCEDURE DIVISION.                                   
MAIN-PARA.                                             
    CALL 'ISPLINK' USING                               
        VDEFINE ZTERMCID TCCSID CHAR LCCSID.           
           DISPLAY RETURN-CODE UPON SYSOUT.     
           CALL ISPLINK USING                   
               VGET ZTERMCID SHARED.             
           DISPLAY RETURN-CODE UPON SYSOUT.     
           DISPLAY TCCSID UPON SYSOUT.           
       MAIN-EXIT.                               
           STOP RUN. 


I am not sure why it is ended with RC 20..
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu May 19, 2011 4:30 pm
Reply with quote

How did you run it? JCL or called in an ISPF environment?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 19, 2011 4:39 pm
Reply with quote

while you were surfing the web for solutions,
this link:z/OS V1R7.0 ISPF Services Guide which describes the VDEFINE, VGET, and VPUT services, my have been of more help.

can't get what is not there.

as well as which service, VDEFINE or VGET returned the rc_20?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu May 19, 2011 5:06 pm
Reply with quote

Try this :

Code:

01  CHAR     PIC X(8)  VALUE 'CHAR    '.   
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu May 19, 2011 5:12 pm
Reply with quote

And this :

Code:

01  ZTERMCID PIC X(10)  VALUE '(ZTERMCID)'.
Back to top
View user's profile Send private message
yugendran

New User


Joined: 14 Dec 2007
Posts: 51
Location: indore

PostPosted: Thu May 19, 2011 5:42 pm
Reply with quote

Hi,

I am running it using JCL..

//STEP01 EXEC PGM=COBISPF
//SYSLST DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSPRINT DD SYSOUT=*

Sysout:

0020
0020

@Peter,

I did what u suggested, still its returning RC-20.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu May 19, 2011 5:47 pm
Reply with quote

What is COBISPF, a compile procedure? You need an ISPF environment to run it.
Something like this :

ISPEXEC SELECT PGM(APCS1000) NEWAPPL(APT) PARM(&P) PASSLIB
Back to top
View user's profile Send private message
yugendran

New User


Joined: 14 Dec 2007
Posts: 51
Location: indore

PostPosted: Thu May 19, 2011 5:55 pm
Reply with quote

Peter,

I have just compiled and linked this cobol program and created the load module COBISPF.. and I am running that load with the above JCL..

Thanks,
Yuge
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu May 19, 2011 5:58 pm
Reply with quote

yugendran,

are you a bit slow? That will never work, you need to use the ISPEXEC interface, in other words CLIST/REXX have to be used.

Read the : ISPF Services Guide
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 19, 2011 6:03 pm
Reply with quote

no you do not need to use clist/rexx.

all he has to do is allocate in his JOBLIB/STEPLIB statment, the required libraries to support the CALL and the routines.

the same libraries that would be required if you did write a clist/rexx routine to accomplish the same as the COBOL program is attempting to do.
Back to top
View user's profile Send private message
yugendran

New User


Joined: 14 Dec 2007
Posts: 51
Location: indore

PostPosted: Thu May 19, 2011 6:08 pm
Reply with quote

Peter,

Using REXX/CLIST, I have done this before.. I recently came to know that it is also possible in to do VDEFINE & VGET in batch..

If we use MODEL command in edit mode, it shows the examples of invoking VDEFINE in cobol program..

eg:
CALL "ISPLINK" USING ISPF-SERVICE ISPF-NAME-LIST
ISPF-VARIABLE-LIST ISPF-FORMAT-LIST
ISPF-LENGTH-LIST ISPF-OPTION-LIST
ISPF-UDATA-VALUE ISPF-OPTION1.

I have used first four parms and others are optional.. But not able to succeed in it..

Thanks
Yuge
Back to top
View user's profile Send private message
yugendran

New User


Joined: 14 Dec 2007
Posts: 51
Location: indore

PostPosted: Thu May 19, 2011 6:11 pm
Reply with quote

Hi dbz,

Is there any way to find what are all the required libraries to be allocated to run this apart from my load library?

Thanks.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu May 19, 2011 6:15 pm
Reply with quote

Dick,

as far as i know if you use batch, then it has to be a TSO (IKJEFT01) batch, with beside the steplib for the cobol pgm also needs the ISPF libraries.
Back to top
View user's profile Send private message
yugendran

New User


Joined: 14 Dec 2007
Posts: 51
Location: indore

PostPosted: Thu May 19, 2011 6:19 pm
Reply with quote

Hi,

I just tried,

/* REXX */
Address TSO
"CALL 'TEST.LOADLIB(COBISPF)'"

It worked.. But running in JCL, it gives error..
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 19, 2011 6:35 pm
Reply with quote

Peter,
you are correct, it failed to register that he was invoking the COBOL program directly from MVS.

He does need to invoke the program via IKJEFTnn.

yugendran wrote:
It worked.. But running in JCL, it gives error..

that is because when you invoke the REXX Script in the foreground,
all the required libraries are already allocated to your ISPF session.

now,
either
  • search the forum (there have been several threads concerning this in this website
  • search google for invoking ISPF in batch
  • or do a TSO LISTALC and for every dsn allocated to your ISPF and ISREX dd names, make an entry in your JOBLIB/STEPLIB statement

the last will be overkill, but if you are too lazy to do a little research and learning about your environment,
you will just have to do it that way.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri May 20, 2011 1:56 am
Reply with quote

PeterHolland wrote:
Dick,

as far as i know if you use batch, then it has to be a TSO (IKJEFT01) batch, with beside the steplib for the cobol pgm also needs the ISPF libraries.

Do you know offhand if he could establish a TSO environment and then start ISPF?

(I admit: I'm too damned lazy to write the program at 15:30 WULT icon_smile.gif )
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri May 20, 2011 11:37 am
Reply with quote

Akatsukami,

Maybe by using IKJEFTSR, IKJTSOEV and other routines, see :

publib.boulder.ibm.com/infocenter/zos/v1r9/index.jsp?topic=/com.ibm.zos.r9.ikjb700/newtsf.htm
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top