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
 

 

Replacing values in particular position in file using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Mon Jul 27, 2009 12:23 pm    Post subject: Replacing values in particular position in file using SORT
Reply with quote

Hi,

I want to modify values in a particular column (position no 1146) with new values ie. current value is '04040404' which i want to replace with '19000101' and there are 910 such occurances and the file size is approx 1,50,00,000 recordds. Someone please give me an idea if this is possible using SORT as I don't want to do it using 'C ALL' or programtically.

Any guidance on how to do it using SORt will be appreciated.

Thanks in advance.

Regards,
N
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: Mon Jul 27, 2009 8:47 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1146,8,CH,EQ,C'04040404'),
    OVERLAY=(1146:C'19000101'))
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss?rs=0&uid=isg3T7000080
Back to top
View user's profile Send private message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Tue Jul 28, 2009 10:10 am    Post subject: Reply to: Replacing values in particular position in file us
Reply with quote

Hi,

Thanks for your help. I tried the above solution. Please sse my JCL as follows

Code:


//ASCASOHT JOB   ('A'),'NILESH',CLASS=G,
// MSGCLASS=Y,NOTIFY=&SYSUID
//*
//STEP010  EXEC PGM=SORT,REGION=4096K
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=TRTEGCM.DNLD.GCM880ZE.TBGCISCY.G1771V00,DISP=SHR
//SORTOUT  DD DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            DCB=(SYSL.MODEL,RECFM=FB,LRECL=1236,BLKSIZE=0),
//            SPACE=(TRK,(9260,926),RLSE),
//            DSN=TRTEGCM.DNLD.GCM880ZE.TBGCISCY(+1)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1146,8,CH,EQ,C'04040404'),
    OVERLAY=(1146:C'19000101'))
/*
//


Job complete dsuccessfully. But still I got the same output .i.e '04040404' in 1146 columns (910 recrods).

Kindly advise.

Regards,
N
Back to top
View user's profile Send private message
deshmukhulhas16

New User


Joined: 27 Jul 2009
Posts: 1
Location: Pune

PostPosted: Tue Jul 28, 2009 12:16 pm    Post subject:
Reply with quote

Hi,

You can use a DFSORT job like the following to do what you asked for.
I think It wil work.

Code:

//SORT0001  EXEC PGM=SORT                           
//SORTIN    DD DSN=.......INFILE,DISP=SHR           
//SORTOUT   DD DSN=.......OUTFILE,DISP=SHR           
//            DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,   
//            SPACE=(CYL,(1,4),RLSE),               
//            DCB=(RECFM=FB,LRECL=1236,BLKSIZE=0)   
//SYSOUT    DD SYSOUT=*                             
//SYSIN     DD *                                     
   OPTION COPY                                       
   INREC FINDREP=(IN=C'04040404',OUT=C'19000101',   
                  STARTPOS=1146,ENDPOS=1154)         
/*                                                   


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

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Tue Jul 28, 2009 12:27 pm    Post subject: Reply to: Replacing values in particular position in file us
Reply with quote

there is no reason at all for Franks code not to give the expected result,
unless...

the info You provide is wrong/mistyped

04040404 looks to me like mistyped 40404040 which are simply 4 blanks ( in hex ),
but who knows ?
it would be wise to check again Your input and confirm the info provided ..
both the length and the exact content
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 Jul 28, 2009 12:31 pm    Post subject:
Reply with quote

deshmukhulhas16 wrote:

You can use a DFSORT job like the following to do what you asked for.
I think It wil work.

Have you tested this before posting
If not - WHY DID YOU POST IT

No offence intended, but as Frank is the developer of DFSORT, I rather tend to back his solutions over that of others.
Back to top
View user's profile Send private message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Tue Jul 28, 2009 2:11 pm    Post subject: Reply to: Replacing values in particular position in file us
Reply with quote

Apologies Frank...

It worked well.. Actually I put wrong position. The actual position was starting from 1146 instead of 1146. That's the reason I did not get postive result.

I corrected the position and it got success.

Anyway.. Thanks to Frank & Ulhas for their valuable guidance..

Regards,
N
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: Tue Jul 28, 2009 8:34 pm    Post subject:
Reply with quote

Quote:
The actual position was starting from 1146 instead of 1146.


Huh? Isn't that the same position? Anyway, I'm glad it worked for you.
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: Tue Jul 28, 2009 8:50 pm    Post subject:
Reply with quote

Quote:
You can use a DFSORT job like the following to do what you asked for.
I think It wil work.


Well, it would if you had the correct JCL for SORTOUT and an ENDPOS of 1153 instead of 1154.
Back to top
View user's profile Send private message
meenal_mainframes
Warnings : 1

New User


Joined: 07 Jul 2006
Posts: 9
Location: USA

PostPosted: Sat Sep 19, 2009 1:57 am    Post subject: Thanks
Reply with quote

I used this DFsort to replace a number in my input dataset and it worked.
Thank you Frank,

Regards,
Meenal..
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm


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