editing datasets behind the scenes



IBM's Command List programming language & Restructured Extended Executor

editing datasets behind the scenes

Postby meowmeow » Wed Mar 17, 2010 9:24 pm

I'm trying to edit datasets using a REXX program, ISPF Services and an ISPF Edit macro but I'm not getting the desired results:
here's my calling rexx:
/*REXX*/                                                                                                 
DATASET = "my.dataset"                     
STRING = 'ABC'                                             
SAY "CALLING CHGALL MACRO"                               
ADDRESS ISPEXEC "VPUT STRING"
ADDRESS ISPEXEC "EDIT DATASET("DATASET") MACRO(CALLED)"


CALLED:
/*REXX*/                     
ADDRESS ISREDIT             
MACRO(CALLED)               
ADDRESS ISPEXEC "VGET STRING"
"C ALL STRING 'DEF'"         
"SAVE"                       
"END"                       
RETURN


I wanted to edit the dataset without actually opening it, plus it's not actually executing my macro. I'm still figuring it out but cant seem to find the answer.
meowmeow
 
Posts: 8
Joined: Thu Feb 18, 2010 5:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: editing datasets behind the scenes

Postby Pedro » Thu Mar 18, 2010 2:13 am

Show us your trace information. Are there any error messages?
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: editing datasets behind the scenes

Postby dick scherrer » Thu Mar 18, 2010 2:59 am

Hello,

i wanted to edit the dataset without actually opening it(dunno if that's possible though),
Well, if it is going to be edited, it will have to be opened one way or another. . . :)
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: editing datasets behind the scenes

Postby MrSpock » Thu Mar 18, 2010 8:55 am

I don't know what you're using for a reference, but I've seen that code before elsewhere and it's not right. Who told you to VPUT the string? That would only be necessary in the rarest of circumstances.

Here's how I would code both the REXX exec and the ISPF Edit Macro:

/*REXX CALLING*/
dataset = "MY.DATA"
string = "ABC"
"ISPEXEC EDIT DATASET("dataset") MACRO(CALLED) PARM(string)"
Exit 0


/*REXX CALLED*/
"ISREDIT MACRO (str)"
"ISREDIT C ALL '"str"' 'DEF'"
"ISREDIT SAVE"
"ISREDIT END"
Return


or, I'd use my preferred method and save some coding:

/*REXX CALLING*/
dataset = "MY.DATA"
string = "ABC"
Queue "TOP"
Queue "C * 999999 /"string"/DEF/ ALL"
Queue "TOP"
Queue "END SAVE"
"EDIT "dataset" DATA ASIS NONUM"
Exit 0


or just use the IPOUPDTE program in batch.
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: editing datasets behind the scenes

Postby meowmeow » Fri Mar 19, 2010 7:49 pm

Hi Mr. Spock :)
Trace Result:
3 *-* DATASET = "my.dataset"
>>> "my.dataset"
4 *-* STRING='ABC'
>>> "ATT"
5 *-* SAY "CALLING CHGALL MACRO"
>>> "CALLING CHGALL MACRO"
CALLING CHGALL MACRO
6 *-* "ISPEXEC EDIT DATASET("DATASET") MACRO(CALLED) PARM(STRING)"
>>> "ISPEXEC EDIT DATASET(my.dataset) MACRO(CALLED) PARM
(STRING)"
***
ERROR:
ISRD028
Data set not cataloged
'xx1234.my.dataset' was not found in catalog.
----------------------------------------
it is saying that is not existing coz its adding my ID to the dataset name

when i changed it to DATASET('"DATASET"'), having it enclosed in single quotes, the (my.dataset)dataset is opening(literally opened) and won't do the editing portion of the macro even if i press f3 which will take me out of the dataset. its just opening the dataset and does not do editing.

i also tried using your preferred method and here's what i got:
/*REXX*/
TRACE R
DATASET = "CA1373.EZ500B1K.ICUIIRFL"
STRING = "ABC"
ADDRESS ISPEXEC
QUEUE "TOP"
QUEUE "C * 999999 /"STRING"/DEF/ ALL"
QUEUE "TOP"
QUEUE "END SAVE"
"EDIT "DATASET" DATA ASIS NONUM"
EXIT 0


TRACE RESULT:
3 *-* DATASET = "my.dataset"
>>> "my.dataset"
4 *-* STRING = "ABC"
>>> "ABC"
5 *-* ADDRESS ISPEXEC
6 *-* QUEUE "TOP"
>>> "TOP"
7 *-* QUEUE "C * 999999 /"STRING"/DEF/ ALL"
>>> "C * 999999 /ABC/DEF/ ALL"
8 *-* QUEUE "TOP"
>>> "TOP"
9 *-* QUEUE "END SAVE"
>>> "END SAVE"
10 *-* "EDIT "DATASET" DATA ASIS NONUM"
>>> "EDIT my.dataset DATA ASIS NONUM"
***


ERROR
ISPS108

Invalid length
Parameter 'my.dataset' exceeds the allowable length.
meowmeow
 
Posts: 8
Joined: Thu Feb 18, 2010 5:37 pm
Has thanked: 0 time
Been thanked: 0 time

Re: editing datasets behind the scenes

Postby MrSpock » Fri Mar 19, 2010 8:15 pm

Does the ISPF Edit macro work by itself? If you manually use ISPF Edit to edit that dataset, and then execute your macro, does it work?

As far as issues with TSO EDIT, yes, it has limitations, but it has the benefit of begin natively available in a batch environment, which is usually where you've probably used it more. As you can tell from looking at the HELP text for using it, it is meant to be user for your standard types of source libraries (JCL, PROC, ASM, COBOL, CNTL, CLIST, etc.) and doesn't work too well for data that's outside of those norms. But, you know what your data is like better than I do, so you can make your own judgement on it's usefulness to you in your environment.
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post