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

VGET variables from a different application


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Fri Apr 23, 2010 7:57 pm
Reply with quote

I have a need to pull ISPF variables from one application profile to another.

For example, say I am in application AAAA and I need some variable that is stored in BBBB. I wrote an interface module that will receive several variables, do the VGET and return the variable and the values to the calling program. This is what I have so far:

Code:
ADDRESS ISPEXEC
'SELECT CMD(%VGET 'DMRDSN') NEWAPPL(BBBB)'
INTERPRET RESULT


Code:
VGET:
  ARG PARMS
  PASS = ''

  DO FOREVER
    IF PARMS > '' THEN DO
      PARSE VAR PARMS PARM PARMS
      PARM_NAME = PARM

      ADDRESS ISPEXEC
      "VGET ("PARM")"

      INTERPRET "PASS = PASS||'"PARM_NAME"='"PARM"' '"
    END
    ELSE
      LEAVE
  END
RETURN PASS


When VGET finishes and executes 'RETURN PASS', I recieve the following message:

Code:
Error running VGET, line 33: Invalid whole number


Is there an easier way to do this than what I am doing?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Apr 23, 2010 8:15 pm
Reply with quote

Code:
line 33


?????
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Fri Apr 23, 2010 8:18 pm
Reply with quote

Line 33 is the RETURN PASS line...
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Apr 23, 2010 8:44 pm
Reply with quote

you have of course run with TRACE
i personally use TRACE ?R
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Fri Apr 23, 2010 8:52 pm
Reply with quote

Yes.
Code:
18 *-* ARG PARMS
   >>>   "DMRDSN"

19 *-* PASS = ''
   >L>   ""

21 *-* DO FOREVER

22 *-*  IF PARMS > ''
   >V>    "DMRDSN"
   >L>    ""
   >O>    "1"

   *-*   THEN
   *-*   DO

23 *-*    PARSE VAR PARMS PARM PARMS
   >>>      "DMRDSN"
   >>>      ""
24 *-*    PARM_NAME = PARM
   >V>      "DMRDSN"

26 *-*    ADDRESS ISPEXEC

27 *-*    "VGET ("PARM")"
   >L>      "VGET ("
   >V>      "DMRDSN"
   >O>      "VGET (DMRDSN"
   >L>      ")"
   >O>      "VGET (DMRDSN)"

29 *-*    INTERPRET "PASS = PASS||'"PARM_NAME"='"PARM"' '"
   >L>      "PASS = PASS||'"
   >V>      "DMRDSN"
   >O>      "PASS = PASS||'DMRDSN"
   >L>      "='"
   >O>      "PASS = PASS||'DMRDSN='"
   >V>      "DMRDSN"
   >O>      "PASS = PASS||'DMRDSN='DMRDSN"
   >L>      "' '"
   >O>      "PASS = PASS||'DMRDSN='DMRDSN' '"
   *-*     PASS = PASS||'DMRDSN='DMRDSN' '
   >V>       ""
   >L>       "DMRDSN="
   >O>       "DMRDSN="
   >V>       "MY.DATASET"
   >O>       "DMRDSN=MY.DATASET"
   >L>       " "
   >O>       "DMRDSN=MY.DATASET "

30 *-*   END
33 *-* END
21 *-* DO FOREVER
22 *-*  IF PARMS > ''
   >V>    ""
   >L>    ""
   >O>    "0"

31 *-*  ELSE
32 *-*   LEAVE

21 *-* DO FOREVER
34 *-* RETURN PASS
   >V>   "DMRDSN=MY.DATASET "
Error running VGET, line 34: Invalid whole number
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Sat Apr 24, 2010 1:29 am
Reply with quote

You have
Code:
RETURN DMRDSN=MY.DATASET

I think it is trying to process it as an assignment statement first and giving you the message you see.

I do not think your result will get carried back to the caller because of the ISPF SELECT service.

Try writing to a file and read it back.

