View previous topic :: View next topic
|
Author |
Message |
sparrow
New User
Joined: 26 Mar 2007 Posts: 57 Location: Pune
|
|
|
|
Hello All,
I have a rqreuirement for changing a value in the particular position in a particular line of a PDS member.
I have coded the like this..
Code: |
/* REXX */
"EXECIO 4 DISKR INPUT1(STEM NEWVAR1. FINIS"
VAL=12345
F=NEWVAR1.4
ADDRESS ISPEXEC "EDIT DATASET('"F"') MACRO(macroname) PARM(VAL)"
EXIT
|
My edit macro as below
Code: |
/* REXX */
ADDRESS ISREDIT "MACRO (VAL)"
ADDRESS ISREDIT "CHANGE P'=====' '"VAL"' 20 25"
ADDRESS ISREDIT "SAVE"
ADDRESS ISREDIT "END"
EXIT |
I am receiving error when i run my code
*************
ISPS109
Unexpected list found
A list of names was found where a list was not expected.
*************
I can understand that " EDIT DATASET " is causing the error..Dont know what to use in that place to just edit a record in my file..
is there any way i can edit only the record in the 4th line ?
Please give me a suggestion
thanks
Sparrow. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
let us start by determining what is on line 4 of MM.XXX.YYY(ABCD)
and
in an edit macro
to only change a particular line,
the cursor has to be addressed to that line - which you have not done.
explain what are you trying to do? completely, no more of this
I want to change something on line 4 |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
The edit macro is for working on a dataset, not a stem variable.
As Dick has asked, please give us the full story |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
This is what your code says:
1. In the 4th line of file INPUT1 there is a "dataset(member)" name.
2. In this member you change the 1st line. Anything you have in col 20-25 is replaced by '12345'.
It does not fit with your question. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
For changing a field or fields on a specific record, I think I'd use a normal TSO/ EDIT Change command. Just my preference. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
Probably, there is more data on line 4, maybe including trailing blanks. |
|
Back to top |
|
|
sparrow
New User
Joined: 26 Mar 2007 Posts: 57 Location: Pune
|
|
|
|
Hi All, sorry for the confusion...I missed few lines while pasting..
Code: |
/* REXX */
"ALLOC FI(INPUT1) DA('MYPDS.DATA(MEM1)') SHR REUSE"
DROP NEWVAR1.
"EXECIO 4 DISKR INPUT1(STEM NEWVAR1. FINIS"
"FREE FI(INPUT1)"
VAL=12345
F=NEWVAR1.4
ADDRESS ISPEXEC "EDIT DATASET('"F"') MACRO(NACRONAME) PARM(VAL)"
EXIT
|
and macro looks like
Code: |
/* REXX */
ADDRESS ISREDIT "MACRO (VAL)"
ADDRESS ISREDIT "CHANGE P'=====' '"VAL"' 20 25"
ADDRESS ISREDIT "SAVE"
ADDRESS ISREDIT "END"
EXIT |
and my aim is to
Read the 4th line of file INPUT1 and replace the value of VAL in position col 20-25 |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
What does the output from a TRACE look like? |
|
Back to top |
|
|
sparrow
New User
Joined: 26 Mar 2007 Posts: 57 Location: Pune
|
|
|
|
I added a SAY F in front of
ADDRESS ISPEXEC "EDIT DATASET('"F"') MACRO(NACRONAME) PARM(VAL)"
It displays the line 4 of the file.
I think the EDIT DATASET is causing the error because F is substituted with the record. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
repeating:
Probably, there is more data on line 4, maybe including trailing blanks. |
|
Back to top |
|
|
sparrow
New User
Joined: 26 Mar 2007 Posts: 57 Location: Pune
|
|
|
|
Pedro you mean the position to replace the value is incorrect ?
my NEWVAR1.4 contains whole 4th line of the file. I wanted to replace some data in particular position..how the trailing blanks cause me trouble ?
Please throw some light |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
Quote: |
I added a SAY F in front of
ADDRESS ISPEXEC "EDIT DATASET('"F"') MACRO(NACRONAME) PARM(VAL)"
It displays the line 4 of the file. |
You did not show us exactly what you saw. We can only guess.
I suspect it is something like this:
Code: |
ADDRESS ISPEXEC "EDIT DATASET(' some.pds ') MACRO(NACRONAME) PARM(VAL)"
|
I think the blanks within the quoted dataset name will cause a syntax error. If your lrecl is 80 bytes, then you will have many more blanks. but because of the original message about a 'list', there is probably something besides blanks.
Use the STRIP() function to remove the extra blanks. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
why is everyone assuming line 4 of the dataset
NEWVAR1.4
contains a dataset name? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Dick, that is along the lines of what I was thinking. As previously said, I would be tempted to use an edit macro to do this with a control for the line number.
Code: |
/* REXX *** EDIT ONLY LINE 4 OF A DATASET / MEMBER USING EDIT MACRO */
REQ = 4
"ISPEXEC EDIT DATASET('Data set name') MACRO(CHG04) PARM(REQ)" |
Code: |
"ISREDIT MACRO (REQ)"
DO FOREVER
"ISREDIT X ALL"
"ISREDIT F 'CHANGE-THIS' NEXT"
"ISREDIT (CRSLINE) = CURSOR"
IF CRSLINE = REQ
THEN "ISREDIT C '-THIS' '-THAT' NX ALL"
ELSE
IF CRSLINE > REQ THEN LEAVE
END
"ISREDIT END" |
|
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
sparrow wrote: |
my aim is to
Read the 4th line of file INPUT1 and replace the value of VAL in position col 20-25 |
Again, you're doing something else.
Here are some free tips:
- to know really the value of a variable, use:
Code: |
Say '<'F'>' /* look, no spaces */ |
If you see:
Code: |
<HLQ.DATASET.NAME > |
there are trailing spaces
If you see:
then you have just what you need.
I suggest using STRIP when allocating a variable:
As dbzTHEdinosauer suggested with his question, you should check that the member exists before trying to edit it:
Code: |
Reply = SYSDSN(F)
If Reply <> "OK" Then Do
Say "Error on '"F"': "Reply
Call Error_Process
End |
|
|
Back to top |
|
|
|