Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : All available storage is assigned to the job or jobstep, If REGION is coded 0K or 0M

Google
 
Web mainframegurukul.com

Sort and filter a file into multiple files using 1 sort card

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
ChykyMunky
Member


Joined: 05 May 2015
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Jun 09, 2015 8:05 pm    Post subject: Sort and filter a file into multiple files using 1 sort card Reply with quote

** Please show code in your explanation **

Hi,
If I have an input file I want to be able to split the data into multiple output, and as it splits the data I want it to also sort the data.

So my files would be:
Code:

INPUT.FILE1
OUTPUT.FILE1
OUTPUT.FILE2


Inside my input file is the following data
Code:

REC1 XXX
REC2 TTT
REC1 AAA
REC2 BBB
REC1 SSS
REC2 CCC


Now in my output file not only should it split REC1 and REC2 but it should also sort the remaining letter in alphabetic order. So it looks like this.
Code:

OUTPUT.FILE1
REC1 AAA
REC1 SSS
REC1 XXX

OUTPUT.FILE2
REC2 BBB
REC2 CCC
REC2 TTT


** Please show code in your explanation **
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

William Collins
Active Member


Joined: 24 May 2012
Posts: 714

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Jun 09, 2015 9:06 pm    Post subject: Reply with quote

So you SORT the data on the letters.

You use OUTFIL with INCLUDE= for the "REC1", FNAMES for your first output DD.

Use OUTFIL with SAVE for the second output DD.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
ChykyMunky
Member


Joined: 05 May 2015
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Jun 10, 2015 2:56 am    Post subject: Reply with quote

Sorry William,
I wrote the example to be simple but in actuality the data I will be working with won't be. I will be working with many different files. They will need to be sorted on more than one criteria. Some will need to be sorted by name, other by date, time, etc. And even in combinations.

I hope I explained that better, or would you like me to provide examples?
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
ChykyMunky
Member


Joined: 05 May 2015
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Jun 10, 2015 6:17 pm    Post subject: Reply with quote

After talking to a coworker about this topic, what I want to be cant be done.
You can only have one sort field per sort card.
I will have to create a different sort card for each file and work with them separately.
So first I will filter my data into separate files, then sort each file individually.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 714

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Jun 10, 2015 8:57 pm    Post subject: Reply with quote

Well, your co-worker is talking bananas, but if you want extra resource costs for your client, go with your idea.

If you require some more hints, provide better explanations and representative sample data.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
ChykyMunky
Member


Joined: 05 May 2015
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Jun 12, 2015 1:23 am    Post subject: Reply with quote

Code:

1310078+INVALID ACCOUNT NUMBER
11CLIENT100760702115922710006110221F6F6F BR42364186732232502210437120000101
12CUSTOMERA0076072211592284000610312 N4N4NBB427537468055001503121141520000101 
1A0527I3I3I0610FBB440897171593261505270322080000101100000CCP
1310061+WRONG MERCHANT NUMBER
1A0527I3I3I0610FBB440897171593241505270414490000101100000CCP
11CLEINT300760702115922710006110305U4U4UBR420423966781231503052129190000101
1310231+MISSING USER ID
12CUSTOMERA00760722115922840006120604N4N4NBB442456972745221506041402480000101
11CLIENT400760702115922710006170305U4U4UBR420424366781291503052141300000201
1A0527I3I3I0610FBB440897471593291505270625500000201100000CCP
1A0527N3I30610FBB440897671593351505270443030000201503100 CCP
12CUSTOMERW00760722115922840006110317P2P2PBB427537468055001503171519310000201     
11CLIENT200760702115922710006160304U3U3UBR420424366781291503042137500000101           
12CUSTOMERW00760722115922840006120424R5N5RBB434930569614871504241246270000101           


So above is the input data that I would need moved into 4 files based on whats in the first 2 columns.
1A to REPORT1A, and so on with 11, 12, and 13. This is the easy part cuz I can accomplish that with INCLUDE command.

Now heres the tricky part... Sorting on different fields
I want REPORT1A to sort on field 15-18
REPORT11 on field 3-9, 17-20, and 24-30
REPORT12 on field 3-12,13-21
REPORT13 on field 3-7

Is that possible?
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 714

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Jun 12, 2015 2:58 am    Post subject: Reply with quote

Yes, you temporarily extend the records with INREC, to include enough bytes for the longest key. You put the key in the extension, depending on the type, using IFTHEN=(WHEN=(logical expression). Then you SORT on the extended key, and use four OUTFILs with three INCLUDE= for the different key, with BUILD to reduce the record to the original data, and a final OUTFIL with SAVE and the same BUILD.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
ChykyMunky
Member


Joined: 05 May 2015
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Sat Jun 13, 2015 6:58 am    Post subject: Reply with quote

Oh wow. Ive never done any of that before. My experience with JCL is pretty basic.

Can you show the code for that?
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 714

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jun 15, 2015 1:36 pm    Post subject: Reply with quote

Code:
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),
          BUILD=(1,10,3,2,2X)),
        IFTHEN=(WHEN=NONE,
          BUILD=(1,10,5,4))

  SORT FIELDS=(11,4,CH,A)
 
  OUTFIL FNAMES=TYPEA,
         INCLUDE=(1,1,CH,EQ,C'A'),
         BUILD=(1,10)

  OUTFIL FNAMES=REST,
         SAVE,
         BUILD=(1,10)


There's an example using two different sort keys, two different output DDs and fixed-length records.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
ChykyMunky
Member


Joined: 05 May 2015
Posts: 12

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Jun 16, 2015 2:57 am    Post subject: Reply with quote

Can you show me the code with the example I gave. Im just not getting how the fields are getting sorted. Under normal circumstances I could research this, however, I have to present this idea soon.

Like I said though, I'm not all the familiar with SORT, or JCL. Im really confused about the BUILD condition because I thought that was for formating. And I don't know the input or the output of the file being used in the example so I cant even make the connections.

This is what I have so far. I really don't understand the rest.


Code:

OUTFIL FILES=1,             
  INCLUDE=(1,2,CH,EQ,C'1A')
OUTFIL FILES=2,             
  INCLUDE=(1,2,CH,EQ,C'11')
OUTFIL FILES=3,             
  INCLUDE=(1,2,CH,EQ,C'12')
OUTFIL FILES=4,             
  INCLUDE=(1,2,CH,EQ,C'13')
SORT FIELDS=COPY           
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Page 1 of 1



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Am I using DFSORT or Syncsort? 10 Anuj Dhawan 11777 Mon Feb 01, 2016 11:07 pm
academyindia4 View latest post
No new posts solve it 10 Abhiyanta 14501 Wed Jan 27, 2016 8:15 pm
academyindia4 View latest post
No new posts Is it possible to throw ISPF panels from PL/I programs? 2 rangab 8261 Tue Jan 19, 2016 12:51 pm
academyindia4 View latest post
No new posts How do I add sticky in this Forum ? 10 Anuj Dhawan 14036 Mon Dec 06, 2010 3:07 pm
Anuj Dhawan View latest post
No new posts Pl/I for windows 0 MikeJ024 5813 Tue Jun 24, 2008 2:40 pm
MikeJ024 View latest post
 


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-7883.html