| View previous topic :: View next topic |
| Author |
Message |
Chumma Beginner
Joined: 10 Jan 2007 Posts: 12 Topics: 5 Location: India
|
Posted: Tue Feb 06, 2007 11:23 pm Post subject: Need to pass arguments to my edit macro! |
|
|
Hi,
I am trying a ISPF Edit macro using rexx to edit a dataset by receiving the value from the user as an argument in the command line.
I tried with my code
| Code: |
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
ADDRESS ISREDIT "MACRO PROCESS"
/*PUSH "U132296.GK.COBOL"
PULL INPUT */
PARSE ARG INPUT
SAY "INPUT=" INPUT
SAY "LENGTH OF THE INPUT=" LENGTH(INPUT)
IF LENGTH(INPUT)>0 THEN DO
ADDRESS ISPEXEC VIEW "DATASET('"INPUT"')" ;END
ELSE NOP
|
When i tried to execute this code by passing the dataset name in the command line, I encounter the error as "Parameters are invalid"
Guide me plz!
My Expertise:Novice |
|
| Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Wed Feb 07, 2007 12:44 am Post subject: |
|
|
Tray to replace your first ISREDIT statement by "MACRO (INPUT) PROCESS".
O.
________
Ford Mustang SVO specifications
Last edited by ofer71 on Sat Feb 05, 2011 11:56 am; edited 1 time in total |
|
| Back to top |
|
 |
Chumma Beginner
Joined: 10 Jan 2007 Posts: 12 Topics: 5 Location: India
|
Posted: Wed Feb 07, 2007 1:47 am Post subject: |
|
|
Thanks ofer71.Now am able to pass arguments.
This time,am struck up with a another case:
When i tried executing my macro just by giving the member it resides,its not accepting the argument passed,giving the error as "command is not a macro"
Command I passed: "themembermymacroresides argumenttobepassed"
Output I get:
INPUT=
LENGTH OF THE INPUT= 0
***
My doubt is, the system has detected that the command is not a macro, then how is it possible for my macro to get executed and to produce the output!
But when i try using "TSO themembermymacroresides argumenttobepassed",my macro accepts the argument and gives the output, I wished.
Please clarify.Thanks for your time. |
|
| Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Wed Feb 07, 2007 2:49 am Post subject: |
|
|
Can you post the COMPLETE macro (please with the tags)?
O.
________
buy glass bong
Last edited by ofer71 on Sat Feb 05, 2011 11:56 am; edited 1 time in total |
|
| Back to top |
|
 |
Chumma Beginner
Joined: 10 Jan 2007 Posts: 12 Topics: 5 Location: India
|
Posted: Wed Feb 07, 2007 3:37 am Post subject: |
|
|
***************************** Top of Data ************
I have given my code here.
Code:
| Code: |
/*REXX*/
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
ADDRESS ISREDIT "MACRO(INPUT) PROCESS"
PARSE ARG INPUT
SAY "INPUT=" INPUT
SAY "LENGTH OF THE INPUT=" LENGTH(INPUT)
IF LENGTH(INPUT)>0 THEN DO
ADDRESS ISPEXEC EDIT "DATASET('"INPUT"')" ;END
ELSE NOP |
|
|
| Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Wed Feb 07, 2007 4:52 am Post subject: |
|
|
First, you don't need the ARG statement, since the INPUT keyword in the MACRO statement is automatically retrieving the parameter.
Second, Try to put the ADDRESS ISPEXEC "CONTROL ERRORS RETURN" after the ISREDIT statement, since the ISREDIT statement must be the first statement.
If you want this REXX to be used as both edit-macro and regular exec, you can check the RC of the MACRO statement. If this RC=20 the the REXX was inoked as a regular exec.
O.
________
smoke weed every day
Last edited by ofer71 on Sat Feb 05, 2011 11:56 am; edited 1 time in total |
|
| Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Wed Feb 07, 2007 8:34 am Post subject: |
|
|
| For what it is worth, there is already a commend in ISPF that edits a data set from the command line: EPDF datasetname. It is not an edit macro, but it exists in the ISPF command table and calls exec ISREPDF. It can also be used with browse or view, handles edit recovery, and takes all the parameters that the edit service takes like MACRO and PANEL. |
|
| Back to top |
|
 |
Mervyn Moderator

Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
|
Posted: Wed Feb 07, 2007 10:27 am Post subject: |
|
|
Not in my shop.  _________________ The day you stop learning the dinosaur becomes extinct |
|
| Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12401 Topics: 75 Location: San Jose
|
Posted: Wed Feb 07, 2007 11:29 am Post subject: |
|
|
| Mervyn wrote: | Not in my shop.  |
Mervyn,
EPDF has been there since OS/390 V2R8.0 and ISPF 4.8. You must be running a very old version.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
| Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Wed Feb 07, 2007 5:36 pm Post subject: |
|
|
| Most likely the shop is keeping their own ISPCMDS command table. That used to be a common problem because IBM commands didn't get picked up on new releases. The ISPF change to add site and user command tables got around that for most sites, though they needed to implement it and that often took a few years either because they didn't know they had a problem or they just didn't really care. |
|
| Back to top |
|
 |
