View previous topic :: View next topic
|
Author |
Message |
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
PeD
Active User
Joined: 26 Nov 2005 Posts: 459 Location: Belgium
|
|
|
|
Code: |
MOVE '&DDVAR ' TO ISPF-DATA-ID. |
What is the meaning of the & ? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
Back to top |
|
|
|