View previous topic :: View next topic
|
Author |
Message |
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
????? |
|
Back to top |
|
|
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
Line 33 is the RETURN PASS line... |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you have of course run with TRACE
i personally use TRACE ?R |
|
Back to top |
|
|
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
- 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 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"'" |
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.
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. |
|
Back to top |
|
|
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
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 |
|
|
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
Marso wrote: |
- 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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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:
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 |
|
|
|