Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Using ISPF Library Management (LM) Services in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
superk

Moderator Team Head


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

PostPosted: Fri Dec 19, 2008 3:26 am    Post subject: Using ISPF Library Management (LM) Services in COBOL
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: 456
Location: Belgium

PostPosted: Fri Dec 19, 2008 4:10 am    Post subject:
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Fri Dec 19, 2008 4:10 am    Post subject:
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

Senior Member


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

PostPosted: Fri Dec 19, 2008 5:25 am    Post subject: Reply to: Using ISPF Library Management (LM) Services in COB
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

Senior Member


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

PostPosted: Fri Dec 19, 2008 5:39 am    Post subject: Reply to: Using ISPF Library Management (LM) Services in COB
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: http://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    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts COBOL Programming Sandpit? jodrisco COBOL Programming 6 Wed Apr 12, 2017 3:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us