It might be confusing to use VGET as a program name.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sat Apr 24, 2010 1:48 am
Reply with quote

  1. Congratulation, you just have created a TSO command with the same name as an ISPF command.
    Never do that. Make a small effort and prevent mix-up and accidents by using another name (nothing wrong with GETVAR, for example).

  2. This is nice:
    Code:
    INTERPRET "PASS = PASS||'"PARM_NAME"='"PARM"' '"
    but useless (and also the quote disappear). Just KISS and do:
    Code:
    PASS = PASS PARM_NAME"='"PARM"'"


  3. You have the possibility to pass a few variables. If there are two, the result would be:
    Code:
    DMRDSN=MY.DATASET DMRDSN2=MY.OTHER.DATASET
    For the INTERPRET (the other one) to work, you need more than pass the quotes, you need a command terminator:
    Code:
    PASS = PASS PARM_NAME"='"PARM"';"
    With that, your result will be:
    Code:
    DMRDSN='MY.DATASET'; DMRDSN2='MY.OTHER.DATASET';
    and that is correct.

  4. Anyway it doesn't work like this. In your case:
    TSO/E REXX Reference (RETURN) wrote:
    If no internal routine (subroutine or function) is active, RETURN and EXIT are identical in their effect on the program that is being run.
    and
    TSO/E REXX Reference (EXIT) wrote:
    Note: If the program was called through a command interface, an attempt is made to convert the returned value to a return code acceptable by the host. If the conversion fails, it is deemed to be a failure of the host interface and thus is not subject to trapping with SIGNAL ON SYNTAX. The returned string must be a whole number whose value fits in a general register (that is, must be in the range -2**31 through 2**31-1).


  5. Sorry, I have no positive remarks to make. So far Pedro's suggestion (writing to a (temp) file) is standing.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Sat Apr 24, 2010 1:54 am
Reply with quote

Pedro wrote:
You have
Code:
RETURN DMRDSN=MY.DATASET

I think it is trying to process it as an assignment statement first and giving you the message you see.


I thought this might be the issue. Instead of coding the interpret with the equal sign, I just code the value itself. i.e.
Code:
PASS = PASS||PARM' '
But this did not make a different. I still recieved the same error.

Pedro wrote:
I do not think your result will get carried back to the caller because of the ISPF SELECT service.


I think this is my issue. Do you know if the Select service will allow values to be returned?[/code]
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Sat Apr 24, 2010 2:05 am
Reply with quote

Marso wrote:
  1. Congratulation, you just have created a TSO command with the same name as an ISPF command.
    Never do that. Make a small effort and prevent mix-up and accidents by using another name (nothing wrong with GETVAR, for example).


This was just something I threw together fast and dirty as a proof of concept. I was planning on changing the name.

Marso wrote:
  • This is nice:
    Code:
    INTERPRET "PASS = PASS||'"PARM_NAME"='"PARM"' '"
    but useless (and also the quote disappear). Just KISS and do:
    Code:
    PASS = PASS PARM_NAME"='"PARM"'"


  • I had originally coded it different, and the interpret was needed, but I changed it and didn't pay attention to the necessity.

    Marso wrote:
  • You have the possibility to pass a few variables. If there are two, the result would be:
    Code:
    DMRDSN=MY.DATASET DMRDSN2=MY.OTHER.DATASET
    For the INTERPRET (the other one) to work, you need more than pass the quotes, you need a command terminator:
    Code:
    PASS = PASS PARM_NAME"='"PARM"';"
    With that, your result will be:
    Code:
    DMRDSN='MY.DATASET'; DMRDSN2='MY.OTHER.DATASET';
    and that is correct.

  • As of now, I only need one variable. I was planning on adding the ';', but like I said, I just wanted to try this as a proof of concept.

    Marso wrote:
  • Anyway it doesn't work like this. In your case:
    TSO/E REXX Reference (RETURN) wrote:
    If no internal routine (subroutine or function) is active, RETURN and EXIT are identical in their effect on the program that is being run.
    and
    TSO/E REXX Reference (EXIT) wrote:
    Note: If the program was called through a command interface, an attempt is made to convert the returned value to a return code acceptable by the host. If the conversion fails, it is deemed to be a failure of the host interface and thus is not subject to trapping with SIGNAL ON SYNTAX. The returned string must be a whole number whose value fits in a general register (that is, must be in the range -2**31 through 2**31-1).


  • Sorry, I have no positive remarks to make. So far Pedro's suggestion (writing to a (temp) file) is standing.


  • Thanks, I thought this was the issue. I don't like the idea of writing to a file. I'll just scrap this function.
    Back to top
    View user's profile Send private message
    Pedro

    Global Moderator


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

    PostPosted: Sat Apr 24, 2010 7:32 am
    Reply with quote

    Quote:
    I thought this might be the issue. Instead of coding the interpret with the equal sign, I just code the value itself. i.e.
    Code:
    PASS = PASS||PARM' '
    But this did not make a different. I still recieved the same error.

    I think the first time through, will be the equivalent of this:
    Code:
    pass = my.dataset

    giving you the same situation and message.

    Try changing the period in 'my.dataset' to another character.

    ps. yeah, I know it is moot because the RETURN will not work.
    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 -> CLIST & REXX

     


    Similar Topics
    Topic Forum Replies
    No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
    No new posts DB2 Event passed to the Application P... DB2 1
    No new posts JCL with variables JCL & VSAM 1
    No new posts ISPF option 7.3 - can only see ISR ap... TSO/ISPF 6
    No new posts JCL Variables JCL & VSAM 1
    Search our Forums:

    Back to Top