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

Using ISPF Library Management (LM) Services in COBOL


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

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Dec 19, 2008 3:26 am
Reply with quote

I've been working all afternoon trying to code a simple COBOL program that uses some ISPF Library Management services for manipulating a PDS. For some reason I keep having a problem with the ISPF Data ID variable.

First, in W-S I'm defining the variables:
Code:

01  VDDVAR  PIC X(8) VALUE '(VDDVAR)'.
01  DDVAR  PIC X(8) VALUE SPACES.


Then I'm using a VDEFINE:
Code:

MOVE 'VDEFINE ' TO ISPF-SERVICE.                         
MOVE 1          TO ISPF-NAME-COUNT.                       
MOVE 'VDDVAR  ' TO ISPF-NAME(1).                         
MOVE 'DDVAR   ' TO ISPF-VARIABLE(1).                     
MOVE 'CHAR    ' TO ISPF-FORMATS(1).                       
MOVE 8          TO ISPF-LENGTHS(1).                       
MOVE '        ' TO ISPF-OPTION-LIST.                     
MOVE '        ' TO ISPF-UDATA-VALUE.                     
MOVE '        ' TO ISPF-OPTION1.                         
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.   


The VDEFINE step works. Then, I'm doing the LMINIT step:

Code:

MOVE 'LMINIT  ' TO ISPF-SERVICE.                         
     MOVE 'DDVAR   ' 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 'PDS     ' 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.   


which also works OK. I'm having a problem with the LMOPEN step:

Code:

MOVE 'LMOPEN  ' TO ISPF-SERVICE.                         
MOVE '&DDVAR  ' TO ISPF-DATA-ID.                         
MOVE 'INPUT   ' TO ISPF-OPTION1.                         
MOVE '        ' TO ISPF-DATA-LENVAR.                     
MOVE '        ' TO ISPF-RECFORM.                         
MOVE '        ' TO ISPF-ORG-VAR.                         
CALL 'ISPLINK' USING  ISPF-SERVICE       ISPF-DATA-ID     
                      ISPF-OPTION1       ISPF-DATA-LENVAR
                      ISPF-RECFORM       ISPF-ORG-VAR.   


which is ending with a RETURN-CODE of 10, which would indicate that there's a problem with the data-id. Now, I know that data-id at this point should contain the value of the variable set in LMINIT.

Does anyone see if I'm doing something wrong?
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Fri Dec 19, 2008 4:10 am
Reply with quote

Code:
MOVE '&DDVAR  ' TO ISPF-DATA-ID. 


What is the meaning of the & ?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Dec 19, 2008 4:10 am
Reply with quote

I'm no expert in this, but you've got
Code:
     MOVE 'DDVAR   ' TO ISPF-DATA-ID.
in the init but
Code:
     MOVE '&DDVAR  ' TO ISPF-DATA-ID.
in the open ... almost but not quite the same; wouldn't that cause a problem?
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Fri Dec 19, 2008 5:25 am
Reply with quote

Sorry, I do not know COBOL, but my experience with VDEFINE is different.
Code:
Call ISPLINK('VDEFINE '  ,'KURSOR  ',       
                     local_KURSOR  , "CHAR ", 8);     


You are telling ISPF: "whenever you refer to this variable name, use this program storage location". So the second parm is a quoted string, but the third is a storage address that the compiler resolves. Whereas you seem to have two quoted strings.

In short, I do not think your VDEFINE is setup correctly. It probably is using the address of your constant rather than the address of your variable. You might get rc=0 from VDEFINE but will not be what you want.

Secondary problem:
I think LMINIT wants the name of the variable (seems to be VDDVAR), but LMOPEN wants the contents of the variable (you might be able to get by with &VDDVAR).
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Fri Dec 19, 2008 5:39 am
Reply with quote

Like I said, I do not know cobol. I edited a file and changed my profile to cobol, then issued the MODEL command. It showed me the syntax, which seems to be sort of what you have. See my secondary problems note above.

The ISPF library used to have an 'examples' book. It is no longer provided. But here is the old one: publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ISPEXM00/1.1.10.2?SHELF=ISP4BK01&DT=19940616155035&CASE=
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 How to access web services/website? Mainframe Interview Questions 4
No new posts Looking for a little history of ISPF ... TSO/ISPF 5
Search our Forums:

Back to Top