Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Editing a record in a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
sparrow

New User


Joined: 26 Mar 2007
Posts: 57
Location: Pune

PostPosted: Sat Apr 17, 2010 1:22 am    Post subject: Editing a record in a file
Reply with quote

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
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Apr 17, 2010 3:06 am    Post subject:
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Sat Apr 17, 2010 11:19 am    Post subject:
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Sun Apr 18, 2010 2:19 am    Post subject:
Reply with quote

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
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Sun Apr 18, 2010 2:27 am    Post subject: Reply to: Editing a record in a file
Reply with quote

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
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Sun Apr 18, 2010 9:50 am    Post subject: Reply to: Editing a record in a file
Reply with quote

Probably, there is more data on line 4, maybe including trailing blanks.
Back to top
View user's profile Send private message
sparrow

New User


Joined: 26 Mar 2007
Posts: 57
Location: Pune

PostPosted: Mon Apr 19, 2010 9:47 pm    Post subject: Reply to: Editing a record in a file
Reply with quote

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
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Mon Apr 19, 2010 9:53 pm    Post subject: Reply to: Editing a record in a file
Reply with quote

What does the output from a TRACE look like?
Back to top
View user's profile Send private message
sparrow

New User


Joined: 26 Mar 2007
Posts: 57
Location: Pune

PostPosted: Mon Apr 19, 2010 10:12 pm    Post subject: Reply to: Editing a record in a file
Reply with 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.

I think the EDIT DATASET is causing the error because F is substituted with the record.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Mon Apr 19, 2010 10:21 pm    Post subject: Reply to: Editing a record in a file
Reply with quote

repeating:

Probably, there is more data on line 4, maybe including trailing blanks.
Back to top
View user's profile Send private message
sparrow

New User


Joined: 26 Mar 2007
Posts: 57
Location: Pune

PostPosted: Mon Apr 19, 2010 10:31 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Tue Apr 20, 2010 6:19 am    Post subject: Reply to: Editing a record in a file
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Apr 20, 2010 11:53 am    Post subject:
Reply with quote

why is everyone assuming line 4 of the dataset
NEWVAR1.4
contains a dataset name?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Apr 20, 2010 2:37 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Tue Apr 20, 2010 5:31 pm    Post subject:
Reply with quote

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:
  1. 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:
    Code:

    <HLQ.DATASET.NAME>
    then you have just what you need.

  2. I suggest using STRIP when allocating a variable:
    Code:
    F=Strip(NEWVAR1.4)


  3. 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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us