IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

selecting records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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

Moderator Emeritus


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

PostPosted: Wed Oct 28, 2009 7:46 pm
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
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
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
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top