Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Select a record based on three values in a field

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

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Mon Dec 15, 2008 6:26 pm    Post subject: Select a record based on three values in a field
Reply with quote

Hi,

I need to select records based on a field which can have 3 different values.
Here is my input file:
Code:

M0001AAAAB0001EX
M0001AAAAB0002EX
M0001AAAAB0003EX
M0001AAAAB0004RE
M0001AAAAB0005RE
M0002AAAAB0001EX
M0002AAAAB0002EX
M0002AAAAB0003CA
M0002AAAAB0004EX
M0003AAAAB0001EX
M0003AAAAB0002EX
M0003AAAAB0003EX

RECFM=FB, LRECL=16
Key Position is (1,5)
Position (15,2) can have either (EX,RE,CA)
Each key can have combinations of (EX,RE) or (EX,CA) or (EX)
If the combination had (EX,RE) then the first RE should be written to output.
If the combination had (EX,CA) then the first CA should be written to output.
If the had only EX records then the first EX record should be written to output.

Here is my output file:
Code:

M0001AAAAB0004RE
M0002AAAAB0003CA
M0003AAAAB0001EX


Guide me how to get this output.
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Mon Dec 15, 2008 10:14 pm    Post subject: Reply to: Select a record based on three values in a field
Reply with quote

Bhaskar kaneti,

what happens if they key has a combo of RE and CA? which one should be picked?
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Mon Dec 15, 2008 10:36 pm    Post subject: Reply to: Select a record based on three values in a field
Reply with quote

Hi Skolusu,
The key will not have combinationg of RE and CA.
It will have only the below combinations.
(EX, CA) or (EX, RE) or (EX).
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Dec 15, 2008 10:39 pm    Post subject:
Reply with quote

bhaskar_kanteti,

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD *                                             
M0001AAAAB0001EX                                             
M0001AAAAB0002EX                                             
M0001AAAAB0003EX                                             
M0001AAAAB0004RE                                             
M0001AAAAB0005RE                                             
M0002AAAAB0001EX                                             
M0002AAAAB0002EX                                             
M0002AAAAB0003CA                                             
M0002AAAAB0004EX                                             
M0003AAAAB0001EX                                             
M0003AAAAB0002EX                                             
M0003AAAAB0003EX                                             
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                             
 SELECT FROM(IN) ON(1,5,CH) TO(OUT) FIRST USING(CTL1)       
//CTL1CNTL DD *                                             
  INREC IFTHEN=(WHEN=(15,2,CH,EQ,C'EX'),OVERLAY=(17:C'2')), 
        IFTHEN=(WHEN=(15,2,SS,EQ,C'CA,RE'),OVERLAY=(17:C'1'))
  SORT FIELDS=(1,5,CH,A,17,1,CH,A)                           
  OUTFIL FNAMES=OUT,BUILD=(1,16)                             
/*
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Tue Dec 16, 2008 1:28 pm    Post subject: Reply to: Select a record based on three values in a field
Reply with quote

Thanks Skolusu.
Job is producing the expected output.
Thank you so much.
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 Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us