when i pass a parameter from command & keep the cursor on HOSTBA' and hit enter .If the parameter is "P" then it should open the member HOSTBA from PROD.CARD and if parameter value is "T" it should open the member HOSTBA in EDIT mode from TEST.CARD library & HOSTBA is will be present in both libraries..
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Thu Apr 30, 2009 9:26 am Post subject:
use ARG to pick up your T or P
use CURSOR to determine the line and column position of the cursor
use LINE to input the data on the cursor'd line
use the column position to find your member name
build your pds name
invoke the edit session on the member _________________ Dick Brenholtz
American living in Varel, Germany
i am not able to substitue the line2 value in "ISPEXEC VIEW DATASET('LINE2("ONE")')" . When i display the error message it says dataset is not cataloged.
Code:
ZERRSM : Data set not cataloged
ZERRLM : 'LINE2' was not found in catalog.
please let me know how to substitue the value of LINE2 in the edit or view session.
Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
Posted: Wed May 13, 2009 3:25 am Post subject:
Nice to see that you have made a good effort at coding it yourself.
Here's a piece of my own code that was almost the same as your requirement, so I have adapted it.
To use it, type macroname 1 2 on the command line and place the cursor on the required line.
I have coded it so that the parameters are non positional. Defaults are BROWSE and TEST.DATA.SET
so, if you just use macroname then it will browse the member from TEST
Code:
"ISREDIT MACRO (TYP LVL)"
"ISPEXEC CONTROL ERRORS RETURN"
UPPER TYP LVL
IF TYP = 'P' | LVL = 'P'
THEN DSN = 'PROD.DATA.SET'
ELSE DSN = 'TEST.DATA.SET'
SELECT
WHEN LVL = 'B' THEN ACT = 'BROWSE'
WHEN LVL = 'V' THEN ACT = 'VIEW'
WHEN LVL = 'E' THEN ACT = 'EDIT'
WHEN TYP = 'B' THEN ACT = 'BROWSE'
WHEN TYP = 'V' THEN ACT = 'VIEW'
WHEN TYP = 'E' THEN ACT = 'EDIT'
OTHERWISE ACT = 'BROWSE'
END
"ISREDIT (CRSLINE) = "CURSOR
"ISREDIT (INDATA) = LINE " CRSLINE
INDATA = TRANSLATE(INDATA," ",",='")
PX = WORDPOS('MEM1',INDATA)
IF PX > 0 THEN DO
MEMB = WORD(INDATA,PX+1)
EDMEM = DSN||"("||MEMB||")"
"ISPEXEC" ACT "DATASET('"EDMEM"')"
END
EXIT
_________________ If it's true that we are here to help others,
then what exactly are the others here for ?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum