Hello,
I have a DFSORT that sorts, filters, and then builds an output record.
I need a 2nd (slightly different) record to also be written for each qualifying record (to the same DD preferably).
So far I cannot get it to work, and find no similar examples.
My last resort would be a completely seperate DFSORT step just to create the 2nd record, followed by another sort to merge the 2 files back into one. Not very elegant so I hope you can help!
Snippet from the example is below: (sorry I cannot get the formatting to show correctly)
Regards
Leon
SORT FIELDS=(77,8,PD,A, -
71,5,PD,A) -
INCLUDE COND=((165,2,ZD,EQ,02,OR,165,2,ZD,EQ,22),AND,
167,1,CH,NE,C'Y',AND, -
198,5,PD,LE,75000) -
OUTREC PARSE=(%01=(ABSPOS=130,ENDBEFR=C',',ENDBEFR=C'*',
FIXLEN=25), -
%02=(ENDBEFR=C',',ENDBEFR=C'*',FIXLEN=8)), -
BUILD=(001:C'UPDT', -
005:%01, -
030:%02,CHANGE=(8,C' ',C'IN'), -
NOMATCH=(%02), -
038:C'1111111111111', -
051:C' ', -
059:113,2, -
061:115,6, -
067:087,26, -
097:C' ', -
101:C' ', -
151:C' ', -
544:C' ', -
554:C' ', -
574:C' ')
writing 2 records for each qualifying input record.
Moderators: Frank Yaeger, Moderator Group
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Please use the Code tags to preserve spacing.
If you want two output records on the same output file, you need to use OUTFIL BUILD with the slash operator (/).
Would get two 10-byte records using data from the same input record.
If you want two output records on the same output file, you need to use OUTFIL BUILD with the slash operator (/).
Code: Select all
BUILD=(1,10,/,11,10)
Thanks William!
I got that part going! (but I must admit I cannot find any reference to the / operator in the manual)
I had to also change from OUTREC to OUTFIL and put the BUILD inside, but it works now, thanks very much.
My next problem now is that some of my resultant output records are duplicates which I want to remove.
Also I really need to sort that output again, as some of the changes in my 2nd row affects the sort key and the results are now not sorted correctly.
One way would be a new SORT step to sort again & drop dups, but is there an easy elegant way of doing it in one go?
Thanks
Leon
I got that part going! (but I must admit I cannot find any reference to the / operator in the manual)
I had to also change from OUTREC to OUTFIL and put the BUILD inside, but it works now, thanks very much.
My next problem now is that some of my resultant output records are duplicates which I want to remove.
Also I really need to sort that output again, as some of the changes in my 2nd row affects the sort key and the results are now not sorted correctly.
One way would be a new SORT step to sort again & drop dups, but is there an easy elegant way of doing it in one go?
Thanks
Leon
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
It can be done in one step using ICETOOL (two SORT operators, with USING for the first one to contain you existing code and then you'll need the new SUM) but I don't really regard it as elegant, because if the second operator fails, you have to re-do the first for no other reason than having to.
It could also be done with JOINKEYS. Convenient if you needed JOINKEYS, because you can do a SORT in the Main Task. But without needing the JOINKEYS, not so elegant.
If you search the DFSORT manual for "slash" you should find the documentation. It is in the description of the OUTFIL reporting functions, from memory.
It could also be done with JOINKEYS. Convenient if you needed JOINKEYS, because you can do a SORT in the Main Task. But without needing the JOINKEYS, not so elegant.
If you search the DFSORT manual for "slash" you should find the documentation. It is in the description of the OUTFIL reporting functions, from memory.
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