Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

selecting records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
raghavmcs

Active User


Joined: 14 Jul 2005
Posts: 105

PostPosted: Wed Oct 28, 2009 8:16 am    Post subject: selecting records
Reply with quote

Dear Experts,

I am working on following problem where I have o identify the records from a input flat file.
The input file is having records like

A B








123 52
123 54
123 57
123 52
123 92
124 52
124 54
124 57
124 58
124 52
124 92

The first three positions on column A should be considered as key,I meant every column B record should be attached to these three of column A.
Every number on column B(52,54,57,52,92) has special meaning attached.
The situation which I need to capture is any value which first starts with 52 and then changes to 54 then no necessarly 57(it may or may not),the before it gets value 92 it will always have value 52 occuring in file prior to that.Please note there could be n number of other values can occur in colum B but that will always start with 52.
Also there could be n number of records present in colum A.like in the above example there are 5 values present for value 123 whereas 6 records are for 124.
I want the output file should have value like

123 52
123 54
123 52
123 92

124 52
124 54
124 52
124 92

and so on..
The whole day I keep on thinking what to do to get this file..but I found myself trapped..so thought to check with you experts...I hope I was clear while stating the problem..please provide your input or let me know if this information is not suficient to proceed with...
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Oct 28, 2009 9:52 am    Post subject: Reply to: selecting records
Reply with quote

Hi,
If I have understood correctly.. Below simple code should work.

Code:

