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
 

 

DFSORT in JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: DFSORT in JCL
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: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 18, 2011 1:51 pm    Post subject:
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: 6967
Location: porcelain throne

PostPosted: Fri Feb 18, 2011 2:02 pm    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Fri Feb 18, 2011 5:14 pm    Post subject: Reply to: DFSORT in JCL
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: 6967
Location: porcelain throne

PostPosted: Fri Feb 18, 2011 5:21 pm    Post subject:
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 Moderator


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

PostPosted: Sat Feb 19, 2011 12:07 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am


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