Chumma Beginner
Joined: 10 Jan 2007 Posts: 12 Topics: 5 Location: India
|
Posted: Thu Feb 08, 2007 2:04 am Post subject: |
|
|
Hi,
This is a code in development stage. I encounter hiccups while executing this code. Ofer71, suggested me using (INPUT) in the ISREDIT line,for executing the Argument module. After adding code(Cursor Module) for fetching the value using cursor position,when I execute the macro ispf throws error.Could you please help on how to execute both the modules in the same macro.
Requirement:
Check if the user passes any value,if not pick up the value ( dataset) from the cursor position and edit the dataset.
Code:
| Code: |
/*REXX*/
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
ADDRESS ISREDIT "MACRO(INPUT) PROCESS" /* USED FOR PASSING ARGUMENTS */
/*ADDRESS ISREDIT "MACRO PROCESS" /* USED FOR NOT PASSING ARG */ */
/* ARGUMENT MODULE */
PARSE ARG INPUT
SAY "INPUT=" INPUT
SAY "LENGTH OF THE INPUT=" LENGTH(INPUT)
IF LENGTH(INPUT)>0 THEN DO
ADDRESS ISPEXEC EDIT "DATASET('"INPUT"')"
EXIT
END
/* CURSOR BASED MODULE */
ISREDIT "(CR,CC) = CURSOR"
SAY "ROW=" CR
SAY "COLUMN=" CC
ISREDIT "(DISPLAY) = LINE" CR
SAY "DISPLAYLINE= " DISPLAY
/* TO DECIDE THE STARTING POINT */
STARTPT1=POS("DSN=",DISPLAY)
say "startpt1= " startpt1
STARTPT2=POS("DSNAME=",DISPLAY)
say "startpt2= " startpt2
SELECT
WHEN STARTPT1>0 THEN STARTPT=STARTPT1+4
WHEN STARTPT2>0 THEN STARTPT=STARTPT2+7
OTHERWISE
STARTPT=CC;SAY "STARTPT= "CC
END
SAY "STARTPT1= " STARTPT1
SAY "STARTPT2= " STARTPT2
SAY "STARTPT= " STARTPT
/* STARTING POINT FINALISED; DECIDE THE END POSITION */
DSNEND1=POS(",",DISPLAY,STARTPT)
DSNEND2=POS(" ",DISPLAY,STARTPT)
say "DSNEND1=" DSNEND1
say "DSNEND2=" DSNEND2
IF (DSNEND1 \= 0 & DSNEND1< DSNEND2) = 1 THEN
DSNEND = DSNEND1
ELSE
DSNEND = DSNEND2
SAY "DSNEND= " DSNEND
SAY "DATASET ENDS AT " DSNEND " POSITION"
SAY 'STARTPOS=' STARTPT
SAY 'ENDPOS=' DSNEND-1
SIZE = (DSNEND)-(STARTPT)
SAY 'LENGTH=' SIZE
DSNNAME=SUBSTR(DISPLAY,STARTPT,SIZE)
SAY 'DATASEP=' DSNNAME
ADDRESS ISPEXEC VIEW "DATASET('"DSNNAME"')"
|
Argument Module:
Here I am trying to get the input(dataset) from the user, and edit the dataset.
Cursor Module:
Here I am trying to get the dataset based on the cursor position from the user.
My observation:
1) I am able to execute the Argument module only if I give
ADDRESS ISREDIT "MACRO(INPUT) PROCESS" in my code as given in the second line.
2) Am able to execute the Argument module only if I give
|
|
| Back to top |
|
 |
Mervyn Moderator

Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
|
Posted: Thu Feb 08, 2007 5:09 am Post subject: |
|
|
| semigeezer wrote: | | Most likely the shop is keeping their own ISPCMDS command table. That used to be a common problem because IBM commands didn't get picked up on new releases. The ISPF change to add site and user command tables got around that for most sites, though they needed to implement it and that often took a few years either because they didn't know they had a problem or they just didn't really care. |
I think this is the most likely explanation. We're running z/OS 01.07.00,
ISPF Level 5.7.0 (thanks for TASID, Semigeezer). There is no sign of EPDF in ISPCMDS. _________________ The day you stop learning the dinosaur becomes extinct |
|
| Back to top |
|
 |
|
|
|