SORTCARD help
Moderators: Frank Yaeger, Moderator Group
-
- Member
- Posts: 4
- Joined: Fri Jul 06, 2012 9:02 pm
SORTCARD help
Input VB file.
01YYYYYYYYYY
20AAAAAAAAAA
40BBBBBBBBBB404,404,404
40CCCCCCCCCC505,505,505
40DDDDDDDDDD404505404
Output FB file
404404404
505505505
404505404
I want the ','s removed from the record (13th character to 27) whose starting position is '40'
I want to know if this can be done in a single step. I have written the sortcard but it is done in 3 steps.
My sort cards below
1) Select the required data from the input file
SORT FIELDS=(17,15,CH,A)
INCLUDE COND=(5,2,CH,EQ,C'40')
OUTREC FIELDS=(17,15),CONVERT
2) Replace the commas
OPTION COPY
INREC FINDREP=(INOUT=(C',',C''))
3) Remove the duplicates
SORT FIELDS=(1,15,CH,A)
SUM FIELDS=NONE
Thanks
01YYYYYYYYYY
20AAAAAAAAAA
40BBBBBBBBBB404,404,404
40CCCCCCCCCC505,505,505
40DDDDDDDDDD404505404
Output FB file
404404404
505505505
404505404
I want the ','s removed from the record (13th character to 27) whose starting position is '40'
I want to know if this can be done in a single step. I have written the sortcard but it is done in 3 steps.
My sort cards below
1) Select the required data from the input file
SORT FIELDS=(17,15,CH,A)
INCLUDE COND=(5,2,CH,EQ,C'40')
OUTREC FIELDS=(17,15),CONVERT
2) Replace the commas
OPTION COPY
INREC FINDREP=(INOUT=(C',',C''))
3) Remove the duplicates
SORT FIELDS=(1,15,CH,A)
SUM FIELDS=NONE
Thanks
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
Input VB file.
Output FB file
Code: Select all
5---10---15---20---25---30---35---40
01YYYYYYYYYY
20AAAAAAAAAA
40BBBBBBBBBB404,404,404
40CCCCCCCCCC505,505,505
40DDDDDDDDDD404505404
Code: Select all
0---5---10---15---20---25---30---35---40
404404404
505505505
404505404
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
-
- Member
- Posts: 4
- Joined: Fri Jul 06, 2012 9:02 pm
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Use the following DFSORT JCL which will give you the desired results in a single pass of data
Code: Select all
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your Input VB File,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(5,2,CH,EQ,C'40')
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,17,15)),
IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=5,INOUT=(C',',C''))),
IFTHEN=(WHEN=(1,2,BI,LE,19),OVERLAY=(19:X))
SORT FIELDS=(5,15,CH,A)
SUM FIELDS=NONE
OUTFIL VTOF,BUILD=(5,15)
//*
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