Find and Replace using DFSORT

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
javalal
Member
Posts: 4
Joined: Fri Apr 30, 2010 8:21 am

Find and Replace using DFSORT

Post by javalal » Fri Apr 30, 2010 8:35 am

Hi,

I have a Dataset which is LRECL=5400. There are some records in the DSN which is having value as PQ or NF on 3847th byte. I need to replace those value into QC or NL respectively. I need the sample JCL with exact syntax how to do that using DFSORT.

you prompt reply is highly appreciated.

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Fri Apr 30, 2010 2:53 pm

Try something like this:

Code: Select all

//SYSIN    DD *                                                        
     OPTION COPY                                                      
     INREC FINDREP=(INOUT=(C'PQ',C'QC',C'NF',C'NL'),STARTPOS=3847,ENDPOS=5400) 
//*
Regards,
Anuj

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Apr 30, 2010 9:25 pm

javalal,

If you only want to change 'PQ' to 'QC' and 'NF' to 'NL' if they appear in positions 3847-3848, you can use one of these DFSORT jobs:

Code: Select all

//S1 EXEC PGM=SORT                                                  
//SYSOUT DD SYSOUT=*                                                
//SORTIN DD DSN=.... input file 
//SORTOUT DD DSN=...  output file                                       
//SYSIN DD *                                                        
  OPTION COPY                                                       
  INREC OVERLAY=(3847:3847,2,CHANGE=(2,C'PQ',C'QC',C'NF',C'NL'),    
    NOMATCH=(3847,2))                 

Code: Select all

                              
//S2 EXEC PGM=SORT                                                  
//SYSOUT DD SYSOUT=*      
//SORTIN DD DSN=.... input file 
//SORTOUT DD DSN=...  output file                                             
//SYSIN DD *                                                        
  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=(3847,2,CH,EQ,C'PQ'),OVERLAY=(3847:C'QC')),    
        IFTHEN=(WHEN=(3847,2,CH,EQ,C'NF'),OVERLAY=(3847:C'NL'))     
If you want to do something else, please explain more clearly what exactly it is you want to do.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

javalal
Member
Posts: 4
Joined: Fri Apr 30, 2010 8:21 am

Post by javalal » Sat May 01, 2010 1:30 am

what I am trying to do is, few of the records in the DSN is having province code in french. most of them are in English. i am trying to change the French province code PQ to QC and NF to NL.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Sat May 01, 2010 1:56 am

We've shown you three different ways to use DFSORT to make the change. Which you use depends on what you're trying to do exactly, which you still haven't explained.

Are you saying that none of the solutions will work for you? Why?
i am trying to change the French province code PQ to QC and NF to NL.
Where? In positions 3847-3748 only? In positions 3847-x only (what is x)? Somewhere else?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

javalal
Member
Posts: 4
Joined: Fri Apr 30, 2010 8:21 am

Post by javalal » Sun May 02, 2010 12:24 am

Hi,

I have tried the First and Third method. The first method did not work. I got some error. i think that error because of the DFOSRT version which i am using in my mainframe. the third method worked. I did not try the second method.

Code: Select all

//STEP030  EXEC SORTPROC,WRKSZE=800,AUX=300                        
//SORTIN   DD  DSN=NCFT.NCF9050D.STEP030.TEMP,                     
//             DISP=SHR                                            
//SORTOUT  DD  DSN=NCFT.NCF9050D.STEP030A,                         
//             DISP=(NEW,CATLG,DELETE),                            
//             UNIT=PRD,SPACE=(CYL,(900,900),RLSE), WAS 1800,800   
//             DCB=(MODDSCB,RECFM=FB,LRECL=5448,BLKSIZE=0)         
//SYSIN    DD  *    
  SORT FIELDS=(56,17,CH,A)                                               
  OPTION COPY                                                      
  INREC IFTHEN=(WHEN=(3847,2,CH,EQ,C'PQ'),OVERLAY=(3847:C'QC')),   
  IFTHEN=(WHEN=(3847,2,CH,EQ,C'NF'),OVERLAY=(3847:C'NL'))          
/*                                                                 
the first method was error. this is the below code i tried and i got error.

Code: Select all

//STEP030  EXEC SORTPROC,WRKSZE=800,AUX=300                       
//SORTIN   DD  DSN=NCFT.NCF9050D.STEP030,                         
//             DISP=SHR                                           
//SORTOUT  DD  DSN=NCFT.NCF9050D.STEP030A,                        
//             DISP=(NEW,CATLG,DELETE),                           
//             UNIT=PRD,SPACE=(CYL,(900,900),RLSE), WAS 1800,800  
//             DCB=(MODDSCB,RECFM=FB,LRECL=5448,BLKSIZE=0)        
//SYSIN    DD  *                                                  
  OPTION COPY                                                     
  INREC FINDREP=(INOUT=(C'PQ',C'QC',C'NF',C'NL'), -               
                 STARTPOS=3847,ENDPOS=5448)                       
/*                                                                
below is the error message

Code: Select all

ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 15:26 ON FRI APR 30, 2010 -
            OPTION COPY                                                         
            INREC FINDREP=(INOUT=(C'PQ',C'QC',C'NF',C'NL'), -                   
                  $                                                             
ICE104A 0 INVALID INREC OR OUTREC STATEMENT OPERAND                             
                           STARTPOS=3847,ENDPOS=5448)                           
                           $                                                    
ICE005A 0 STATEMENT DEFINER ERROR                                               
ICE751I 0 C5-K90007 C6-K90007 C7-K90000 C8-K90007 E7-K11698                     
ICE052I 3 END OF DFSORT                                                         

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Sun May 02, 2010 11:59 am

That's correct - the error message indicates you do not have z/OS DFSORT V1R5 PTF UK90013 (July, 2008) installed. In order FINDREP to work, you need this PTF. You might like to ask your System Programmer to install it (it's free, as you are a DFSORT user).

You might like to visit this link www.ibm.com/systems/support/storage/sof ... /mvs/ugpf/ for complete details on the FINDREP function and the other functions available with PTF UK90013.
Regards,
Anuj

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Mon May 03, 2010 9:10 pm

Javalal,

Actually, ask your System Programmer to install z/OS DFSORT V1R5 PTF UK51706 (Nov, 2009). That will get you all of the latest DFSORT functions.
For more information on the functions available with various DFSORT PTFs, see:

http://www.ibm.com/support/docview.wss? ... g3T7000079
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others