Find and Replace using DFSORT
Moderators: Frank Yaeger, Moderator Group
Find and Replace using DFSORT
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.
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.
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
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
Anuj
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
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:
If you want to do something else, please explain more clearly what exactly it is you want to do.
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'))
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
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
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?
Are you saying that none of the solutions will work for you? Why?
Where? In positions 3847-3748 only? In positions 3847-x only (what is x)? Somewhere else?i am trying to change the French province code PQ to QC and NF to NL.
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
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
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.
the first method was error. this is the below code i tried and i got error.
below is the error message
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'))
/*
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)
/*
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
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
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.
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
Anuj
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
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
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
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
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
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page