IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DFSORT in JCL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
grayWolf

New User


Joined: 04 Oct 2010
Posts: 19
Location: Land of broken dreams

PostPosted: Fri Feb 18, 2011 12:52 pm
Reply with quote

Hi All,

I have a sequential file with LRECL = 175.
I got a requirement to replace all the text from columns 129-140 in the PS to 'ABCDE'. The file has more than 50000 records.
I understand that this can be done with DFSORT and after a bit of research in this forum, I was able to learn about FINDREP in DFSORT. But this can't satisfy my requirement as it is a mass update and not depending upon any condition.
So how do I write a Sort card to achieve this?
Any help would be appreciated and please let me know if you need further information.


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

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Feb 18, 2011 1:51 pm
Reply with quote

Use OUTREC to build bytes 1-128, then your new text and then bytes 141-175

Which product are you using
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Feb 18, 2011 2:02 pm
Reply with quote

since 129 to 140 is larger than 'abcde',

do you want the columns 129 to 140 replaced with
Code:
'abcde       '

or do you want to reduce the record size?
Back to top
View user's profile Send private message
grayWolf

New User


Joined: 04 Oct 2010
Posts: 19
Location: Land of broken dreams

PostPosted: Fri Feb 18, 2011 4:51 pm
Reply with quote

Quote:
Which product are you using
I'm using Z/OS

Quote:
or do you want to reduce the record size?

No. Want it with spaces as you suggested.
So, after some googling, I decided to use

Code:
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,128,129:C'ABCDE                ',150:150,26)


But is there any way to make it look "better". I mean, instead of "" C'ABCDE ' "", can we get 16 spaces in any other way.

Thanks
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Feb 18, 2011 5:14 pm
Reply with quote

the fact that You are using zOS is irrelevant,
what is necessary to know is what sort product You are using!
dfsort or syncsort

the info You provided is mislieading

DFSORT questions get better reply on the DFSORT/ICETOOL section where the answers are provided by DFSORT developers

SYCNSORT question are handled here ( JCL section )

Run the code below and post the JES SYSOUT element so that we can see the sort product and release level that you have installed.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Feb 18, 2011 5:21 pm
Reply with quote

there is syntax for literals with repeating characters.
there is also SYSNAMES, which would make your control statement really spiffy.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Feb 19, 2011 12:07 am
Reply with quote

Wolf,

Quote:
I got a requirement to replace all the text from columns 129-140 in the PS to 'ABCDE'.


129-140 would be 12 characters.

Code:

C'ABCDE                '


This is 21 characters and would overlay 129-149, not 129-140. So it's not clear which positions you actually want to overlay.

If you want to overlay 129-140, you can use these DFSORT statements:

Code:

   OPTION COPY
   INREC OVERLAY=(129:C'ABCDE',7X)


If you want to overlay 129-149, you can use these DFSORT statements:

Code:

   OPTION COPY
   INREC OVERLAY=(129:C'ABCDE',16X)
Back to top
View user's profile Send private message
grayWolf

New User


Joined: 04 Oct 2010
Posts: 19
Location: Land of broken dreams

PostPosted: Mon Feb 21, 2011 12:49 pm
Reply with quote

Guys,
I was off during the weekends icon_biggrin.gif So, coming back to the question, we are using DFSORT and apologies for not posting it on the "DFSORT/ICETOOL section ". I'm pretty new to this forum as suggested by the "new user" tag.
Quote:
129-140 would be 12 characters

You nailed it right. It has to be 12 characters and we are padding it with spaces and if you had seen my previous post, I had used the following"
Code:
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,128,129:C'ABCDE                ',150:150,26)


So I was looking for a better solution to this and your code:
Code:

   OPTION COPY
   INREC OVERLAY=(129:C'ABCDE',16X)
really helped.

Thanks Frank!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts DFSORT - VB file RDW getting overridden DFSORT/ICETOOL 3
Search our Forums:

Back to Top