//S1    EXEC  PGM=SORT                 
//SORTIN DD *                         
123 52                                 
123 54                                 
123 57                                 
123 52                                 
123 92                                 
124 52                                 
124 54                                 
124 57                                 
124 58                                 
124 52                                 
124 92                                 
/*                                     
//SORTOUT DD SYSOUT=*                 
//SYSOUT    DD  SYSOUT=*               
//SYSPRINT DD SYSOUT=*                 
//SYSIN    DD  *                       
  OPTION COPY                                                   
  INCLUDE COND=(5,2,ZD,EQ,52,OR,5,2,ZD,EQ,54,OR,5,2,ZD,EQ,92)   
/*                                                               

This will give output,
Code:

123 52
123 54
123 52
123 92
124 52
124 54
124 52
124 92
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Oct 28, 2009 7:46 pm    Post subject:
Reply with quote

Hello,

Please post a more inclusive set of sample data. Some that have both the 52 and the 54 and some that do not and how the output shoud be created for this expanded set of sample data.

What if the first value is not 52? What if there is no 54? Etc. . .

The requirement may be as Sambhaji assumed, but your explanation appears to have more "rules" than merely including all of the records with the 4 values. Possibly i misunderstand. . .
Back to top
View user's profile Send private message
raghavmcs

Active User


Joined: 14 Jul 2005
Posts: 105

PostPosted: Wed Oct 28, 2009 8:20 pm    Post subject:
Reply with quote

dear Dick Sherrer,
Sorry If I was not clear..

I have redone the data and included some more description to make my case clear

Hope this clears out.Just to add the column a and b data types are packed(which I missed to add)



Situation 1

123 52(marker activity you can think like application file)
123 54 (second marker activity application rejected)
123 57 (some mid activities to do some verification for why got rejected)
123 52 (same marker activity re-appliation)
123 92 (application approved)

I want to capture this situation 1 in output..
Sambhaji,
The fault was at my side probably I did not stated well...

Situation 2

124 52 (marker activity you can think like application file)
124 54 (second marker activity application rejected)
124 57 (some mid activities to do some verification for why got rejected)
124 62(some other activity to do additional check why got rejected)
124 52 (same marker activity re-appliation)
124 54 (again rejected)
124 57 (some mid activities to do some verification for why got rejected)
124 62(some other activity to do additional check why got rejected)
124 63(additional checking same as above)
124 52(same marker activity application refiled)
124 92 (application approved)

I want to captue situation 2 in putput


Situation 3

123 52(marker activity you can think like application file)
123 92(application approved)

this situation is quiet normal means aplication file and approved so I do not want to capture this.


Please let me know if I need to clear more...
Back to top
View user's profile Send private message
raghavmcs

Active User


Joined: 14 Jul 2005
Posts: 105

PostPosted: Wed Oct 28, 2009 8:41 pm    Post subject:
Reply with quote

with situation3 I meant 125 than 123(my mistake)

125 52(marker activity you can think like application file)
125 92(application approved)

this situation is quiet normal means aplication file and approved so I do not want to capture this.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Oct 28, 2009 9:08 pm    Post subject:
Reply with quote

raghavmcs,

If I understood your requirement correctly you just want all the accounts which have multiple activity and within the multiple activity you just want to pick the first activity and the close activity (92). What happens if there is an account with multiple activity but no ending 92 activity? Do you need to pick this account in output?

I need the following details.

1. What is the lrecl and recfm of input file?
2. What is the position, length and format of column a and column B?
3. What is the lrecl and recfm of output file?
Back to top
View user's profile Send private message
raghavmcs

Active User


Joined: 14 Jul 2005
Posts: 105

PostPosted: Wed Oct 28, 2009 9:16 pm    Post subject:
Reply with quote

Skolusu,

If there is no end activity for 92 then that should not be captured
LRECL of input file 221
starting position of column a is 6 and the data type is s9(18) comp-3
starting position of field b on file is 34 and type is s9(5) comp-3
lrecl of the out put file is 221 there will be no layout chagne in output file means the layout would remain same as of input file

Just to add as I said there could be n number of records for situation-1 and situation-2 but yes the pattern I am looking for will be same as explained in situation-1 and situation-2

Thanks!!
Back to top
View user's profile Send private message
raghavmcs

Active User


Joined: 14 Jul 2005
Posts: 105

PostPosted: Thu Oct 29, 2009 3:21 am    Post subject:
Reply with quote

Did I missed anything Skolusu..or anywhere I am still not clear!!!

Thanks!
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Oct 29, 2009 6:53 am    Post subject:
Reply with quote

raghavmcs wrote:
Did I missed anything Skolusu..or anywhere I am still not clear!!!

Thanks!


Raghavmcs,

No you did not miss anything. It is just that I need to finish my regular work before I start working on helpboards

The following DFSORT JCL will give you the desired results.
Code:

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN=Your FB 221 byte input file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(222:SEQNUM,8,ZD,RESTART=(6,10))), 
  IFTHEN=(WHEN=GROUP,BEGIN=(222,8,ZD,EQ,1),PUSH=(230:1,221)),         
  IFTHEN=(WHEN=GROUP,BEGIN=(222,8,ZD,EQ,2),PUSH=(451:1,221)),         
  IFTHEN=(WHEN=GROUP,BEGIN=(34,3,PD,EQ,52),PUSH=(672:1,221)),         
  IFTHEN=(WHEN=(484,3,PD,EQ,92),OVERLAY(230:663X))                   
                                                                     
  OUTFIL INCLUDE=(34,3,PD,EQ,92,AND,230,221,CH,GT,C' '),             
  BUILD=(230,221,/,451,221,/,672,221,/,1,221)                         
//*
Back to top
View user's profile Send private message
raghavmcs

Active User


Joined: 14 Jul 2005
Posts: 105

PostPosted: Fri Oct 30, 2009 11:34 pm    Post subject:
Reply with quote

Thanks Skulosu!!

It was really a complex requirement which I got to work on,rather more than what I would have anticipated and really tough to meet the timeline.
I used you logic and used couple of more sort and finally a easytrieve file matching logic was able to come up with that what was needed bu business.

Thanks!!
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 30, 2009 11:50 pm    Post subject:
Reply with quote

raghavmcs wrote:
Thanks Skulosu!!

It was really a complex requirement which I got to work on,rather more than what I would have anticipated and really tough to meet the timeline.
I used you logic and used couple of more sort and finally a easytrieve file matching logic was able to come up with that what was needed bu business.

Thanks!!


raghavmcs,

Unless you haven't given me all the requirement , I don't see as to why you need additional sorts and on top of it an easytrieve program to perform the match
Back to top
View user's profile Send private message
raghavmcs

Active User


Joined: 14 Jul 2005
Posts: 105

PostPosted: Sat Oct 31, 2009 1:54 am    Post subject:
Reply with quote

Skolusu,

The requirement kept on changing since you posted your reply as I said it was not that easy what I was aniticipating.

Thanks and have a nice weekend ahead!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us