I have the input file with below records
AAA;CANADA,TRADE ANALYTICS
BBB;BOTSWANA,FINANCE SYSTEMS
CCC AMERICAS
DDD;DUN AND BRADSTREETUSA
If the field 4 in input file is ; i need to write those records into one output file.
If the field 4 in input file is other than ; i need to write those records into another output file.
Need to create 2 output files based on input file column
Moderators: Frank Yaeger, Moderator Group
-
- Member
- Posts: 22
- Joined: Wed Apr 15, 2009 11:51 pm
- Location: london
-
- Active Member
- Posts: 52
- Joined: Wed Mar 25, 2009 11:56 pm
- Location: Banglore
try below code.
Code: Select all
//SORT6 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAA;CANADA,TRADE ANALYTICS
BBB;BOTSWANA,FINANCE SYSTEMS
CCC AMERICAS
DDD;DUN AND BRADSTREETUSA
/*
//OUT1 DD disp=shr,dsn=file1
//OUT2 DD disp=shr,dsn=file2
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=OUT1,INCLUDE=(4,1,CH,EQ,C';')
OUTFIL FNAMES=OUT2,INCLUDE=(4,1,CH,NE,C';')
/*
Thanks
MaheshVamsi
MaheshVamsi
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
neo,
Here's a DFSORT job that will do what you asked for:
Here's a DFSORT job that will do what you asked for:
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//OUT1 DD DSN=... output file1
//OUT2 DD DSN=... output file2
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=OUT1,INCLUDE=(4,1,CH,EQ,C';')
OUTFIL FNAMES=OUT2,SAVE
/*
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
-
- Member
- Posts: 22
- Joined: Wed Apr 15, 2009 11:51 pm
- Location: london
-
- Active Member
- Posts: 52
- Joined: Wed Mar 25, 2009 11:56 pm
- Location: Banglore
Little bit modification to your contol card can achieve this.
Assuming Record length as 80
Assuming Record length as 80
Code: Select all
OPTION COPY
OUTFIL FNAMES=OUT1,INCLUDE=(1,80,SS,EQ,C';')
OUTFIL FNAMES=OUT2,SAVE
Thanks
MaheshVamsi
MaheshVamsi
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