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
 

 

How to update a particular column in REXX?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Sat May 24, 2008 1:11 am    Post subject: How to update a particular column in REXX?
Reply with quote

Rexx Gurus,

As per my requirement i would get the column no and the data as inputs and i should update the record with the data in that particular column.

say for example the input data that i get is

column - 15
data - Aaru

then i should update all the records with "Aaru" starting from column no 15. Is there any function in REXX to do this?
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: Sat May 24, 2008 2:23 am    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

POS ought to work.
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Sat May 24, 2008 3:21 am    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

I think there is a possibility that data in other columns will make POS difficult to use.

For example, say the search was for aaru in column 15 and data was:
Code:

----+----1----+----2---
 aaru  aaru   aaru     


if POS('aaru', whole_line) = 15 ...

would give false results.

perhaps:
Code:

column =15
serch = 'aaru'
If  substr(whole_line, column, length(serch) =  serch then...
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat May 24, 2008 4:40 am    Post subject:
Reply with quote

Hello,

I may misunderstand the requirement, but my understanding is that the user will provide a starting position and a "fill" value. The code should fill all of the records with specified value at the starting position.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Sat May 24, 2008 5:50 am    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

Kevin,

Quote:
POS ought to work.


I have used POS before, and to my knowledge it can be used for finding the starting position of the string.

dick,

Quote:

I may misunderstand the requirement, but my understanding is that the user will provide a starting position and a "fill" value. The code should fill all of the records with specified value at the starting position.


Exactly. You are correct and that is what my requirement is.
Back to top
View user's profile Send private message
charanmsrit

New User


Joined: 25 Oct 2007
Posts: 80
Location: Australia

PostPosted: Tue May 27, 2008 1:11 am    Post subject:
Reply with quote

Hi,

even i have got an almost similar requirement. i have to update accounting information on job card for all the 3000 jcl's in each test region of total 20 test regions to the below shown format. each jcl have different accounting information with different length. well, i know i can capture both open and closing brackets column position. is there a way to use these column positions and update the accounting information to below format ?? Please advise

JOB (1111,XXXX,XXXXXXXX),

Thanks,
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue May 27, 2008 5:46 pm    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

charan,

First of all your requirement is different from mine and it is doable.

Quote:
know i can capture both open and closing brackets column position. is there a way to use these column positions and update the accounting information to below format


Use POS u can get the column no/position where the accounting info starts[by checking for "("] and based on that u can edit the data.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue May 27, 2008 6:59 pm    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

here is a snippet that will parse a job card for accounting data
get rid of the old account info,
rebuild the same card with the new account info

Code:

jobcard = " //jobname JOB (sccnt,wwww,qqq),class=a, "
jobcard = " //jobname JOB acct,class=b,  "
jobcard = " //jobname JOB (sccnt,wwww,qqq),class=a, "

jobcard = strip(jobcard)

p = pos("JOB",jobcard)

jhead = strip(substr(jobcard,1,p-1))

if p = 0 then do
   say "not a JOB stmt :" jobcard
   exit
end

data = strip(substr(jobcard,p+4))
say "data    " data

if  substr(data,1,1) = "(" then do
   p = Pos(")",data)
   acctinfo = substr(data,2, p-2)
   jtail = substr(data,p+1)
end
else do
   p = pos(",",data)
   acctinfo = substr(data,1,p-1)
   jtail = substr(data,p)
end

say "jhead   " jhead
say "jtail   " jtail

say "acctinfo" acctinfo

parse var acctinfo acct1 "," acct2 "," acct3 "," acct4 "," .

say "acct1   " acct1
say "acct2   " acct2
say "acct3   " acct3
say "acct4   " acct4


newacct= "(new,acct.info)"
jobcnew = jhead || " JOB " || newacct || jtail

say "jobcnew " jobcnew

Back to top
View user's profile Send private message
Ganesh.Deokar

New User


Joined: 30 Sep 2005
Posts: 26
Location: Buffalo,NY

PostPosted: Tue May 27, 2008 8:44 pm    Post subject:
Reply with quote

Did you try OVERLAY function.

e.g.
OVERLAY(' ','abcdef',3) -> 'ab def'
OVERLAY('.','abcdef',3,2) -> 'ab. ef'
OVERLAY('qq','abcd') -> 'qqcd'
OVERLAY('qq','abcd',4) -> 'abcqq'
OVERLAY('123','abc',5,6,'+') -> 'abc+123+++'

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/IKJ4A350/4.3.43?DT=20040623084642


Regards,
Ganesh
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Tue May 27, 2008 9:56 pm    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

regarding Aaru's original requirement:
> i should update all the records with "Aaru" starting from column no 15

A. I understood it to describe a filter:
i should update all the records THAT HAVE "Aaru" starting from column no 15

B. whereas, Dick understood it to mean:
i should update all the records AND REPLACE ANY TEXT IN COLUMN 15 WITH "Aaru"

If it really is B, then I do not understand how POS can help.
Back to top
View user's profile Send private message
charanmsrit

New User


Joined: 25 Oct 2007
Posts: 80
Location: Australia

PostPosted: Wed May 28, 2008 12:55 am    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

Thanks a ton enrico. It's really amazing
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed May 28, 2008 4:21 am    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

pedro,

Quote:
If it really is B, then I do not understand how POS can help.


You are correct and POS cannot be used for the same. This has already been said in the previous post.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed May 28, 2008 4:22 am    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

Ganesh,

Quote:
Did you try OVERLAY function.



I shall try and let u know if it is working.
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: Wed May 28, 2008 11:23 am    Post subject:
Reply with quote

What about an ISPF edit macro

C 'abc' '999' 15
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Thu May 29, 2008 10:41 pm    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

expat,

Quote:
What about an ISPF edit macro


Basically my requirement is to get few column no's/data from the user and update that particular column in a PS/VSAM files with the data.

first i want it to implement for PS/alphanumeric/numeric fields and then extend it to VSAM/COMP/COMP-3 fields and all

i have not written any macro's and have to dig a bit to see if i can use it. I shall give it a try.

Thanks for your valuable suggestions.
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Thu May 29, 2008 10:56 pm    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

> first ... PS/alphanumeric/numeric fields and then extend it to VSAM/COMP/COMP-3...

I doubt that you will be able to use similar methods to update both PS and VSAM files.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Fri May 30, 2008 12:07 am    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

Pedro,

Quote:
I doubt that you will be able to use similar methods to update both PS and VSAM files.


Hmm even i doubt. My first task is to make it work for a normal sequential dataset and then should try for VSAM.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Fri May 30, 2008 12:09 am    Post subject: Reply to: How to update a particular column in REXX?
Reply with quote

Quote:
Did you try OVERLAY function.


Yep, tried and it worked. Thanks for letting me know this.
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm


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