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
 

 

ICETOOL - select first 5 records from every set

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
Elixir

Active User


Joined: 08 Feb 2009
Posts: 116
Location: CHENNAI/NEW JERSEY - INDIA/USA

PostPosted: Wed Nov 02, 2011 12:27 am    Post subject: ICETOOL - select first 5 records from every set
Reply with quote

Using ICETOOL is it possible to select first 5 records from every set(using first 3 bytes) of records in the below file,

SET1a
SET1b
SET1c
SET1d
SET1e
SET1f
SET2g
SET3h
SET3i
SET3j
SET3k
SET4l
SET4m
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 Nov 02, 2011 12:51 am    Post subject:
Reply with quote

Hello,

If you want help, you need to provide enough info for someone to use to help. . .

From the "sample input" what should be the output? You mention the first 3 bytes, but they are all the same.

A better explanaton of the "rules" and more representative input/output data may help. Also, mention the recfm and lrecl of the files.
Back to top
View user's profile Send private message
Elixir

Active User


Joined: 08 Feb 2009
Posts: 116
Location: CHENNAI/NEW JERSEY - INDIA/USA

PostPosted: Wed Nov 02, 2011 1:41 am    Post subject:
Reply with quote

The expected output is as below,

SET1a
SET1b
SET1c
SET1d
SET1e
SET2g
SET3h
SET3i
SET3j
SET3k
SET4l
SET4m

Input and output both have same record length of 4 bytes.
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Wed Nov 02, 2011 1:45 am    Post subject:
Reply with quote

Hi Elixir,

Use below sort card

Code:
//STEP010  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD  SYSOUT=*                                                 
//DFSMSG   DD  SYSOUT=*                                                 
//INPUT1   DD  *                                                       
SET1A                                                                   
SET1B                                                                   
SET1C                                                                   
SET1D                                                                   
SET1E                                                                   
SET1F                                                                   
SET2G                                                                   
SET3H                                                                   
SET3I                                                                   
SET3J                                                                   
SET3K                                                                   
SET4L                                                                   
SET4M                                                                   
/*                                                                     
//MATCH    DD  SYSOUT=*                                                 
//TOOLIN   DD *                                                         
   COPY FROM(INPUT1) TO(MATCH) USING(CTL1)                           
//CTL1CNTL DD *                                                     
 INREC FIELDS=(1:1,10,21:SEQNUM,10,ZD,START=1,INCR=1,RESTART=(1,4)) 
 OUTFIL FNAMES=MATCH,                                               
 INCLUDE=(21,10,ZD,LE,5),                                           
 OUTREC=(1:1,10)                                                     
/*                                                                   


Output:

Code:
SET1A
SET1B
SET1C
SET1D
SET1E
SET2G
SET3H
SET3I
SET3J
SET3K
SET4L
SET4M



Sai
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 Nov 02, 2011 2:37 am    Post subject: Reply to: ICETOOL - select first 5 records from every set
Reply with quote

Hello,

Quote:
Input and output both have same record length of 4 bytes.
Ah, Errr, Ummm - there are 5 on my screen. . . (i.e. SET4m).

The solution Sai posted may do what you want, but not because you posted anything worth using to help you. . .

Is it really that difficult to post what you actually have and what you want from it. . . icon_sad.gif

d
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Nov 05, 2011 2:44 am    Post subject:
Reply with quote

Elixir,

I don't usually look in this Forum, but I happened to notice it. It would be better to post DFSORT questions in the DFSORT Forum where I hang out.

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG  DD SYSOUT=*                                     
//IN DD DSN=...  input file                                                 
//OUT DD DSN=...  output file                                       
//TOOLIN DD *                                             
SELECT FROM(IN) TO(OUT) ON(1,4,CH) FIRST(5)               
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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